Pyrogenesis trunk
Public Member Functions | Protected Attributes | List of all members
InstancingModelRenderer Class Reference

Render non-animated (but potentially moving) models using a ShaderRenderModifier. More...

#include <InstancingModelRenderer.h>

Inheritance diagram for InstancingModelRenderer:
Inheritance graph
[legend]
Collaboration diagram for InstancingModelRenderer:
Collaboration graph
[legend]

Public Member Functions

 InstancingModelRenderer (bool gpuSkinning, bool calculateTangents)
 
 ~InstancingModelRenderer ()
 
CModelRDataCreateModelData (const void *key, CModel *model) override
 CreateModelData: Create internal data for one model. More...
 
void UpdateModelData (CModel *model, CModelRData *data, int updateflags) override
 UpdateModelData: Calculate per-model data for each frame. More...
 
void UploadModelData (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, CModel *model, CModelRData *data) override
 Upload per-model data to backend. More...
 
void PrepareModelDef (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CModelDef &def) override
 PrepareModelDef: Setup backend state for rendering of models that use the given CModelDef object as base. More...
 
void RenderModel (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, Renderer::Backend::IShaderProgram *shader, CModel *model, CModelRData *data) override
 RenderModel: Invoke the rendering commands for the given model. More...
 
- Public Member Functions inherited from ModelVertexRenderer
virtual ~ModelVertexRenderer ()
 
virtual CModelRDataCreateModelData (const void *key, CModel *model)=0
 CreateModelData: Create internal data for one model. More...
 
virtual void UpdateModelData (CModel *model, CModelRData *data, int updateflags)=0
 UpdateModelData: Calculate per-model data for each frame. More...
 
virtual void UploadModelData (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, CModel *model, CModelRData *data)=0
 Upload per-model data to backend. More...
 
virtual void PrepareModelDef (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, const CModelDef &def)=0
 PrepareModelDef: Setup backend state for rendering of models that use the given CModelDef object as base. More...
 
virtual void RenderModel (Renderer::Backend::IDeviceCommandContext *deviceCommandContext, Renderer::Backend::IShaderProgram *shader, CModel *model, CModelRData *data)=0
 RenderModel: Invoke the rendering commands for the given model. More...
 

Protected Attributes

InstancingModelRendererInternalsm
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ InstancingModelRenderer()

InstancingModelRenderer::InstancingModelRenderer ( bool  gpuSkinning,
bool  calculateTangents 
)

◆ ~InstancingModelRenderer()

InstancingModelRenderer::~InstancingModelRenderer ( )

Member Function Documentation

◆ CreateModelData()

CModelRData * InstancingModelRenderer::CreateModelData ( const void *  key,
CModel model 
)
overridevirtual

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.

Parameters
keyAn opaque pointer to pass to the CModelRData constructor
modelThe model.
Returns
A new CModelRData that will be passed into other ModelVertexRenderer functions whenever the same CModel is used again.

Implements ModelVertexRenderer.

◆ PrepareModelDef()

void InstancingModelRenderer::PrepareModelDef ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
const CModelDef def 
)
overridevirtual

PrepareModelDef: Setup backend 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.

Parameters
defThe model definition.

Implements ModelVertexRenderer.

◆ RenderModel()

void InstancingModelRenderer::RenderModel ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
Renderer::Backend::IShaderProgram shader,
CModel model,
CModelRData data 
)
overridevirtual

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().

Parameters
modelThe model that should be rendered.
dataPrivate 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.

◆ UpdateModelData()

void InstancingModelRenderer::UpdateModelData ( CModel model,
CModelRData data,
int  updateflags 
)
overridevirtual

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.

Parameters
modelThe model.
dataPrivate data as returned by CreateModelData.
updateflagsFlags 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.

◆ UploadModelData()

void InstancingModelRenderer::UploadModelData ( Renderer::Backend::IDeviceCommandContext deviceCommandContext,
CModel model,
CModelRData data 
)
overridevirtual

Upload per-model data to backend.

ModelRenderer implementations must call this after UpdateModelData once per frame for every model that is to be rendered in this frame.

ModelVertexRenderer implementations should use this function to upload all needed data to backend.

Implements ModelVertexRenderer.

Member Data Documentation

◆ m

InstancingModelRendererInternals* InstancingModelRenderer::m
protected

The documentation for this class was generated from the following files: