Material< MaterialParameters, ShaderHelper, VERSION > Class Template Reference

#include <adskShader.h>
Inheritance diagram for Material< MaterialParameters, ShaderHelper, VERSION >:
Inheritance graph
[legend]
Collaboration diagram for Material< MaterialParameters, ShaderHelper, VERSION >:
Collaboration graph
[legend]

List of all members.


Detailed Description

template<typename MaterialParameters, typename ShaderHelper, int VERSION = 1>
class Material< MaterialParameters, ShaderHelper, VERSION >

Material shader class.

This class holds all data and behaviors which are specific to mental ray material shaders. It is an extension of the base class Shader.

Template Parameters:
MaterialParameters  The material 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

  Material (miState *pState, MaterialParameters *pParameters)
  Material shader constructor.
virtual  ~Material ()
  Material shader destructor.
miBoolean  operator() (miColor *pResult, miState *pState, MaterialParameters *pParameters)
  Main shading function.
template<typename T>
void  writeToFrameBuffers (miState *pState, FrameBufferInfo *pFrameBufferInfo, PassTypeInfo *pPassTypeInfo, const T &pValue, PassTypeID pPassType, const bool &pUseIrradiance, const miColor *const &pIrradianceNoShadow=0)
  Write to frame buffers of a given type.

Protected Attributes

miInteger  mFrameBufferWriteOperation
  Operation to be performed on frame buffers.
miInteger  mFrameBufferWriteFlags
  Flags affecting the frame buffer operation.
miScalar  mFrameBufferWriteFactor
  Scaling factor for contribution if scaling is enabled.

Constructor & Destructor Documentation

template<typename MaterialParameters, typename ShaderHelper, int VERSION>
Material< MaterialParameters, ShaderHelper, VERSION >::Material ( miState *  pState,
MaterialParameters *  pParameters  
) [inline]

Material 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 MaterialParameters, typename ShaderHelper, int VERSION>
Material< MaterialParameters, ShaderHelper, VERSION >::~Material (  )  [inline, virtual]

Material shader destructor.

The member variables mDestructorState and mDestructorParameters will be set correctly when the destructor is called.


Member Function Documentation

template<typename MaterialParameters, typename ShaderHelper, int VERSION>
miBoolean Material< MaterialParameters, ShaderHelper, VERSION >::operator() ( miColor *  pResult,
miState *  pState,
MaterialParameters *  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.

template<typename MaterialParameters, typename ShaderHelper, int VERSION>
template<typename T>
void Material< MaterialParameters, ShaderHelper, VERSION >::writeToFrameBuffers ( miState *  pState,
FrameBufferInfo pFrameBufferInfo,
PassTypeInfo pPassTypeInfo,
const T &  pValue,
PassTypeID  pPassType,
const bool &  pUseIrradiance,
const miColor *const &  pIrradianceNoShadow = 0  
) [inline]

Write to frame buffers of a given type.

Parameters:
[in,out]  pState  The shading state
[in,out]  pFrameBufferInfo  The array of frame buffer information structs
[in]  pPassTypeInfo  The array of pass type information structs
[in]  pValue  The value to be written to the frame buffer
[in]  pPassType  The pass type ID that identifies the frame buffer to be written to
[in]  pUseIrradiance  Set to true if the value should be modulated by irradiance. This option should only be used inside a light loop.
[in]  pIrradianceNoShadow  Sample irradiance without shadows, used to compute differential shadow passes. When non-null, the difference between pIrradianceNoShadow and the sample irradiance is used as a lighting factor, instead of the sample irradiance.

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