class RED::RenderShaderSectionCut

Section cutting plane calculation shader. More...

#include <REDRenderShaderSectionCut.h>

Inherits: RenderShader.

Public functions:

RenderShaderSectionCut ( RED::MESH_CHANNEL iVertexChannel, RED::MESH_CHANNEL iNormal1Channel, RED::MESH_CHANNEL iNormal2Channel, bool iDrawBorder, bool iDrawContour, float iCreaseAngle, const float iPlaneEquation[4], RED::Object * iResMgr, RED_RC & oErrorCode )
RenderShaderSectionCut ( const float iPlaneEquation[4], RED::Object * iResMgr, RED_RC & oErrorCode )
virtual ~RenderShaderSectionCut ( )
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_RCEvaluateFromInputParameters ( RED::RenderShader * ioShader, RED::Object * iResMgr )
static RED::CIDGetClassID ( )
static RED_RCLoadProgram ( RED::String & oString, const RED::ShaderProgramID & iID )

Detailed description:

Section cutting plane calculation shader.

The section cut shader is embedded into a complete helper that apply section cutting to a material: See RED::IMaterial::SetCuttingPlane for details.

This shader is used in a preparation step to apply a cutting plane to any visible geometry. It calculates the necessary display mask that isolates all fragments that must remain visible after application of the cutting plane. One single cutting plane can be specified at a time.

All rendered fragments on the positive side of the plane are discared.

This shader uses the following geometrical channels:

The RenderShaderSectionCut can be used in a direct lighting configuration, usually in the RED::MTL_PRELIT pass of the material.

This shader creates two platform configurations in direct lighting:

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

Functions documentation

public RED::RenderShaderSectionCut::RenderShaderSectionCut(RED::MESH_CHANNELiVertexChannel,
RED::MESH_CHANNELiNormal1Channel,
RED::MESH_CHANNELiNormal2Channel,
booliDrawBorder,
booliDrawContour,
floatiCreaseAngle,
const floatiPlaneEquation[4],
RED::Object *iResMgr,
RED_RC &oErrorCode
)

Constructor for edges.

This construction method uses the same setup parameters as the RED::RenderShaderEdges. It's intended for use to apply section cutting on geometries that are rendered using the RED::RenderShaderEdges.

This shader must go to the RED::MTL_PRELIT rendering pass.

Parameters:

iVertexChannel:Source channel with vertex information.
iNormal1Channel:First adjacent triangle normal channel.
iNormal2Channel:Second adjacent triangle normal channel.
iDrawBorder:Render border edges?
iDrawContour:Render contour edges?
iCreaseAngle:Crease angle below which inner edges will be filtered (in radians). Set to RED_PI to discard all inner edges.
iPlaneEquation:Cutting plane equation. 4 values must be supplied in the array, in the order A, B, C, D that define each plane equation by A*x + B*y + C*z + D = 0. Coefficients must be in world space coordinates.
iResMgr:The cluster's resource manager.
oErrorCode:Indicates a construction failure when not returned set to RED_OK.
public RED::RenderShaderSectionCut::RenderShaderSectionCut(const floatiPlaneEquation[4],
RED::Object *iResMgr,
RED_RC &oErrorCode
)

Constructor.

Parameters:

iPlaneEquation:Cutting plane equation. 4 values must be supplied in the array, in the order A, B, C, D that define each plane equation by A*x + B*y + C*z + D = 0. Coefficients must be in world space coordinates.
iResMgr:The cluster's resource manager.
oErrorCode:Indicates a construction failure when not returned set to RED_OK.

Destructor.

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.

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.
public virtual void * RED::RenderShaderSectionCut::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.

Reimplements: RED::RenderShader::As.

public virtual const void * RED::RenderShaderSectionCut::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.

Reimplements: RED::RenderShader::As.

template< class T_As > public const T_As * RED::RenderShaderSectionCut::As() const

Template version of the as const method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to a const instance of class T on success, NULL otherwise.

Reimplements: RED::RenderShader::As.

template< class T_As > public T_As * RED::RenderShaderSectionCut::As()

Template version of the as method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to an instance of class T on success, NULL otherwise.

Reimplements: RED::RenderShader::As.