RenderShaderEdges

Functions

SET_CID

IMPLEMENT_AS

RenderShaderEdges

~RenderShaderEdges

RED_RC

LoadProgram

RED_RC

EvaluateFromInputParameters

Detailed Description

class RenderShaderEdges : public RED::RenderShader

Edge selection and rendering shader.

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

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.

Public Functions

SET_CID(CID_class_REDRenderShaderEdges)
IMPLEMENT_AS()
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.

virtual ~RenderShaderEdges()

Destructor.

Public Static Functions

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.