class RED::RenderShaderSolid
No lighting shader. A simple color / texture is applied to an object. More...
#include <REDRenderShaderSolid.h>
Inherits: RenderShader.
Public functions:
RenderShaderSolid ( RED::MATERIAL_PASS iRenderPass, const RED::Color & iObjectColor, const RED::Object * iObjectTexture, const RED::Matrix & iObjectTextureMatrix, RED::MESH_CHANNEL iObjectUV, const RED::Color & iOpacityColor, const RED::Object * iOpacityTexture, const RED::Matrix & iOpacityTextureMatrix, RED::MESH_CHANNEL iOpacityUV, RED::Object * iResMgr, RED_RC & oErrorCode ) | |
virtual | ~RenderShaderSolid ( ) |
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_RC | EvaluateFromInputParameters ( RED::RenderShader * ioShader, RED::Object * iResMgr ) |
static RED::CID | GetClassID ( ) |
static RED_RC | LoadProgram ( RED::String & oString, const RED::ShaderProgramID & iID ) |
Detailed description:
No lighting shader. A simple color / texture is applied to an object.
This shader assigns either a color or a texture map to an object. The color or texture is the product of the object color / texture multiplied by its transparency color / texture. The output alpha value is equal to the transparency color / texture alpha value.
This shader uses the following geometrical channels:
- RED::MCL_VERTEX: vertex array of the rendered meshes.
- RED::MCL_TEX0: (optional) texture coordinates of the rendered meshes.
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.
The RenderShaderSolid can be used in a direct or indirect lighting configuration. This is selected at the shader's creation time. A direct shader goes to the RED::MTL_PRELIT pass of the material, whereas an indirect shader goes to its RED::MTL_INDIRECT_PRELIT pass. Note that post-lighting passes may also be targeted.
This shader creates two platform configurations in direct lighting:
It also creates two platform configurations in indirect lighting:
See the REDRenderShaderSolid.h file documentation for the list of all define statements used to name all parameters of this shader.
Functions documentation
public RED::RenderShaderSolid::RenderShaderSolid | ( | RED::MATERIAL_PASS | iRenderPass, |
const RED::Color & | iObjectColor, | ||
const RED::Object * | iObjectTexture, | ||
const RED::Matrix & | iObjectTextureMatrix, | ||
RED::MESH_CHANNEL | iObjectUV, | ||
const RED::Color & | iOpacityColor, | ||
const RED::Object * | iOpacityTexture, | ||
const RED::Matrix & | iOpacityTextureMatrix, | ||
RED::MESH_CHANNEL | iOpacityUV, | ||
RED::Object * | iResMgr, | ||
RED_RC & | oErrorCode | ||
) |
Constructor.
Sets the lighting to a per pixel constant, either set to a color or to a texture.
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.
Parameters:
iRenderPass: | Any direct or indirect pre-lighting or post-lighting pass. |
iObjectColor: | Solid color to use. |
iObjectTexture: | Solid texture image. Overrides the solid color when set. |
iObjectTextureMatrix: | Texture transformation matrix. |
iObjectUV: | UV channel to use for the texture mapping. |
iOpacityColor: | Opacity color to use. |
iOpacityTexture: | Opacity texture image. Overrides the transparency color when set. |
iOpacityTextureMatrix: | Opacity texture transformation matrix. |
iOpacityUV: | Opacity texture UV channel. |
iResMgr: | The cluster's resource manager. |
oErrorCode: | Indicates a construction failure when not returned set to RED_OK. |
public virtual RED::RenderShaderSolid::~RenderShaderSolid | ( | ) |
Destructor.
public static RED_RC RED::RenderShaderSolid::EvaluateFromInputParameters | ( | RED::RenderShader * | ioShader, |
RED::Object * | iResMgr | ||
) |
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_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.
public static RED::CID RED::RenderShaderSolid::GetClassID | ( | ) |
Reimplements: RED::RenderShader::GetClassID.
public static RED_RC RED::RenderShaderSolid::LoadProgram | ( | RED::String & | oString, |
const RED::ShaderProgramID & | iID | ||
) |
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_ALLOC_FAILURE if an allocation has failed,
RED_FAIL otherwise.
public virtual void * RED::RenderShaderSolid::As | ( | const RED::CID & | iCID | ) |
Converts the object to an instance of the given type.
Parameters:
iCID: | Requested class. |
Returns:
Reimplements: RED::RenderShader::As.
public virtual const void * RED::RenderShaderSolid::As | ( | const RED::CID & | iCID | ) const |
Converts the object to an instance of the given type.
Parameters:
iCID: | Requested class. |
Returns:
Reimplements: RED::RenderShader::As.
template< class T_As > public const T_As * RED::RenderShaderSolid::As | ( | ) const |
Template version of the as const method.
Simply set T to be the class you want to retrieve an interface to.
Returns:
Reimplements: RED::RenderShader::As.
template< class T_As > public T_As * RED::RenderShaderSolid::As | ( | ) |
Template version of the as method.
Simply set T to be the class you want to retrieve an interface to.
Returns:
Reimplements: RED::RenderShader::As.