Shader< ShaderParameters, ShaderHelper, VERSION > Class
Template Reference
#include
<adskShader.h>
List of all members.
Detailed Description
template<typename ShaderParameters, typename ShaderHelper,
int VERSION = 1>
class Shader< ShaderParameters, ShaderHelper, VERSION >
The base shader class.
This class is the base shader class from which most of the Maya
shaders are derived.
- Template Parameters:
-
|
ShaderParameters |
The shader parameter structure. |
|
ShaderHelper |
The shader helper to use with this shader. |
|
VERSION |
The version of this shader. Should match the version of the
shader declared in the .mi file. |
|
Public Member Functions
|
|
Shader
(miState *pState, ShaderParameters *pParameters) |
|
Shader constructor. This will be
called once per shader instance, and is where data for each shader
instance should be initialized.
|
virtual |
~Shader
() |
|
Shader destructor.
|
miBoolean |
operator()
(miColor *pResult, miState *pState, ShaderParameters
*pParameters) |
|
Main shading function.
|
Static Public Member Functions
|
static void |
init
(miState *pState, ShaderParameters *pParameters) |
|
The shader initialization function.
|
static int |
version
() |
|
Function returning the current version of
the shader.
|
static void |
exit
(miState *pState, ShaderParameters *pParameters) |
|
The shader exit function.
|
Public Attributes
|
miState * |
mDestructorState |
ShaderParameters * |
mDestructorParameters |
Constructor & Destructor Documentation
template<typename ShaderParameters,
typename ShaderHelper, int VERSION>
Shader constructor. This will be
called once per shader instance, and is where data for each shader
instance should be initialized.
- Parameters:
-
[in,out] |
pState |
A pointer to the mental ray state structure. |
[in] |
pParameters |
A pointer to the shader parameters. |
template<typename ShaderParameters,
typename ShaderHelper, int VERSION>
Shader destructor.
The member variables mDestructorState
and
mDestructorParameters
will be set correctly when the
destructor is called.
Member Function Documentation
template<typename ShaderParameters,
typename ShaderHelper, int VERSION>
void Shader< ShaderParameters, ShaderHelper, VERSION
>::init |
( |
miState * |
pState, |
|
|
ShaderParameters * |
pParameters |
|
|
) |
|
|
[inline, static] |
The shader initialization function.
This function is called once at the begining of the rendering
loop. This is where shaders should initialize and pre-compute data
common to all instances of the shader.
- Parameters:
-
[in,out] |
pState |
A pointer to the mental ray state structure. |
[in] |
pParameters |
A pointer to the shader parameters. |
template<typename ShaderParameters,
typename ShaderHelper, int VERSION>
void Shader< ShaderParameters, ShaderHelper, VERSION
>::exit |
( |
miState * |
pState, |
|
|
ShaderParameters * |
pParameters |
|
|
) |
|
|
[inline, static] |
The shader exit function.
This function is called once after all calls to the shader have
completed. This is where shaders should release any dynamically
allocated resources.
- Parameters:
-
[in,out] |
pState |
A pointer to the mental ray state structure. |
[in] |
pParameters |
A pointer to the shader parameters. |
template<typename ShaderParameters,
typename ShaderHelper, int VERSION>
miBoolean Shader< ShaderParameters, ShaderHelper, VERSION
>::operator() |
( |
miColor * |
pResult, |
|
|
miState * |
pState, |
|
|
ShaderParameters * |
pParameters |
|
|
) |
|
|
[inline] |
Member Data Documentation
template<typename ShaderParameters,
typename ShaderHelper, int VERSION = 1>
Pointer to the mental ray state structure. This is only
guaranteed to be valid during a call to the destructor.
- Note:
- Some of the macros provided by mental images assume that the
state variable is called
state
so it may be necessary
to create a reference to this variable using that name for proper
functionality, that is:
template<typename ShaderParameters,
typename ShaderHelper, int VERSION = 1>
Pointer to the mental ray shader parameters. This is only
guaranteed to be valid during a call to the destructor.