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.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
scalc::VolumeObjectCellsGPU Class Reference

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 VolumeObjectCellsGPUinstance ()
 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...
 

Detailed Description

the class used to perform GPU calculations over voxels

+ Inheritance diagram for scalc::VolumeObjectCellsGPU:

Member Function Documentation

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.

Parameters
cachethe cache object reference, it may be used later to retreive results
preffixthe preffix used for samplers and variabled related to this cells pass
voVolumeObject reference
cellslist of cells
CopyValuesthis is true for input cells, false for output
CreateBackIndexcreate 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().

void scalc::ShaderCalc::AddSampler ( const char *  name,
int  TextureID 
)
inherited

Add external texture to be used as the sampler in the shader calculations.

Parameters
nameThe name of the sampler to refer in the shader
TextureIDthe external texture ID

Referenced by PassAlpha().

void scalc::VolumeObjectCellsGPU::ApplySymmetry ( VolumeObject vo,
PointsStory &  inLocal,
cList< TrElement > &  out 
)
static

Prepare the PointsStory to pass into the TrajectoryOverGPU.

Parameters
voVolumeObject reference
inLocaltrajectory in local space (input)
outtrajectory in local space (outpu) - pass it into TrajectoryOverGPU or any derived routine

References VolumeObject::Transform, and VolumeObject::TransformInv.

void scalc::ShaderCalc::Assign ( const char *  id,
int  value 
)
inherited

pass the variable into the shader

Parameters
idthe uniform variable name to refer in shader
valuethe value to pass

Referenced by AddCells(), PassTrajectory(), and TrajectoryOverGPU().

void scalc::ShaderCalc::AssignShader ( const char *  name)
inherited

Assign the shader for the calculations. Don't call it often, it results in shader compiling.

Parameters
namethat path to file relative to the data/Shaders/

Referenced by Operate().

void scalc::VolumeObjectCellsGPU::BackToCells ( PassedCells cells)

put the calculation results back into cells

Parameters
cellsthe cache object initialised previously with the AddCells

References scalc::ShaderCalc::fromGpu(), scalc::ShaderCalc::ReturnTexturesToCommonPool(), and VolumeCell::Values.

Referenced by RelaxGPU(), and TrajectoryOverGPU().

void scalc::ShaderCalc::Execute ( const char *  OutputTextureName)
inherited

Execute the shader over the chosen render target.

Parameters
OutputTextureNamethe name of the output render targed, should be reserved preliminary withe the ReserveLinearOutputCapacity

Referenced by Operate().

void scalc::ShaderCalc::FreeTextures ( )
inherited

return all used textures to the pool for the further usage, clear textures array

References scalc::TexPool::returnToPool().

template<class Type >
void scalc::ShaderCalc::fromGpu ( const char *  name,
cList< Type > &  array 
)
inherited

retrieve the result of the calculation

Template Parameters
Typethe type of the array element
Parameters
namename of the render target
arraythe resulting array

Referenced by BackToCells().

void scalc::VolumeObjectCellsGPU::GrowGPU ( VolumeObject vo,
cList< TrElement > &  Trajectory,
float  sign 
)
static

The grow pen implementation.

Parameters
voVolumeObject reference
Trajectorythe trajectory
sign-1 or +1

References TrajectoryOverGPU().

VolumeObjectCellsGPU & scalc::VolumeObjectCellsGPU::instance ( )
static

returs the static instance

Referenced by RelaxGPU(), and TrajectoryOverGPU().

void scalc::VolumeObjectCellsGPU::Operate ( const char *  ShaderName,
const char *  OutputPreffix 
)

Run the shaders calculations.

Parameters
ShaderNamethe shader name to execute
OutputPreffixpreffix used previously for the output cells

References scalc::ShaderCalc::AssignShader(), and scalc::ShaderCalc::Execute().

Referenced by RelaxGPU(), and TrajectoryOverGPU().

ShaderCalc::texInfo * scalc::ShaderCalc::Output ( const char *  name,
cPtrDiff  AmountOfElements,
comms::cFormat::Enum  format 
)
inherited

Reserve the space for the output of the calculations.

Parameters
namethe name of the render target, it will be referred in the Execute
AmountOfElementsthe size of output array to be calculated
formatthe output texture format
Returns

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

Parameters
namethe name of sampler to refer in shader
Refthe 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)

Parameters
Trajectory

References scalc::ShaderCalc::Assign(), and scalc::ShaderCalc::toGpu().

Referenced by TrajectoryOverGPU().

void scalc::VolumeObjectCellsGPU::RelaxGPU ( VolumeObject vo,
Vector3D  Center,
float  R,
float  Degree,
int  sign 
)
static

particular implementation of the voxel relax

Parameters
voVolumeObject reference
Centerthe center of the relax sphere in local space
Rradius in local space
Degreedegree of relaxing

References BackToCells(), instance(), and Operate().

void scalc::ShaderCalc::ReturnTexturesToCommonPool ( )
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().

template<class Type >
void scalc::ShaderCalc::toGpu ( const char *  name,
cList< Type > &  array,
comms::cFormat::Enum  format 
)
inherited

Pass the input array for the calculations.

Template Parameters
Typethe array element type
Parameters
namename to be referred in the shader
arraythe array to pass into the shader
formatthe data format

Referenced by AddCells(), and PassTrajectory().

void scalc::VolumeObjectCellsGPU::TrajectoryOverGPU ( VolumeObject vo,
cList< TrElement > &  Trajectory,
float  sign,
const char *  shader 
)
static

Perfor the shader action over the trajectory.

Parameters
voVolumeObject reference
Trajectorythe trajectory
sign-1 or +1
shaderthe shader name

References AddCells(), scalc::ShaderCalc::Assign(), BackToCells(), instance(), VolumeCell::Locked, Operate(), PassAlpha(), PassTrajectory(), and VolumeCell::Values.

Referenced by GrowGPU().


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