Classes | Public Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
gte::Fluid2InitializeSource Class Reference

#include <GteFluid2InitializeSource.h>

Classes

struct  External
 
struct  Vortex
 

Public Member Functions

void Execute (std::shared_ptr< GraphicsEngine > const &engine)
 
 Fluid2InitializeSource (std::shared_ptr< ProgramFactory > const &factory, int xSize, int ySize, int numXThreads, int numYThreads, std::shared_ptr< ConstantBuffer > const &parameters)
 
std::shared_ptr< Texture2 > const & GetSource () const
 

Private Types

enum  { NUM_VORTICES = 1024 }
 

Private Attributes

std::shared_ptr< ConstantBuffermExternal
 
std::shared_ptr< ComputeProgrammGenerateVortex
 
std::shared_ptr< ComputeProgrammInitializeSource
 
int mNumXGroups
 
int mNumYGroups
 
std::shared_ptr< Texture2mSource
 
std::shared_ptr< Texture2mVelocity0
 
std::shared_ptr< Texture2mVelocity1
 
std::shared_ptr< ConstantBuffermVortex
 

Static Private Attributes

static std::string const * msGenerateSource [ProgramFactory::PF_NUM_API]
 
static std::string const msGLSLGenerateSource
 
static std::string const msGLSLInitializeSource
 
static std::string const msHLSLGenerateSource
 
static std::string const msHLSLInitializeSource
 
static std::string const * msInitializeSource [ProgramFactory::PF_NUM_API]
 

Detailed Description

Definition at line 20 of file GteFluid2InitializeSource.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
NUM_VORTICES 

Definition at line 44 of file GteFluid2InitializeSource.h.

Constructor & Destructor Documentation

Fluid2InitializeSource::Fluid2InitializeSource ( std::shared_ptr< ProgramFactory > const &  factory,
int  xSize,
int  ySize,
int  numXThreads,
int  numYThreads,
std::shared_ptr< ConstantBuffer > const &  parameters 
)

Definition at line 15 of file GteFluid2InitializeSource.cpp.

Member Function Documentation

void Fluid2InitializeSource::Execute ( std::shared_ptr< GraphicsEngine > const &  engine)

Definition at line 69 of file GteFluid2InitializeSource.cpp.

std::shared_ptr< Texture2 > const & gte::Fluid2InitializeSource::GetSource ( ) const
inline

Definition at line 77 of file GteFluid2InitializeSource.h.

Member Data Documentation

std::shared_ptr<ConstantBuffer> gte::Fluid2InitializeSource::mExternal
private

Definition at line 63 of file GteFluid2InitializeSource.h.

std::shared_ptr<ComputeProgram> gte::Fluid2InitializeSource::mGenerateVortex
private

Definition at line 60 of file GteFluid2InitializeSource.h.

std::shared_ptr<ComputeProgram> gte::Fluid2InitializeSource::mInitializeSource
private

Definition at line 61 of file GteFluid2InitializeSource.h.

int gte::Fluid2InitializeSource::mNumXGroups
private

Definition at line 59 of file GteFluid2InitializeSource.h.

int gte::Fluid2InitializeSource::mNumYGroups
private

Definition at line 59 of file GteFluid2InitializeSource.h.

std::string const * Fluid2InitializeSource::msGenerateSource
staticprivate
Initial value:

Definition at line 73 of file GteFluid2InitializeSource.h.

std::string const Fluid2InitializeSource::msGLSLGenerateSource
staticprivate
Initial value:
=
"uniform Parameters\n"
"{\n"
" vec4 spaceDelta; // (dx, dy, 0, 0)\n"
" vec4 halfDivDelta; // (0.5/dx, 0.5/dy, 0, 0)\n"
" vec4 timeDelta; // (dt/dx, dt/dy, 0, dt)\n"
" vec4 viscosityX; // (velVX, velVX, 0, denVX)\n"
" vec4 viscosityY; // (velVX, velVY, 0, denVY)\n"
" vec4 epsilon; // (epsilonX, epsilonY, 0, epsilon0)\n"
"};\n"
"\n"
"uniform Vortex\n"
"{\n"
" vec4 data; // (x, y, variance, amplitude)\n"
"};\n"
"\n"
"layout(rg32f) uniform readonly image2D inVelocity;\n"
"layout(rg32f) uniform writeonly image2D outVelocity;\n"
"\n"
"layout (local_size_x = NUM_X_THREADS, local_size_y = NUM_Y_THREADS, local_size_z = 1) in;\n"
"void main()\n"
"{\n"
" ivec2 c = ivec2(gl_GlobalInvocationID.xy);\n"
" vec2 location = spaceDelta.xy*(c + 0.5f);\n"
" vec2 diff = location - data.xy;\n"
" float arg = -dot(diff, diff) / data.z;\n"
" float magnitude = data.w*exp(arg);\n"
" vec2 vortexVelocity = magnitude*vec2(diff.y, -diff.x);\n"
" imageStore(outVelocity, c, vec4(imageLoad(inVelocity, c).xy + vortexVelocity, 0.0f, 0.0f));\n"
"}\n"

Definition at line 69 of file GteFluid2InitializeSource.h.

std::string const Fluid2InitializeSource::msGLSLInitializeSource
staticprivate

Definition at line 70 of file GteFluid2InitializeSource.h.

std::string const Fluid2InitializeSource::msHLSLGenerateSource
staticprivate
Initial value:
=
"cbuffer Parameters\n"
"{\n"
" float4 spaceDelta; // (dx, dy, 0, 0)\n"
" float4 halfDivDelta; // (0.5/dx, 0.5/dy, 0, 0)\n"
" float4 timeDelta; // (dt/dx, dt/dy, 0, dt)\n"
" float4 viscosityX; // (velVX, velVX, 0, denVX)\n"
" float4 viscosityY; // (velVX, velVY, 0, denVY)\n"
" float4 epsilon; // (epsilonX, epsilonY, 0, epsilon0)\n"
"};\n"
"\n"
"cbuffer Vortex\n"
"{\n"
" float4 data; // (x, y, variance, amplitude)\n"
"};\n"
"\n"
"Texture2D<float2> inVelocity;\n"
"RWTexture2D<float2> outVelocity;\n"
"\n"
"[numthreads(NUM_X_THREADS, NUM_Y_THREADS, 1)]\n"
"void CSMain(uint3 c : SV_DispatchThreadID)\n"
"{\n"
" float2 location = spaceDelta.xy*(c.xy + 0.5f);\n"
" float2 diff = location - data.xy;\n"
" float arg = -dot(diff, diff) / data.z;\n"
" float magnitude = data.w*exp(arg);\n"
" float2 vortexVelocity = magnitude*float2(diff.y, -diff.x);\n"
" outVelocity[c.xy] = inVelocity[c.xy] + vortexVelocity;\n"
"}\n"

Definition at line 71 of file GteFluid2InitializeSource.h.

std::string const Fluid2InitializeSource::msHLSLInitializeSource
staticprivate

Definition at line 72 of file GteFluid2InitializeSource.h.

std::string const * Fluid2InitializeSource::msInitializeSource
staticprivate
Initial value:

Definition at line 74 of file GteFluid2InitializeSource.h.

std::shared_ptr<Texture2> gte::Fluid2InitializeSource::mSource
private

Definition at line 66 of file GteFluid2InitializeSource.h.

std::shared_ptr<Texture2> gte::Fluid2InitializeSource::mVelocity0
private

Definition at line 64 of file GteFluid2InitializeSource.h.

std::shared_ptr<Texture2> gte::Fluid2InitializeSource::mVelocity1
private

Definition at line 65 of file GteFluid2InitializeSource.h.

std::shared_ptr<ConstantBuffer> gte::Fluid2InitializeSource::mVortex
private

Definition at line 62 of file GteFluid2InitializeSource.h.


The documentation for this class was generated from the following files:


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:06