ModelRenderer renders a per-frame list of models.
More...
#include <ModelRenderer.h>
|
| static void | CopyPositionAndNormals (const CModelDefPtr &mdef, const VertexArrayIterator< CVector3D > &Position, const VertexArrayIterator< CVector3D > &Normal) |
| | CopyPositionAndNormals: Copy unanimated object-space vertices and normals into the given vertex array. More...
|
| |
| static void | BuildPositionAndNormals (CModel *model, const VertexArrayIterator< CVector3D > &Position, const VertexArrayIterator< CVector3D > &Normal) |
| | BuildPositionAndNormals: Build animated vertices and normals, transformed into world space. More...
|
| |
| static void | BuildUV (const CModelDefPtr &mdef, const VertexArrayIterator< float[2]> &UV, int UVset) |
| | BuildUV: Copy UV coordinates into the given vertex array. More...
|
| |
| static void | BuildIndices (const CModelDefPtr &mdef, const VertexArrayIterator< std::uint16_t > &Indices) |
| | BuildIndices: Create the indices array for the given CModelDef. More...
|
| |
| static void | GenTangents (const CModelDefPtr &mdef, std::vector< float > &newVertices, bool gpuSkinning) |
| | GenTangents: Generate tangents for the given CModelDef. More...
|
| |
ModelRenderer renders a per-frame list of models.
It loads the appropriate shaders for rendering each model, and that batches by shader technique (and by mesh and texture).
ModelRenderer delegates vertex transformation/setup to a ModelVertexRenderer. It delegates fragment stage setup to a RenderModifier.
ModelRenderer also contains a number of static helper functions for building vertex arrays.
◆ BuildIndices()
BuildIndices: Create the indices array for the given CModelDef.
- Parameters
-
| mdef | The model definition object. |
| Indices | The index array, must be able to hold mdef->GetNumFaces()*3 elements. |
◆ BuildPositionAndNormals()
BuildPositionAndNormals: Build animated vertices and normals, transformed into world space.
- Parameters
-
| 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. It must allow 16 bytes to be written to each element (i.e. provide 4 bytes of padding after each CVector3D). |
| Normal | Points to the array that will receive transformed normal vectors. The array behind the iterator must be as large as the Position array. |
◆ BuildUV()
BuildUV: Copy UV coordinates into the given vertex array.
- Parameters
-
| 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. |
◆ CopyPositionAndNormals()
CopyPositionAndNormals: Copy unanimated object-space vertices and normals into the given vertex array.
- Parameters
-
| 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. |
◆ GenTangents()
| void ModelRenderer::GenTangents |
( |
const CModelDefPtr & |
mdef, |
|
|
std::vector< float > & |
newVertices, |
|
|
bool |
gpuSkinning |
|
) |
| |
|
static |
GenTangents: Generate tangents for the given CModelDef.
- Parameters
-
| mdef | The model definition object. |
| newVertices | An out vector of the unindexed vertices with tangents added. The new vertices cannot be used with existing face index and must be welded/reindexed. |
◆ Render()
Render: Render submitted models, using the given RenderModifier to setup the fragment stage.
preconditions : PrepareModels must be called after all models have been submitted and before calling Render.
- Parameters
-
| 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. |
The documentation for this class was generated from the following files: