Shader< ShaderParameters, ShaderHelper, VERSION > Class Template Reference

#include <adskShader.h>
Inheritance diagram for Shader< ShaderParameters, ShaderHelper, VERSION >:
Inheritance graph
[legend]

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< ShaderParameters, ShaderHelper, VERSION >::Shader ( miState *  pState,
ShaderParameters *  pParameters  
) [inline]

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< ShaderParameters, ShaderHelper, VERSION >::~Shader (  )  [inline, virtual]

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]

Main shading function.

This is the function which is called for shader samples.

Parameters:
[out]  pResult  A pointer to the mental ray color result.
[in,out]  pState  A pointer to the mental ray state structure.
[in]  pParameters  A pointer to the shader parameters.
Returns:
True if the shader call was successful, false otherwise.

Reimplemented in PassShader< FrameBufferDataType, PassShaderParameters, PassComputation, RayFilter, VERSION >, and Material< SurfaceParameters, ShaderHelper< ShaderParameters >, VERSION >.


Member Data Documentation

template<typename ShaderParameters, typename ShaderHelper, int VERSION = 1>
miState* Shader< ShaderParameters, ShaderHelper, VERSION >::mDestructorState

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:
      miState * const &state = mDestructorState;

template<typename ShaderParameters, typename ShaderHelper, int VERSION = 1>
ShaderParameters* Shader< ShaderParameters, ShaderHelper, VERSION >::mDestructorParameters

Pointer to the mental ray shader parameters. This is only guaranteed to be valid during a call to the destructor.


Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6