|
0 A.D. | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Class ModelRenderer: Abstract base class for all model renders. A ModelRenderer manages a per-frame list of models. It is supposed to be derived in order to create new ways in which the per-frame list of models can be managed (for batching, for transparent rendering, etc.) or potentially for rarely used special effects. A typical ModelRenderer will delegate vertex transformation/setup to a ModelVertexRenderer. It will delegate fragment stage setup to a RenderModifier. For most purposes, you should use a BatchModelRenderer with specialized ModelVertexRenderer and RenderModifier implementations. It is suggested that a derived class implement the provided generic Render function, however in some cases it may be necessary to supply a Render function with a different prototype. ModelRenderer also contains a number of static helper functions for building vertex arrays.
Constructor Summary | |
ModelRenderer()
|
|
virtual ~ModelRenderer()
|
Method Summary | |
static void |
BuildColor4ub( CModel* model, VertexArrayIterator< CVector3D > Normal, VertexArrayIterator< SColor4ub > Color, bool onlyDiffuse )
BuildColor4ub: Build lighting colors for the given model, based on previously calculated world space normals. |
static void |
BuildIndices( CModelDefPtr mdef, u16* Indices )
BatchModelRenderer implementation |
static void |
BuildPositionAndNormals( CModel* model, VertexArrayIterator< CVector3D > Position, VertexArrayIterator< CVector3D > Normal )
BuildPositionAndNormals: Build animated vertices and normals, transformed into world space. |
static void |
BuildUV( CModelDefPtr mdef, VertexArrayIterator< float[ 2] > UV )
BuildUV: Copy UV coordinates into the given vertex array. |
static void |
CopyPositionAndNormals( CModelDefPtr mdef, VertexArrayIterator< CVector3D > Position, VertexArrayIterator< CVector3D > Normal )
CopyPositionAndNormals: Copy unanimated object-space vertices and normals into the given vertex array. |
virtual void |
EndFrame()= 0
EndFrame: Remove all models from the list of submitted models. |
virtual bool |
HaveSubmissions()= 0
HaveSubmissions: Return whether any models have been submitted this frame. |
virtual void |
PrepareModels()= 0
PrepareModels: Calculate renderer data for all previously submitted models. |
virtual void |
Render( RenderModifierPtr modifier, u32 flags )= 0
Render: Render submitted models, using the given RenderModifier to setup the fragment stage. |
virtual void |
Submit( CModel* model )= 0
Submit: Submit a model for rendering this frame. |
Constructor Detail |
public ModelRenderer();
public virtual ~ModelRenderer();
Method Detail |
public static void BuildColor4ub( CModel* model, VertexArrayIterator< CVector3D > Normal, VertexArrayIterator< SColor4ub > Color, bool onlyDiffuse );
model
- The model that is to be lit.
Normal
- Array of the model's normal vectors, animated and
transformed into world space.
Color
- Points to the array that will receive the lit vertex color.
The array behind the iterator must large enough to hold
model->GetModelDef()->GetNumVertices() vertices.
onlyDiffuse
- if true, color will only contain the diffuse term (instead
of both ambient and diffuse)public static void BuildIndices( CModelDefPtr mdef, u16* Indices );
public static void BuildPositionAndNormals( CModel* model, VertexArrayIterator< CVector3D > Position, VertexArrayIterator< CVector3D > Normal );
model
- The model that is to be transformed.
Position
- Points to the array that will receive
transformed position vectors. The array behind the iterator
must be large enough to hold model->GetModelDef()->GetNumVertices()
vertices.
Normal
- Points to the array that will receive transformed
normal vectors. The array behind the iterator must be as large as
the Position array.public static void BuildUV( CModelDefPtr mdef, VertexArrayIterator< float[ 2] > UV );
mdef
- The model def.
UV
- Points to the array that will receive UV coordinates.
The array behind the iterator must large enough to hold
mdef->GetNumVertices() vertices.public static void CopyPositionAndNormals( CModelDefPtr mdef, VertexArrayIterator< CVector3D > Position, VertexArrayIterator< CVector3D > Normal );
mdef
- The underlying CModelDef that contains mesh data.
Position
- Points to the array that will receive
position vectors. The array behind the iterator
must be large enough to hold model->GetModelDef()->GetNumVertices()
vertices.
Normal
- Points to the array that will receive normal vectors.
The array behind the iterator must be as large as the Position array.public virtual void EndFrame()= 0;
public virtual bool HaveSubmissions()= 0;
public virtual void PrepareModels()= 0;
public virtual void Render( RenderModifierPtr modifier, u32 flags )= 0;
modifier
- The RenderModifier that specifies the fragment stage.
flags
- If flags is 0, all submitted models are rendered.
If flags is non-zero, only models that contain flags in their
CModel::GetFlags() are rendered.public virtual void Submit( CModel* model )= 0;
model
- The model that will be added to the list of models
submitted this frame.
|
0 A.D.
Generated on September 04, 2007 at 18:14 CppDoc v2.4.0 |
|||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |