class RED::Shader

Master shader class. Defines the way elements are rendered. More...

#include <REDShader.h>

Inherits: IChunkSaver and Object.

Inherited by: RenderShader and StateShader.

Public functions:

Shader ( )
virtual ~Shader ( )
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 ( )
virtual Shader *Clone ( ) const = 0
virtual RED_RCGetOperationStream ( const RED::Object * iCaller, RED::Vector< int > & ioStream, RED::HARDWARE_PLATFORM iPlatformId ) const
virtual RED_RCUpdateFrom ( const RED::Object & iShader, const RED::State & iState, int iSrcStateNumber ) = 0

Public static functions:

static RED::CIDGetClassID ( )

Detailed description:

Master shader class. Defines the way elements are rendered.

Shaders are objects involved during the construction of a material for the rendering of shapes in a scene. A shape owns one single material that defines the way it'll be rendered and react to lighting.

There are two kind of shaders beyond the Shader class, which is a generic object:

Shaders are assembled in lists defining the rendering sequences of a material. As explained in the Building REDsdk materials book, there are three basic rendering sequences: pre-lighting, lighting and post-lighting, so a given material may have three separate shader lists (plus other special lists for dedicated shading purposes).

Shaders can't be shared amongst materials, but can be shared amongst passes in the same material. Materials can be shared by many shapes.

RED::RenderShader and RED::StateShader shaders classes instances support platform selection, which enables the same shader to behave in a way that is specific to a given graphical hardware.

Functions documentation


public virtual RED::Shader::~Shader()


public virtual void * RED::Shader::As(const RED::CID &iCID)
public virtual const void * RED::Shader::As(const RED::CID &iCID) const
template< class T_As > public const T_As * RED::Shader::As() const
template< class T_As > public T_As * RED::Shader::As()
public virtual Shader * RED::Shader::Clone() const = 0

Object duplication.

This method must return a full copy of this.


A duplicate of this.

Implemented by: RED::RenderShader::Clone and RED::StateShader::Clone.

public virtual RED_RC RED::Shader::GetOperationStream(const RED::Object *iCaller,
RED::Vector< int > &ioStream,

Gets the operation stream of a shader.

Internal RED usage method. Writes down the shader stream.


iCaller:Pointer to the method caller.
ioStream:Stream to write to.
iPlatformId:Target hardware platform identifier.


RED_OK when the shader write all its streams,
RED_ALLOC_FAILURE if an internal allocation did fail,
RED_FAIL otherwise.

Reimplemented by: RED::RenderShader::GetOperationStream and RED::StateShader::GetOperationStream.

public virtual RED_RC RED::Shader::UpdateFrom(const RED::Object &iShader,
const RED::State &iState,
) = 0

Updates the instance with the content of the given one.


iShader:Pointer to the source shader.
iState:Transaction parameter.
iSrcStateNumber:Transaction at which the source shader must be evaluated.


RED_OK on success,
RED_ALLOC_FAILURE on memory allocation error,
RED_FAILED otherwise.

Implemented by: RED::RenderShader::UpdateFrom and RED::StateShader::UpdateFrom.