LambertianShaderHelper< ShaderParameters > Class Template Reference

#include <adskShader.h>

Inheritance diagram for LambertianShaderHelper< ShaderParameters >:

Inheritance graph
[legend]

List of all members.


Detailed Description

template<typename ShaderParameters>
class LambertianShaderHelper< ShaderParameters >

Lambertian shader helper class.

This class implements the same set of methods as the base ShaderHelper class for use with Lambertian materials.

Template Parameters:
ShaderParameters The shader parameter structure.

Public Member Functions

 LambertianShaderHelper (miState *pState, ShaderParameters *pParameters)
 Constructor for lambertian shader helper.
 ~LambertianShaderHelper ()
 Deconstructor for lambertian shader helper.
void setupMayaBumpMapping ()
 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.

Public Attributes

miState * state
ShaderParameters * params

Constructor & Destructor Documentation

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

Constructor for lambertian shader helper.

This will be called once per evaluation of the main shading function for the shader. This stores the state and the parameters for use in various functions.

Parameters:
[in,out] pState A pointer to the mental ray state structure.
[in] pParameters A pointer to the shader parameters.

template<typename ShaderParameters>
LambertianShaderHelper< ShaderParameters >::~LambertianShaderHelper (  )  [inline]

Deconstructor for lambertian shader helper.

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


Member Function Documentation

template<typename ShaderParameters>
void LambertianShaderHelper< ShaderParameters >::setupMayaBumpMapping (  )  [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 LambertianShaderHelper< 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 LambertianShaderHelper< 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 LambertianShaderHelper< 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.

Reimplemented in SpecularShaderHelper< ShaderParameters >.

template<typename ShaderParameters>
miColor LambertianShaderHelper< 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 LambertianShaderHelper< 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 LambertianShaderHelper< 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.

Reimplemented in SpecularShaderHelper< ShaderParameters >.

template<typename ShaderParameters>
miColor LambertianShaderHelper< 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 LambertianShaderHelper< 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 LambertianShaderHelper< 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 LambertianShaderHelper< 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 LambertianShaderHelper< 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.

Reimplemented in SpecularShaderHelper< ShaderParameters >.


Member Data Documentation

template<typename ShaderParameters>
miState* LambertianShaderHelper< ShaderParameters >::state

Pointer to the current mental ray state for this shader invocation.

template<typename ShaderParameters>
ShaderParameters* LambertianShaderHelper< ShaderParameters >::params

Pointer to the shader parameters for this shader invocation.


Autodesk® Maya® 2012 © 2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6