RayGIDiffuseShader

Functions

CID

GetClassID

RED_RC

LoadProgram

RED_RC

EvaluateFromInputParameters

void *

As

const void *

As

class T_As

As

class T_As

As

RayGIDiffuseShader

~RayGIDiffuseShader

Detailed Description

class RayGIDiffuseShader : public RED::RenderShader

Built-in Global Illumination shader for diffuse color and normal calculations.

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

This shader works with any built-in lighting shader (RED::RenderShaderPhong, RED::RenderShaderLambert, …). It uses the same set of parameters used to define diffusion and interpolated normal parameters in the lighting shader. Values produced by this shader are used for global illumination calculations.

This shader is intended for use in the RED::MTL_RAYTRACE rendering pass.

This shader has 4 configurations:

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

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
RayGIDiffuseShader(const RED::Color &iDiffuseColor, const RED::Object *iDiffuseTexture, const RED::Matrix &iDiffuseMatrix, RED::MESH_CHANNEL iDiffuseUV, const RED::Color &iOpacityColor, const RED::Object *iOpacityTexture, const RED::Matrix &iOpacityMatrix, RED::MESH_CHANNEL iOpacityUV, const RED::Object *iNormalMap, const RED::Matrix &iNormalMatrix, RED::MESH_CHANNEL iNormalUV, RED::MESH_CHANNEL iTangentChannel, RED::Object *iResMgr, RED_RC &oErrorCode)

RayGIDiffuseShader construction method.

Parameters
  • iDiffuseColor – Diffuse object color.

  • iDiffuseTexture – Diffuse object texture. Overrides the diffuse color when set.

  • iDiffuseMatrix – Diffuse object texture transformation matrix.

  • iDiffuseUV – Diffuse texture UV mesh channel.

  • iOpacityColor – Opacity object color.

  • iOpacityTexture – Opacity object texture. Overrides the opacity color when set.

  • iOpacityMatrix – Opacity object texture transformation matrix.

  • iOpacityUV – Opacity texture UV mesh channel.

  • iNormalMap – Surface normal perturbation map. NULL for no normal map.

  • iNormalMatrix – Normal map texture transformation matrix.

  • iNormalUV – Normal map texture UV mesh channel.

  • iTangentChannel – Mesh channel containing the vertex tangents.

  • iResMgr – The cluster’s resource manager.

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

~RayGIDiffuseShader()

RayGIDiffuseShader destruction method.

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.