NAME
-
vzTMShader - A general purpose shader to be used with the vzTMRenderAction.
INHERITS FROM
-
vzShader
HEADER FILE
-
#include <Volumizer2/TMShader.h>
PUBLIC METHOD SUMMARY
| void getShapeCallbacks ( |
vzTMShaderCB& preCB, vzTMShaderCB& postCB, void*& userData); |
PROTECTED METHOD SUMMARY
CLASS DESCRIPTION
-
The vzTMShader class provides a general purpose multi-pass shader which
allows applications to apply arbitrary shading to shapes being rendered
using the vzTMRenderAction. The vzTMRenderAction can be used to bind the
appropriate resources that it manages for the application. This can be
done using the following callback -
typedef bool (*vzTMBindParameterCB)(const char *name, vzTMShaderData *shaderData, vzTMShaderOp operation = VZ_TM_BIND);
-
The above callbacks are used to bind the volume texture and the lookup table
(given by the respective parameter names). The callbacks can also be used to
simply enable or disable the OpenGL state for the parameters managed by the
TMRenderAction, i.e. volume textures and lookup tables.
METHOD DESCRIPTIONS
vzTMShader()
-
Constructor.
~vzTMShader()
-
Destructor.
getShapeCallbacks()
| void getShapeCallbacks ( |
vzTMShaderCB& preCB, vzTMShaderCB& postCB, void*& userData); |
-
Get the pre and post shape callbacks.
getSliceCallbacks()
| void getSliceCallbacks ( |
int& numCB, vzTMShaderCB*& callbacks, void*& userData); |
-
Get the per-slice callbacks.
setShapeCallbacks()
| void setShapeCallbacks ( |
vzTMShaderCB preCB, vzTMShaderCB postCB, void* userData); |
-
Sets the callbacks invoked for each shape before and after the shape is
rendered.The callbacks are defined as -
typedef void (*vzTMShaderCB)(vzTMShaderData *shaderData);
-
-
For example -
void preShape(vzTMShaderData *shaderData) {
// Enable volume texture parameter
shaderData->bindVolumeTextureCB("volume", shaderData, VZ_TM_ENABLE);
// Bind the "volume" texture
if(!shaderData->bindVolumeTextureCB("volume", shaderData, VZ_TM_BIND))
vzError::error(VZ_OPERATION_FAILED,"Could not bind volume texture 'volume'");
}
void postShape(vzTMShaderData *shaderData) {
// Disable the volume texture
shaderData->bindVolumeTextureCB("volume", shaderData, VZ_TM_DISABLE);
}
-
setSliceCallbacks()
| void setSliceCallbacks ( |
int numCB, vzTMShaderCB* callbacks, void* userData); |
-
Sets the pass description for the vzTMShader. The default number of callbacks
is 0. The callbacks are defined as -
typedef void (*vzTMShaderCB)(vzTMShaderData *shaderData);
-
-
For example -
void pass1(vzTMShaderData *shaderData) {
if(!shaderData->bindVolumeTextureCB("volume", shaderData))
vzError::error(VZ_OPERATION_FAILED,"Could not bind volume texture 'volume'");
}
void pass2(vzTMShaderData *shaderData) {
if(!shaderData->bindVolumeTextureCB("volume2", shaderData))
vzError::error(VZ_OPERATION_FAILED,"Could not bind volume texture 'volume2'");
}
-
SEE ALSO
-
vzShader