class RED::RenderShaderLogo
Decal display shader. More...
#include <REDRenderShaderLogo.h>
Inherits: RenderShader.
Public functions:
RenderShaderLogo ( RED::MATERIAL_PASS iRenderPass, const RED::Vector< RED::Object * > & iLogoImage, const RED::Vector< RED::Matrix > & iLogoUVMatrix, const RED::Vector< RED::MESH_CHANNEL > & iLogoUV, RED::Object * iResMgr, RED_RC & oErrorCode ) | |
virtual | ~RenderShaderLogo ( ) |
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:
Decal display shader.
This simple shader displays a list of decal textures on a geometry. Each texture's RGB color value is modulated by the texture's own alpha mask value, interpolated with the result of blending all previous logos. Consequently, the shader's lighting equation is:
// Example for 1 logo:
output.rgb = logo0.rgb * logo0.a;
output.a = logo0.a;
// Example for 2 logos:
output.rgb = ( logo0.rgb * logo0.a ) * ( 1 - logo1.a ) + logo1.rgb * logo1.a;
output.a = saturate( logo0.a + logo1.a );
// Example for 3 logos:
output.rgb = ( ( logo0.rgb * logo0.a ) * ( 1 - logo1.a ) + logo1.rgb * logo1.a ) * ( 1 - logo2.a ) + logo2.rgb * logo2.a...;
output.a = saturate( logo0.a + logo1.a + logo2.a );
// Example for N logos:
output.rgb = outputN-1.rgb * ( 1 - logoN.a ) + logoN.rgb * logoN.a;
output.a = saturate( outputN-1.a + logoN.a );
Color and alpha saturation may apply based on the output rendering buffer's format.
This shader uses the following geometrical channels:
- RED::MCL_VERTEX: Vertex array of the rendered meshes.
- RED::MCL_TEX0-7: Texture coordinates of the rendered meshes.
The RenderShaderLogo 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.
This shader creates two platform configurations in direct lighting:
It also creates two platform configurations in indirect lighting:
See the REDRenderShaderLogo.h file documentation for the list of all define statements used to name all parameters of this shader.
Functions documentation
public RED::RenderShaderLogo::RenderShaderLogo | ( | RED::MATERIAL_PASS | iRenderPass, |
const RED::Vector< RED::Object * > & | iLogoImage, | ||
const RED::Vector< RED::Matrix > & | iLogoUVMatrix, | ||
const RED::Vector< RED::MESH_CHANNEL > & | iLogoUV, | ||
RED::Object * | iResMgr, | ||
RED_RC & | oErrorCode | ||
) |
Constructor.
All textures used by this method can either be 2D images using the RED::TGT_TEX_2D target or composite images. The iLogoUVMatrix and iLogoUV parameters are ignored for a composite image.
The maximal number of logos images that can be managed by the shader is 7.
Parameters:
iRenderPass: | RED::MTL_PRELIT or RED::MTL_INDIRECT_PRELIT. |
iLogoImage: | List of logo images. |
iLogoUVMatrix: | List of logo UV transformation matrices. |
iLogoUV: | List of UV channels to use for each logo. |
iResMgr: | The cluster's resource manager. |
oErrorCode: | Indicates a construction failure when not returned set to RED_OK. |
public virtual RED::RenderShaderLogo::~RenderShaderLogo | ( | ) |
Destructor.
public static RED_RC RED::RenderShaderLogo::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::RenderShaderLogo::GetClassID | ( | ) |
Reimplements: RED::RenderShader::GetClassID.
public static RED_RC RED::RenderShaderLogo::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::RenderShaderLogo::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::RenderShaderLogo::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::RenderShaderLogo::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::RenderShaderLogo::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.