RenderShaderSolid
Functions
Detailed Description
-
class RenderShaderSolid : public RED::RenderShader
No lighting shader. A simple color / texture is applied to an object.
@related Using Built-in Render Shaders, class RED::IMaterial, class RED::RenderShader, class RED::StateShader, class RED::RenderCode
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.
Public Functions
-
SET_CID(CID_class_REDRenderShaderSolid)
-
IMPLEMENT_AS()
-
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.
-
virtual ~RenderShaderSolid()
Destructor.
Public Static Functions
-
static RED_RC 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_OK if the shader could be loaded,
RED_ALLOC_FAILURE if an allocation has failed,
RED_FAIL otherwise.
-
static RED_RC 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_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.