ShaderHelper< ShaderParameters > Class Template Reference

#include <adskShader.h>

List of all members.


Detailed Description

template<typename ShaderParameters>
class ShaderHelper< ShaderParameters >

Shader helper class.

This class has several methods which can be used to override the default shading behaviour.

Template Parameters:
ShaderParameters  The shader parameter structure.

Public Member Functions

  ShaderHelper (miState *pState, ShaderParameters *pParameters)
  Constructor for shader helper.
  ~ShaderHelper ()
  Deconstructor for shader helper.
void  setupMayaBumpMapping () const
  Adjust normal for Maya's bump mapping.
miBoolean  computeHideSource () const
  Determine if source should be hidden.
void  computeTransparencyForShadow (miColor &pResTransp, miBoolean pHideSource) const
  Computes transparency for shadow rays.
void  evaluateParameters ()
  Evaluates shader parameters necessary for later computations.
miColor  computeTransparency () const
  Computes transparency parameters for non-shadow rays.
miScalar  computeSpecularGlow () const
  Computes the specular glow parameters for the shader.
void  setASQWeight (MayabaseState *&MBS, BRDFComponent &bc, const miColor &pColor, const miColor &pTransparency, miScalar &pGlowIntensity) const
  Set the ASQ weight for this shader call.
miColor  computeAmbientResult (const miColor &pAmbientColor, const miColor &pColor) const
  Computes the ambient result color.
miScalar  computeTranslucence (miScalar pDotNL, miVector &pLightDirection, miScalar pTranslucence, miScalar pTranslucenceFocus, miScalar pTranslucenceDepth, void *pLightBlindData) const
  Computes the translucence result for the shader.
float  computeDiffuseAreaLightFactor (miVector &pBumpNormal, void *pLightBlindData) const
  Computes the diffuse factor for area lights.
float  computeSpecularAreaLightFactor (miVector &pBumpNormal, void *pLightBlindData) const
  Computes the specular factor for area lights.
miColor  getReflectedColor () const
  Return the reflected color for this shader.

Constructor & Destructor Documentation

template<typename ShaderParameters>
ShaderHelper< ShaderParameters >::ShaderHelper ( miState *  pState,
ShaderParameters *  pParameters  
) [inline]

Constructor for shader helper.

This will be called once per evaluation of the main shading function for 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>
ShaderHelper< ShaderParameters >::~ShaderHelper (  )  [inline]

Deconstructor for shader helper.

This will be called once per evaluation of the main shading function for the shader.


Member Function Documentation

template<typename ShaderParameters>
void ShaderHelper< ShaderParameters >::setupMayaBumpMapping (  )  const [inline]

Adjust normal for Maya's bump mapping.

This function adjusts state->normal to account for bump mapping. Override it to change how bump mapping works.

template<typename ShaderParameters>
miBoolean ShaderHelper< ShaderParameters >::computeHideSource (  )  const [inline]

Determine if source should be hidden.

Most Maya shaders define the hideSource attribute to determine if the source geometry should be hidden (often used with glow). Override this to tell the main shading function whether or not the source should be hidden.

Returns:
True if source should be hidden, false otherwise.

template<typename ShaderParameters>
void ShaderHelper< ShaderParameters >::computeTransparencyForShadow ( miColor &  pResTransp,
miBoolean  pHideSource  
) const [inline]

Computes transparency for shadow rays.

This function computes the transparency of the shader when hit by a shadow ray.

Parameters:
[out]  pResTransp  The resulting transparency.
[in]  pHideSource  True if the source is hidden.

template<typename ShaderParameters>
void ShaderHelper< ShaderParameters >::evaluateParameters (  )  [inline]

Evaluates shader parameters necessary for later computations.

This function is called after other initialization to give the helper a chance to evaluate any parameters necessary for later computations.

template<typename ShaderParameters>
miColor ShaderHelper< ShaderParameters >::computeTransparency (  )  const [inline]

Computes transparency parameters for non-shadow rays.

This function is called to evaluate the transparency parameters for the shader on non-shadow rays.

Returns:
The transparency color for use in later computations.

template<typename ShaderParameters>
miScalar ShaderHelper< ShaderParameters >::computeSpecularGlow (  )  const [inline]

Computes the specular glow parameters for the shader.

This function is called to evaluate any specular glow parameters to the shader for use in later computations.

Returns:
The amount of specular glow.

template<typename ShaderParameters>
void ShaderHelper< ShaderParameters >::setASQWeight ( MayabaseState *&  MBS,
BRDFComponent &  bc,
const miColor &  pColor,
const miColor &  pTransparency,
miScalar &  pGlowIntensity  
) const [inline]

Set the ASQ weight for this shader call.

This function adjusts the ASQ weight according to the light loop's impact on the final shader result.

Parameters:
[in,out]  MBS  The current Maya state.
[in]  bc  BRDF component information.
[in]  pColor  The diffuse color for the shader.
[in]  pTransparency  The transparency for the shader.
[in]  pGlowIntensity  The glow intensity for the shader.

template<typename ShaderParameters>
miColor ShaderHelper< ShaderParameters >::computeAmbientResult ( const miColor &  pAmbientColor,
const miColor &  pColor  
) const [inline]

Computes the ambient result color.

This function computes the color returned in the ambient channel of the shader result structure.

Parameters:
[in]  pAmbientColor  The ambient color of the material.
[in]  pColor  The diffuse color of the material.
Returns:
The ambient result.

template<typename ShaderParameters>
miScalar ShaderHelper< ShaderParameters >::computeTranslucence ( miScalar  pDotNL,
miVector &  pLightDirection,
miScalar  pTranslucence,
miScalar  pTranslucenceFocus,
miScalar  pTranslucenceDepth,
void *  pLightBlindData  
) const [inline]

Computes the translucence result for the shader.

This function computes the translucence result for the shader given various parameters. This result is combined with the diffuse component to produce the diffuse result.

Parameters:
[in]  pDotNL  The dot product between the light vector and the normal.
[in]  pLightDirection  The light vector.
[in]  pTranslucence  The amount of translucence for the material.
[in]  pTranslucenceFocus  The translucence focus for the material.
[in]  pTranslucenceDepth  The translucence depth for the material.
[in]  pLightBlindData  Custom light shader data.
Returns:
The translucence result for the shader.

template<typename ShaderParameters>
float ShaderHelper< ShaderParameters >::computeDiffuseAreaLightFactor ( miVector &  pBumpNormal,
void *  pLightBlindData  
) const [inline]

Computes the diffuse factor for area lights.

This function computes the diffuse factor for area lights.

Parameters:
[in]  pBumpNormal  The normal after bump adjustments.
[in]  pLightBlindData  Custom light shader data.
Returns:
The diffuse factor for area lights.

template<typename ShaderParameters>
float ShaderHelper< ShaderParameters >::computeSpecularAreaLightFactor ( miVector &  pBumpNormal,
void *  pLightBlindData  
) const [inline]

Computes the specular factor for area lights.

This function computes the specular factor for area lights.

Parameters:
[in]  pBumpNormal  The normal after bump adjustments.
[in]  pLightBlindData  Custom light shader data.
Returns:
The specular factor for area lights.

template<typename ShaderParameters>
miColor ShaderHelper< ShaderParameters >::getReflectedColor (  )  const [inline]

Return the reflected color for this shader.

Return the reflected color for this shader.

Returns:
The reflected color for this shader.

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