Pyrogenesis
13997
|
Render non-animated (but potentially moving) models using a ShaderRenderModifier. More...
#include <InstancingModelRenderer.h>
Public Member Functions | |
InstancingModelRenderer (bool gpuSkinning, bool calculateTangents) | |
~InstancingModelRenderer () | |
CModelRData * | CreateModelData (const void *key, CModel *model) |
CreateModelData: Create internal data for one model. More... | |
void | UpdateModelData (CModel *model, CModelRData *data, int updateflags) |
UpdateModelData: Calculate per-model data for each frame. More... | |
void | BeginPass (int streamflags) |
BeginPass: Setup global OpenGL state for this ModelVertexRenderer. More... | |
void | EndPass (int streamflags) |
EndPass: Cleanup OpenGL state set up by BeginPass. More... | |
void | PrepareModelDef (const CShaderProgramPtr &shader, int streamflags, const CModelDef &def) |
PrepareModelDef: Setup OpenGL state for rendering of models that use the given CModelDef object as base. More... | |
void | RenderModel (const CShaderProgramPtr &shader, int streamflags, CModel *model, CModelRData *data) |
RenderModel: Invoke the rendering commands for the given model. More... | |
![]() | |
virtual | ~ModelVertexRenderer () |
Protected Attributes | |
InstancingModelRendererInternals * | m |
Render non-animated (but potentially moving) models using a ShaderRenderModifier.
This computes and binds per-vertex data; the modifier is responsible for setting any shader uniforms etc (including the instancing transform).
Definition at line 35 of file InstancingModelRenderer.h.
InstancingModelRenderer::InstancingModelRenderer | ( | bool | gpuSkinning, |
bool | calculateTangents | ||
) |
Definition at line 265 of file InstancingModelRenderer.cpp.
InstancingModelRenderer::~InstancingModelRenderer | ( | ) |
Definition at line 273 of file InstancingModelRenderer.cpp.
|
virtual |
BeginPass: Setup global OpenGL state for this ModelVertexRenderer.
ModelVertexRenderer implementations should prepare "heavy" OpenGL state such as vertex shader state to prepare for rendering models and delivering vertex data to the fragment stage as described by streamflags.
ModelRenderer implementations must call this function before any calls to other rendering related functions.
Recursive calls to BeginPass are not allowed, and every BeginPass is matched by a corresponding call to EndPass.
streamflags | Vertex streams required by the fragment stage. |
Implements ModelVertexRenderer.
Definition at line 307 of file InstancingModelRenderer.cpp.
|
virtual |
CreateModelData: Create internal data for one model.
ModelRenderer implementations must call this once for every model that will later be rendered, with key
set to a value that's unique to that ModelRenderer.
ModelVertexRenderer implementations should use this function to create per-CModel and per-CModelDef data like vertex arrays.
key | An opaque pointer to pass to the CModelRData constructor |
model | The model. |
Implements ModelVertexRenderer.
Definition at line 280 of file InstancingModelRenderer.cpp.
|
virtual |
EndPass: Cleanup OpenGL state set up by BeginPass.
ModelRenderer implementations must call this function after rendering related functions for one pass have been called.
streamflags | Vertex streams required by the fragment stage. This equals the streamflags parameter passed on the last call to BeginPass. |
Implements ModelVertexRenderer.
Definition at line 313 of file InstancingModelRenderer.cpp.
|
virtual |
PrepareModelDef: Setup OpenGL state for rendering of models that use the given CModelDef object as base.
ModelRenderer implementations must call this function before rendering a sequence of models based on the given CModelDef. When a ModelRenderer switches back and forth between CModelDefs, it must call PrepareModelDef for every switch.
streamflags | Vertex streams required by the fragment stage. This equals the streamflags parameter passed on the last call to BeginPass. |
def | The model definition. |
Implements ModelVertexRenderer.
Definition at line 320 of file InstancingModelRenderer.cpp.
|
virtual |
RenderModel: Invoke the rendering commands for the given model.
ModelRenderer implementations must call this function to perform the actual rendering.
preconditions : The most recent call to PrepareModelDef since BeginPass has been for model->GetModelDef().
streamflags | Vertex streams required by the fragment stage. This equals the streamflags parameter passed on the last call to BeginPass. |
model | The model that should be rendered. |
data | Private data for the model as returned by CreateModelData. |
postconditions : Subsequent calls to RenderModel for models that use the same CModelDef object and the same texture must succeed.
Implements ModelVertexRenderer.
Definition at line 358 of file InstancingModelRenderer.cpp.
|
virtual |
UpdateModelData: Calculate per-model data for each frame.
ModelRenderer implementations must call this once per frame for every model that is to be rendered in this frame, even if the value of updateflags will be zero. This implies that this function will also be called at least once between a call to CreateModelData and a call to RenderModel.
ModelVertexRenderer implementations should use this function to perform software vertex transforms and potentially other per-frame calculations.
model | The model. |
data | Private data as returned by CreateModelData. |
updateflags | Flags indicating which data has changed during the frame. The value is the same as the value of the model's CRenderData::m_UpdateFlags. |
Implements ModelVertexRenderer.
Definition at line 300 of file InstancingModelRenderer.cpp.
|
protected |
Definition at line 51 of file InstancingModelRenderer.h.