Graph node dedicated for rendering. More...
Public Types | |
enum | CullFunct { False, True, Occlusion } |
Renderable culling function. More... | |
Public Member Functions | |
void | ApplyModelTransform (RenderContext ctx) |
Apply this RenderGraphNode hierarchy model transformations. | |
void | Cull (RenderWindow window, RenderContext ctx) |
Determine Renderable culling state (including hierarchy). | |
RenderState | GetRenderState (string name) |
Obtain a render state. | |
void | Orientate (Vertex3f r, bool inc) |
void | Orientate (Vertex3f r) |
void | Orientate (Quaternion q, bool inc) |
void | Orientate (Quaternion q) |
void | Pick (RenderContext ctx) |
Pick this graph node hierarchy. | |
void | Render (RenderContext ctx) |
Render this graph node hierarchy. | |
void | ResetName () |
Reset the name. | |
void | ResetRenderState (string sName) |
Reset a render state. | |
void | SetRenderState (RenderState rState) |
Set a render state. | |
virtual void | SetState (RenderContext ctx, ShaderProgram sProgram) |
Set shader program state. | |
void | Translate (Vertex3f v, bool inc) |
void | Translate (Vertex3f v) |
Protected Member Functions | |
void | ApplyThisModelTransform (RenderContext ctx) |
Apply this Renderable model transformations. | |
virtual void | CullThis (RenderWindow window, RenderContext ctx) |
Determine this Renderable culling state. | |
virtual void | RenderThis (RenderContext ctx, ShaderProgram sProgram) |
Actually render this render graph node. | |
Properties | |
virtual IEnumerable< ShaderObject > | Attachments [get] |
Shader object required for correct linkage. | |
CullFunct | CullFunction [get, set] |
Culling function of this Renderable. | |
virtual IEnumerable< string > | Defines [get] |
Shader source preprocessor definitions. | |
bool | IsCulled [get] |
Determine this Renderable culling state. | |
string | Name [get, set] |
Name property. | |
Quaternion | Orientation [get] |
BaseShaderAttributes | RenderAttributes [get, set] |
ShaderAttributes used for rendering. | |
ShaderProgram | RenderShader [get, set] |
ShaderProgram used for rendering. | |
Vertex3f | Translation [get] |
Events | |
CompilerEventHandler | CompilerEvent |
Compiler event. | |
LinkerEventHandler | LinkerEvent |
Linker event. |
Graph node dedicated for rendering.
A class deriving from RenderGraphNode is able to partecipate into a RenderHierarchy. In particoular, a RenderGraphNode class allow:
Rendering operations are defined exlusively by a ShaderProgram instance, with its inpus and its uniforms. This class doesn't define a default shader, but it' derived classes responsability to setup a ShaderProgram to be executed. Actually the ShaderProgram can be undefined; in this case a RenderGraphNode is used as "invisible" render hierarchy node, and the iterations on the directed graph continue across each RenderGraphNode instance. But to produce rendering results, the RenderShader property but be set to a valid ShaderProgram.
Before calling the routine RenderThis, the RenderGraphNode implementation updates the current rendering state, which is represented by every information which is able to modify the rendering results produces by the render shader program.
The current model view matrix is represented by RenderContext:Model, which is initially set identity, it is transformed by RenderGraphNode instances during render hierarchy iteration. The transformation is defined by the protected routine ApplyThisModelTransform. The model view matrix can be used for transforming primitives in a homogeneous three dimensional space.
Renderable culling function.
False |
False cull test function. The Renderable will never be culled. It will always rendered. This is the default Renderable cull test function. |
True |
True cull test function. The Renderable will always be culled. It will never be rendered. |
Occlusion |
Occlusion query cull test function. The Renderable will be culled if the occlusion query determine whether the rendering doesn't produce pixel fragments. To use this cull function, the RenderContext capabilities must declare that the extension GL_ARB_occlusion_query is implemented. |
void Derm.Render.RenderGraphNode.ApplyModelTransform | ( | RenderContext | ctx | ) |
Apply this RenderGraphNode hierarchy model transformations.
ctx | RenderContext object used for rendering. |
This routine modify the model view matrix in the way that the resulting model view matrix is the multiplication of the hierarchy transformations, from the root Renderable until this Renderable.
Using this routine is possible to determine the model transformations applied to this Renderable to obtain world coordinates of this RenderGraphNode.
void Derm.Render.RenderGraphNode.ApplyThisModelTransform | ( | RenderContext | ctx | ) | [protected] |
Apply this Renderable model transformations.
ctx | RenderContext object used for rendering. |
Unlike ApplyModelTransform, this routine apply to the current matrix this Renderable model transformations. The transformations are:
void Derm.Render.RenderGraphNode.Cull | ( | RenderWindow | window, | |
RenderContext | ctx | |||
) |
Determine Renderable culling state (including hierarchy).
window | ||
ctx |
This routine is responsible of the culling of this Renderable, and indirectly of the hierarchy starting from this Renderable. It execute a cull test on this Renderable, and if the cull test is passed execute the same test of the Renderable children.
If the cull test hasn't passed, the Renderable won't be rendered, hiding also its hierarchy. This is crucial, since the parent cull test determine the visibility of its all entire hierarchy.
virtual void Derm.Render.RenderGraphNode.CullThis | ( | RenderWindow | window, | |
RenderContext | ctx | |||
) | [protected, virtual] |
Determine this Renderable culling state.
window | A RenderWindow | |
ctx | A RenderContext |
RenderState Derm.Render.RenderGraphNode.GetRenderState | ( | string | name | ) |
Obtain a render state.
name |
void Derm.Render.RenderGraphNode.Orientate | ( | Vertex3f | r, | |
bool | inc | |||
) |
void Derm.Render.RenderGraphNode.Orientate | ( | Vertex3f | r | ) |
void Derm.Render.RenderGraphNode.Orientate | ( | Quaternion | q, | |
bool | inc | |||
) |
void Derm.Render.RenderGraphNode.Orientate | ( | Quaternion | q | ) |
void Derm.Render.RenderGraphNode.Pick | ( | RenderContext | ctx | ) |
Pick this graph node hierarchy.
ctx | A RenderContext used for picking. |
void Derm.Render.RenderGraphNode.Render | ( | RenderContext | ctx | ) |
Render this graph node hierarchy.
ctx | A RenderContext used for rendering. |
This routine is the entry point for executing rendering operation of this RenderGraphNode hierarchy. It render this RenderGraphNode instance, and then render its hierarchy. Note that this routine doesn't define the rendering operations, but let derived classes to define them overriding the routine RenderThis. In the case derived classes doesn't override that routine, this node doesn't execute rendering operations.
Before rendering this RenderGraphNode and its hierarchy, the ModelView of ctx is modified to follow this RenderGraphNode model transformations; indeed the hierarchy linked with RenderGraphNode instance is affected by the transformation. The ctx ModelView is restored before the routine ends.
In the case this RenderGraphNode is culled, it won't be rendered, including its hierarchy.
virtual void Derm.Render.RenderGraphNode.RenderThis | ( | RenderContext | ctx, | |
ShaderProgram | sProgram | |||
) | [protected, virtual] |
Actually render this render graph node.
ctx | A RenderContext used for rendering. | |
sProgram | A ShaderProgram actually bound for rendering. |
void Derm.Render.RenderGraphNode.ResetName | ( | ) |
Reset the name.
Implements Derm.Render.INameable.
void Derm.Render.RenderGraphNode.ResetRenderState | ( | string | sName | ) |
Reset a render state.
sName | A System.String specifying the state name to reset. |
void Derm.Render.RenderGraphNode.SetRenderState | ( | RenderState | rState | ) |
Set a render state.
rState | A RenderState which affect rendering operations. |
virtual void Derm.Render.RenderGraphNode.SetState | ( | RenderContext | ctx, | |
ShaderProgram | sProgram | |||
) | [virtual] |
void Derm.Render.RenderGraphNode.Translate | ( | Vertex3f | v, | |
bool | inc | |||
) |
void Derm.Render.RenderGraphNode.Translate | ( | Vertex3f | v | ) |
virtual IEnumerable<ShaderObject> Derm.Render.RenderGraphNode.Attachments [get] |
Shader object required for correct linkage.
Implements Derm.Render.IShaderState.
Reimplemented in Derm.Mesh.Mesh.
CullFunct Derm.Render.RenderGraphNode.CullFunction [get, set] |
Culling function of this Renderable.
virtual IEnumerable<string> Derm.Render.RenderGraphNode.Defines [get] |
Shader source preprocessor definitions.
Implements Derm.Render.IShaderState.
bool Derm.Render.RenderGraphNode.IsCulled [get] |
Determine this Renderable culling state.
string Derm.Render.RenderGraphNode.Name [get, set] |
Name property.
Implements Derm.Render.INameable.
Quaternion Derm.Render.RenderGraphNode.Orientation [get] |
BaseShaderAttributes Derm.Render.RenderGraphNode.RenderAttributes [get, set] |
ShaderAttributes used for rendering.
ShaderProgram Derm.Render.RenderGraphNode.RenderShader [get, set] |
ShaderProgram used for rendering.
Vertex3f Derm.Render.RenderGraphNode.Translation [get] |
CompilerEventHandler Derm.Render.RenderGraphNode.CompilerEvent |
Compiler event.
Implements Derm.Render.IShaderState.
LinkerEventHandler Derm.Render.RenderGraphNode.LinkerEvent |
Linker event.
Implements Derm.Render.IShaderState.