RenderShaderVertexColor

Functions

CID

GetClassID

RED_RC

LoadProgram

RED_RC

EvaluateFromInputParameters

void *

As

const void *

As

class T_As

As

class T_As

As

RenderShaderVertexColor

~RenderShaderVertexColor

Detailed Description

class RenderShaderVertexColor : public RED::RenderShader

Per-vertex interpolated color shader.

@related Using Built-in Render Shaders, class RED::IMaterial, class RED::RenderShader, class RED::StateShader, class RED::RenderCode

This shader can be used to produce per-vertex modulated illumination models. The shader uses the specified RED::MESH_CHANNEL input channel as colors defined for each vertex of the geometry. This color is used to produce a per-pixel color after interpolation over triangles of the geometry.

The RenderShaderVertexColor is usable in any pre-lighting of post-lighting pass of the material.

This shader creates one RED::HW_GENERIC platform configuration in direct lighting and two platform configurations RED::HW_NVIDIA_GENERIC and RED::HW_ATI_GENERIC in indirect lighting.

This shader only declares default ray-tracer parameters bindings in indirect lighting, using the RED_SHAD_TARGET_LIGHT_NO_LIGHT target.

Public Functions

virtual void *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.

virtual const void *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.

template<class T_As>
inline T_As *As()
template<class T_As>
inline const T_As *As() const
RenderShaderVertexColor(RED::MATERIAL_PASS iPass, RED::MESH_CHANNEL iVertexColorChannel, RED::Object *iResMgr, RED_RC &oErrorCode)

Constructor.

Parameters
  • iPass – Targets RED::MTL_PRELIT, RED::MTL_POSTLIT for direct lighting passes or RED::MTL_INDIRECT_PRELIT or RED::MTL_INDIRECT_POSTLIT for indirect lighting passes.

  • iVertexColorChannel – Index of the geometry channel to use to retrieve vertex color information.

  • iResMgr – The cluster’s resource manager.

  • oErrorCode – Indicates a construction failure when not returned set to RED_OK.

virtual ~RenderShaderVertexColor()

Destructor.

Public Static Functions

static inline RED::CID GetClassID()
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
  • ioShaderShader 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.