class RED::RenderShaderEdges
Edge selection and rendering shader. More...
#include <REDRenderShaderEdges.h>
Inherits: RenderShader.
Public functions:
RenderShaderEdges ( RED::MATERIAL_PASS iRenderingPass, RED::MESH_CHANNEL iVertexChannel, RED::MESH_CHANNEL iNormal1Channel, RED::MESH_CHANNEL iNormal2Channel, const RED::Color & iColor, bool iDrawBorder, bool iDrawContour, float iCreaseAngle, RED::Object * iResMgr, RED_RC & oErrorCode ) | |
virtual | ~RenderShaderEdges ( ) |
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_RC | EvaluateFromInputParameters ( RED::RenderShader * ioShader, RED::Object * iResMgr ) |
static RED::CID | GetClassID ( ) |
static RED_RC | LoadProgram ( RED::String & oString, const RED::ShaderProgramID & iID ) |
Detailed description:
Edge selection and rendering shader.
This shader is used on objects that implement the RED::ILineShape interface. It uses edges attributes information to filter edges that must be rendered in a geometry, among:
- Border (or frontier) edges,
- Contour edges,
- Inner edges based on a crease angle threshold.
Edges are rendered using a constant color (including alpha output).
The shader requires the following data channel on the input lines:
- Vertices,
- First adjacent triangle normal,
- Second adjacent triangle normal (zero in the data channel if there's no second triangle sharing the edge).
The result of RED::IMeshShape::BuildContourEdges generates data that is well suited for using with this shader.
This shader creates the following platform configurations:
All parameters declared by this shader are using the RED_SHAD_TARGET_LIGHT_NO_LIGHT shader target (commonly used in its shortcut form RED_L0), except for the declared software kill shader statements that are using the RED_SHAD_TARGET_SOFT_KILL target.
See the REDRenderShaderEdges.h file documentation for the list of all define statements used to name all parameters of this shader.
Functions documentation
public RED::RenderShaderEdges::RenderShaderEdges | ( | RED::MATERIAL_PASS | iRenderingPass, |
RED::MESH_CHANNEL | iVertexChannel, | ||
RED::MESH_CHANNEL | iNormal1Channel, | ||
RED::MESH_CHANNEL | iNormal2Channel, | ||
const RED::Color & | iColor, | ||
bool | iDrawBorder, | ||
bool | iDrawContour, | ||
float | iCreaseAngle, | ||
RED::Object * | iResMgr, | ||
RED_RC & | oErrorCode | ||
) |
Constructor.
Parameters:
iRenderingPass: | The target rendering pass in RED::MTL_PRELIT, or RED::MTL_POSTLIT. |
iVertexChannel: | Source channel with vertex information. |
iNormal1Channel: | First adjacent triangle normal channel. |
iNormal2Channel: | Second adjacent triangle normal channel. |
iColor: | Output edge color. |
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. |
iResMgr: | The cluster's resource manager. |
oErrorCode: | Indicates a construction failure when not returned set to RED_OK. |
public virtual RED::RenderShaderEdges::~RenderShaderEdges | ( | ) |
Destructor.
public static RED_RC RED::RenderShaderEdges::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_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.
public static RED::CID RED::RenderShaderEdges::GetClassID | ( | ) |
Reimplements: RED::RenderShader::GetClassID.
public static RED_RC RED::RenderShaderEdges::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_ALLOC_FAILURE if an allocation has failed,
RED_FAIL otherwise.
public virtual void * RED::RenderShaderEdges::As | ( | const RED::CID & | iCID | ) |
Converts the object to an instance of the given type.
Parameters:
iCID: | Requested class. |
Returns:
Reimplements: RED::RenderShader::As.
public virtual const void * RED::RenderShaderEdges::As | ( | const RED::CID & | iCID | ) const |
Converts the object to an instance of the given type.
Parameters:
iCID: | Requested class. |
Returns:
Reimplements: RED::RenderShader::As.
template< class T_As > public const T_As * RED::RenderShaderEdges::As | ( | ) const |
Template version of the as const method.
Simply set T to be the class you want to retrieve an interface to.
Returns:
Reimplements: RED::RenderShader::As.
template< class T_As > public T_As * RED::RenderShaderEdges::As | ( | ) |
Template version of the as method.
Simply set T to be the class you want to retrieve an interface to.
Returns:
Reimplements: RED::RenderShader::As.