class RED::RenderShaderAnisotropic

Anisotropic lighting shader. Implements a Ward based anisotropic lighting equation. More...

#include <REDRenderShaderAnisotropic.h>

Inherits: RenderShader.

Public functions:

RenderShaderAnisotropic ( RED::MATERIAL_PASS iTargetPass, const RED::Color & iDiffuseColor, const RED::Object * iDiffuseTexture, const RED::Matrix & iDiffuseMatrix, RED::MESH_CHANNEL iDiffuseUV, const RED::Color & iSpecularColor, const RED::Object * iSpecularTexture, const RED::Matrix & iSpecularMatrix, RED::MESH_CHANNEL iSpecularUV, float iSpecExp, const RED::Object * iSpecExpTexture, const RED::Matrix & iSpecExpMatrix, RED::MESH_CHANNEL iSpecExpUV, float iSpecExpRange, const RED::Object * iNormalMap, const RED::Matrix & iNormalMatrix, RED::MESH_CHANNEL iNormalUV, RED::MESH_CHANNEL iTangentChannel, float iOrientation, const RED::Object * iOrientationTexture, const RED::Matrix & iOrientationMatrix, RED::MESH_CHANNEL iOrientationUV, float iAnisotropy, const RED::Object * iAnisotropyTexture, const RED::Matrix & iAnisotropyMatrix, RED::MESH_CHANNEL iAnisotropyUV, const RED::Color & iTransparColor, const RED::Object * iTransparTexture, const RED::Matrix & iTransparMatrix, RED::MESH_CHANNEL iTransparUV, RED::Object * iResourceManager, RED_RC & oRC )
virtual ~RenderShaderAnisotropic ( )
virtual void *As ( const RED::CID & iCID )
virtual const void *As ( const RED::CID & iCID ) const
template< class T_As > const T_As *As ( ) const
template< class T_As > T_As *As ( )

Public static functions:

static RED_RCEvaluateFromInputParameters ( RED::RenderShader * ioShader, RED::Object * iResMgr )
static RED::CIDGetClassID ( )
static RED_RCLoadProgram ( RED::String & oString, const RED::ShaderProgramID & iID )

Detailed description:

Anisotropic lighting shader. Implements a Ward based anisotropic lighting equation.

This shader produces an anisotropic lighting. Anisotropy is defined by two sets of data: an orientation parameter and an anisotropy parameter that'll define the look of the specular highlights produced by this shader.

The shader is set to be used with the RED::MTL_LIT or with the RED::MTL_INDIRECT_LIT pass of the material.

Parameters used by the shader are:

Each texture is associated to its own texture matrix and uv channel. Matrices are duplicated internally, whereas images are simply pointed to.

UVs must be specified if a texture is to be used by the shader. This shader supports RED::TGT_TEX_2D textures, that must be sampled with normalized UVs, composite textures, that are sampled at the shaded fragment position, or RED::TGT_TEX_RECT textures that are sampled using denormalized UVs.

This shader uses the following geometrical channels:

See the REDRenderShaderAnisotropic.h file documentation for the list of all define statements used to name all parameters of this shader.

This shader creates two platform configurations in direct lighting:

It also creates two platform configurations in indirect lighting:

Functions documentation

public RED::RenderShaderAnisotropic::RenderShaderAnisotropic(RED::MATERIAL_PASSiTargetPass,
const RED::Color &iDiffuseColor,
const RED::Object *iDiffuseTexture,
const RED::Matrix &iDiffuseMatrix,
RED::MESH_CHANNELiDiffuseUV,
const RED::Color &iSpecularColor,
const RED::Object *iSpecularTexture,
const RED::Matrix &iSpecularMatrix,
RED::MESH_CHANNELiSpecularUV,
floatiSpecExp,
const RED::Object *iSpecExpTexture,
const RED::Matrix &iSpecExpMatrix,
RED::MESH_CHANNELiSpecExpUV,
floatiSpecExpRange,
const RED::Object *iNormalMap,
const RED::Matrix &iNormalMatrix,
RED::MESH_CHANNELiNormalUV,
RED::MESH_CHANNELiTangentChannel,
floatiOrientation,
const RED::Object *iOrientationTexture,
const RED::Matrix &iOrientationMatrix,
RED::MESH_CHANNELiOrientationUV,
floatiAnisotropy,
const RED::Object *iAnisotropyTexture,
const RED::Matrix &iAnisotropyMatrix,
RED::MESH_CHANNELiAnisotropyUV,
const RED::Color &iTransparColor,
const RED::Object *iTransparTexture,
const RED::Matrix &iTransparMatrix,
RED::MESH_CHANNELiTransparUV,
RED::Object *iResourceManager,
RED_RC &oRC
)

Constructor.

All textures used by this method may either be 2D images using the RED::TGT_TEX_2D target or composite images or rectangular images using the RED::TGT_TEX_RECT target. Sampling UVs that are needed to sample 2D textures must be normalized. Sampling UVs that are needed to sample rectangular textures are denormalized with values directly sampling texels coordinates.

All specified UV channels must be in the RED::MCL_TEX0 - RED::MCL_TEX7 range, otherwise the method will return RED_BAD_PARAM.

Parameters:

iTargetPass:RED::MTL_LIT for a direct lighting shader, or RED::MTL_INDIRECT_LIT for an indirect lighting shader.
iDiffuseColor:The shader's diffuse color.
iDiffuseTexture:The shader's diffuse texture. Overrides the diffuse color when set.
iDiffuseMatrix:Texture matrix applied to the diffuse texture if a valid texture image is provided.
iDiffuseUV:Diffuse texture UV mesh channel.
iSpecularColor:The shader's specular color.
iSpecularTexture:The shader's specular texture. Overrides the specular color when set.
iSpecularMatrix:Texture matrix applied to the specular texture.
iSpecularUV:Specular texture UV mesh channel.
iSpecExp:Specular exponent value (this value ignores the 'iSpecExpRange' parameter used to rescale the specular exponent of a texture).
iSpecExpTexture:Specular exponent texture. Overrides the 'iSpecExp' when set. Only the red component of the texture is being used.
iSpecExpMatrix:Specular exponent texture transformation matrix.
iSpecExpUV:Specular exponent UV mesh channel.
iSpecExpRange:Specular exponent maximal range value.
iNormalMap:Normal map image.
iNormalMatrix:Texture matrix applied to the normal map if a normal map is provided.
iNormalUV:Normal map UV mesh channel.
iTangentChannel:Mesh channel containing vertex tangents.
iOrientation:Orientation used to compute the anisotropy local basis.
iOrientationTexture:Orientation texture image overrides the orientation value when set. Only the red component of the texture is being used.
iOrientationMatrix:Transformation matrix for the orientation texture image.
iOrientationUV:Orientation texture UV mesh channel.
iAnisotropy:Anisotropy value in [0.0f,1.0f]. Defines the stretching ratio applied to the specular's width.
iAnisotropyTexture:Anisotropy texture image overrides the anisotropy value when set. Only the red component of the texture is being used.
iAnisotropyMatrix:Transformation matrix for the anisotropy image.
iAnisotropyUV:Anisotropy UV mesh channel.
iTransparColor:The shader's transparency color.
iTransparTexture:Shader transparency texture. Overrides the color when set.
iTransparMatrix:Transparency texture matrix.
iTransparUV:Transparency UV channel.
iResourceManager:The cluster's resource manager.
oRC:Indicates a construction failure when not returned set to RED_OK.

Destructor.

Evaluate a shader from its input parameters.

Parameters:

ioShader:Shader to redefine using its own input parameters.
iResMgr:The cluster's resource manager.

Returns:

RED_OK if the operation has succeeded,
RED_BAD_PARAM if iShader was not valid,
RED_BAD_PARAM if an invalid parameter was found during the evaluation,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC related to shader creation can be returned.

Loads a shader program.

Generates a shader program that corresponds to the specified iID.

Parameters:

oString:The created program string.
iID:The shader program unique ID.

Returns:

RED_OK if the shader could be loaded,
RED_ALLOC_FAILURE if an allocation has failed,
RED_FAIL otherwise.
public virtual void * RED::RenderShaderAnisotropic::As(const RED::CID &iCID)

Converts the object to an instance of the given type.

Parameters:

iCID:Requested class.

Returns:

An object pointer of the given class on success, NULL otherwise.

Reimplements: RED::RenderShader::As.

public virtual const void * RED::RenderShaderAnisotropic::As(const RED::CID &iCID) const

Converts the object to an instance of the given type.

Parameters:

iCID:Requested class.

Returns:

An object pointer of the given class on success, NULL otherwise.

Reimplements: RED::RenderShader::As.

template< class T_As > public const T_As * RED::RenderShaderAnisotropic::As() const

Template version of the as const method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to a const instance of class T on success, NULL otherwise.

Reimplements: RED::RenderShader::As.

template< class T_As > public T_As * RED::RenderShaderAnisotropic::As()

Template version of the as method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to an instance of class T on success, NULL otherwise.

Reimplements: RED::RenderShader::As.