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.
|
the class used to perform GPU calculations over voxels More...
#include <ShaderCalc.h>
Public Member Functions | |
void | AddCells (PassedCells &cache, const char *preffix, VolumeObject *vo, cList< std::pair< tri_DWORD, VolumeCell * >> &cells, bool CopyValues, bool CreateBackIndex) |
Pass cells as input or output of the shader. More... | |
void | Operate (const char *ShaderName, const char *OutputPreffix) |
Run the shaders calculations. More... | |
void | BackToCells (PassedCells &cells) |
put the calculation results back into cells More... | |
void | PassAlpha (const char *name, AlphaShapeRef &Ref) |
pass the alpha reference to be used in shader More... | |
void | PassTrajectory (cList< TrElement > &Trajectory) |
pass the trajectory into the shader (in local space) More... | |
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... | |
Static Public Member Functions | |
static VolumeObjectCellsGPU & | instance () |
returs the static instance More... | |
static void | RelaxGPU (VolumeObject *vo, Vector3D Center, float R, float Degree, int sign) |
particular implementation of the voxel relax More... | |
static void | TrajectoryOverGPU (VolumeObject *vo, cList< TrElement > &Trajectory, float sign, const char *shader) |
Perfor the shader action over the trajectory. More... | |
static void | GrowGPU (VolumeObject *vo, cList< TrElement > &Trajectory, float sign) |
The grow pen implementation. More... | |
static void | ApplySymmetry (VolumeObject *vo, PointsStory &inLocal, cList< TrElement > &out) |
Prepare the PointsStory to pass into the TrajectoryOverGPU. More... | |
the class used to perform GPU calculations over voxels
void scalc::VolumeObjectCellsGPU::AddCells | ( | PassedCells & | cache, |
const char * | preffix, | ||
VolumeObject * | vo, | ||
cList< std::pair< tri_DWORD, VolumeCell * >> & | cells, | ||
bool | CopyValues, | ||
bool | CreateBackIndex | ||
) |
Pass cells as input or output of the shader.
cache | the cache object reference, it may be used later to retreive results |
preffix | the preffix used for samplers and variabled related to this cells pass |
vo | VolumeObject reference |
cells | list of cells |
CopyValues | this is true for input cells, false for output |
CreateBackIndex | create inr=dec for output cells used to retreive result |
References scalc::ShaderCalc::Assign(), scalc::ShaderCalc::Output(), scalc::ShaderCalc::toGpu(), and VolumeCell::Values.
Referenced by TrajectoryOverGPU().
|
inherited |
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 PassAlpha().
|
static |
Prepare the PointsStory to pass into the TrajectoryOverGPU.
vo | VolumeObject reference |
inLocal | trajectory in local space (input) |
out | trajectory in local space (outpu) - pass it into TrajectoryOverGPU or any derived routine |
References VolumeObject::Transform, and VolumeObject::TransformInv.
|
inherited |
pass the variable into the shader
id | the uniform variable name to refer in shader |
value | the value to pass |
Referenced by AddCells(), PassTrajectory(), and TrajectoryOverGPU().
|
inherited |
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 Operate().
void scalc::VolumeObjectCellsGPU::BackToCells | ( | PassedCells & | cells | ) |
put the calculation results back into cells
cells | the cache object initialised previously with the AddCells |
References scalc::ShaderCalc::fromGpu(), scalc::ShaderCalc::ReturnTexturesToCommonPool(), and VolumeCell::Values.
Referenced by RelaxGPU(), and TrajectoryOverGPU().
|
inherited |
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 Operate().
|
inherited |
return all used textures to the pool for the further usage, clear textures array
References scalc::TexPool::returnToPool().
|
inherited |
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 BackToCells().
|
static |
The grow pen implementation.
vo | VolumeObject reference |
Trajectory | the trajectory |
sign | -1 or +1 |
References TrajectoryOverGPU().
|
static |
returs the static instance
Referenced by RelaxGPU(), and TrajectoryOverGPU().
void scalc::VolumeObjectCellsGPU::Operate | ( | const char * | ShaderName, |
const char * | OutputPreffix | ||
) |
Run the shaders calculations.
ShaderName | the shader name to execute |
OutputPreffix | preffix used previously for the output cells |
References scalc::ShaderCalc::AssignShader(), and scalc::ShaderCalc::Execute().
Referenced by RelaxGPU(), and TrajectoryOverGPU().
|
inherited |
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 AddCells().
void scalc::VolumeObjectCellsGPU::PassAlpha | ( | const char * | name, |
AlphaShapeRef & | Ref | ||
) |
pass the alpha reference to be used in shader
name | the name of sampler to refer in shader |
Ref | the alpha reference |
References scalc::ShaderCalc::AddSampler().
Referenced by TrajectoryOverGPU().
void scalc::VolumeObjectCellsGPU::PassTrajectory | ( | cList< TrElement > & | Trajectory | ) |
pass the trajectory into the shader (in local space)
Trajectory |
References scalc::ShaderCalc::Assign(), and scalc::ShaderCalc::toGpu().
Referenced by TrajectoryOverGPU().
|
static |
particular implementation of the voxel relax
vo | VolumeObject reference |
Center | the center of the relax sphere in local space |
R | radius in local space |
Degree | degree of relaxing |
References BackToCells(), instance(), and Operate().
|
inherited |
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 BackToCells().
|
inherited |
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 AddCells(), and PassTrajectory().
|
static |
Perfor the shader action over the trajectory.
vo | VolumeObject reference |
Trajectory | the trajectory |
sign | -1 or +1 |
shader | the shader name |
References AddCells(), scalc::ShaderCalc::Assign(), BackToCells(), instance(), VolumeCell::Locked, Operate(), PassAlpha(), PassTrajectory(), and VolumeCell::Values.
Referenced by GrowGPU().