3DCoat
3D-COAT 4.9.xx
3DCoat is the one application that has all the tools you need to take your 3D idea from a block of digital clay all the way to a production ready, fully textured organic or hard surface model.
|
This class used to perform shader-based calculations The usual pattern of usage: More...
#include <ShaderCalc.h>
Public Member Functions | |
template<class Type > | |
void | toGpu (const char *name, cList< Type > &array, comms::cFormat::Enum format) |
Pass the input array for the calculations. More... | |
void | AssignShader (const char *name) |
Assign the shader for the calculations. Don't call it often, it results in shader compiling. More... | |
void | Assign (const char *id, int value) |
pass the variable into the shader More... | |
void | AddSampler (const char *name, int TextureID) |
Add external texture to be used as the sampler in the shader calculations. More... | |
texInfo * | Output (const char *name, cPtrDiff AmountOfElements, comms::cFormat::Enum format) |
Reserve the space for the output of the calculations. More... | |
void | Execute (const char *OutputTextureName) |
Execute the shader over the chosen render target. More... | |
template<class Type > | |
void | fromGpu (const char *name, cList< Type > &array) |
retrieve the result of the calculation More... | |
void | ReturnTexturesToCommonPool () |
return all used textures to the pool for the further usage but keep all inner structures for the fast re-use. Use it at the end of calculation cycle More... | |
void | FreeTextures () |
return all used textures to the pool for the further usage, clear textures array More... | |
This class used to perform shader-based calculations The usual pattern of usage:
void scalc::ShaderCalc::AddSampler | ( | const char * | name, |
int | TextureID | ||
) |
Add external texture to be used as the sampler in the shader calculations.
name | The name of the sampler to refer in the shader |
TextureID | the external texture ID |
Referenced by scalc::VolumeObjectCellsGPU::PassAlpha().
void scalc::ShaderCalc::Assign | ( | const char * | id, |
int | value | ||
) |
pass the variable into the shader
id | the uniform variable name to refer in shader |
value | the value to pass |
Referenced by scalc::VolumeObjectCellsGPU::AddCells(), scalc::VolumeObjectCellsGPU::PassTrajectory(), and scalc::VolumeObjectCellsGPU::TrajectoryOverGPU().
void scalc::ShaderCalc::AssignShader | ( | const char * | name | ) |
Assign the shader for the calculations. Don't call it often, it results in shader compiling.
name | that path to file relative to the data/Shaders/ |
Referenced by scalc::VolumeObjectCellsGPU::Operate().
void scalc::ShaderCalc::Execute | ( | const char * | OutputTextureName | ) |
Execute the shader over the chosen render target.
OutputTextureName | the name of the output render targed, should be reserved preliminary withe the ReserveLinearOutputCapacity |
Referenced by scalc::VolumeObjectCellsGPU::Operate().
void scalc::ShaderCalc::FreeTextures | ( | ) |
return all used textures to the pool for the further usage, clear textures array
References scalc::TexPool::returnToPool().
void scalc::ShaderCalc::fromGpu | ( | const char * | name, |
cList< Type > & | array | ||
) |
retrieve the result of the calculation
Type | the type of the array element |
name | name of the render target |
array | the resulting array |
Referenced by scalc::VolumeObjectCellsGPU::BackToCells().
ShaderCalc::texInfo * scalc::ShaderCalc::Output | ( | const char * | name, |
cPtrDiff | AmountOfElements, | ||
comms::cFormat::Enum | format | ||
) |
Reserve the space for the output of the calculations.
name | the name of the render target, it will be referred in the Execute |
AmountOfElements | the size of output array to be calculated |
format | the output texture format |
References scalc::TexPool::returnToPool().
Referenced by scalc::VolumeObjectCellsGPU::AddCells().
void scalc::ShaderCalc::ReturnTexturesToCommonPool | ( | ) |
return all used textures to the pool for the further usage but keep all inner structures for the fast re-use. Use it at the end of calculation cycle
References scalc::TexPool::returnToPool().
Referenced by scalc::VolumeObjectCellsGPU::BackToCells().
void scalc::ShaderCalc::toGpu | ( | const char * | name, |
cList< Type > & | array, | ||
comms::cFormat::Enum | format | ||
) |
Pass the input array for the calculations.
Type | the array element type |
name | name to be referred in the shader |
array | the array to pass into the shader |
format | the data format |
Referenced by scalc::VolumeObjectCellsGPU::AddCells(), and scalc::VolumeObjectCellsGPU::PassTrajectory().