#include <KeosMesh.h>
Inheritance diagram for Keos::CMesh:

Public Types | |
| typedef std::vector< CMaterial * > | TMaterialList |
Public Member Functions | |
| CMesh () | |
| Default constructor. | |
| virtual | ~CMesh () |
| Destructor. | |
| void | Render () const |
| Render the model. | |
| uint | GetTrianglesCount (void) |
| Return the number of triangles/faces in the Mesh. | |
| void | CreateSharedVertexBuffer (const CMeshGeom::TVertex *pVertices, ulong nVerticesCount) |
| Create the shared vertex buffer. | |
| void | ComputeNormals () |
| Compute the normals for each vertex. | |
| void | AddMeshGeom (CMeshGeom *pMeshGeom) |
| Add a new MeshGeom. | |
| void | AddMeshGeom (CMeshGeom *pMeshGeom, const String &strName) |
| Add a new MeshGeom and gives it a name. | |
| void | NameMeshGeom (const String &strName, ushort nIndex) |
| Gives a name to a MeshGeom. | |
| ushort | GetNumMeshGeom (void) const |
| Gets the number of MeshGeom which comprise this Mesh. | |
| CMeshGeom * | GetMeshGeom (ushort nIndex) const |
| Gets a pointer to the MeshGeom indicated by the index. | |
| CMeshGeom * | GetMeshGeom (const String &strName) const |
| Gets a MeshGeom by name. | |
| ushort | _GetMeshGeomIndex (const String &strName) const |
| Gets the index of a MeshGeom with a given name. | |
| TMaterialList & | GetMaterialList () |
| Gets the material list. | |
| CMaterial * | GetMaterial (ushort nIndex) |
| Gets a pointer to the Material indicated by the index. | |
| size_t | GetLastAddedMaterialIndex (void) |
| Gets the last added material index. | |
| size_t | GetMaterialsCount (void) |
| Gets the number of materials. | |
| void | AddMaterial (CMaterial *pMaterial) |
| Add a material. | |
| void | AddMaterial (CMaterial *pMaterial, ushort nMeshGeomIndex) |
| Add a material and assign it to the MeshGeom specified by the index. | |
Protected Types | |
| typedef std::vector< CMeshGeom * > | TMeshGeomList |
| A list of MeshGeom which make up this mesh. | |
| typedef std::map< String, ushort > | TMeshGeomNameMap |
| A hashmap used to store optional MeshGeom names. | |
Protected Attributes | |
| CBuffer< CMeshGeom::TVertex > | m_SharedVertexBuffer |
| Shared vertex buffer. | |
| TMaterialList | m_MaterialList |
| List of materials. | |
| TMeshGeomList | m_MeshGeomList |
| TMeshGeomNameMap | m_MeshGeomNameMap |
Friends | |
| class | CMeshGeom |
A CMesh is a collection of some MeshGeoms (CMeshGeom) and a list of materials.
Definition at line 35 of file KeosMesh.h.
| typedef std::vector<CMaterial*> Keos::CMesh::TMaterialList |
Definition at line 113 of file KeosMesh.h.
typedef std::vector<CMeshGeom*> Keos::CMesh::TMeshGeomList [protected] |
A list of MeshGeom which make up this mesh.
Each mesh is made up of 1 or more MeshGeom, which are each based on a single material and can have their own vertex data or they can share vertex data from the Mesh).
Definition at line 176 of file KeosMesh.h.
typedef std::map<String, ushort> Keos::CMesh::TMeshGeomNameMap [protected] |
A hashmap used to store optional MeshGeom names.
Translates a name into MeshGeom index
Definition at line 182 of file KeosMesh.h.
| Keos::CMesh::CMesh | ( | ) |
| Keos::CMesh::~CMesh | ( | ) | [virtual] |
Destructor.
Definition at line 42 of file KeosMesh.cpp.
References m_MaterialList, and m_MeshGeomList.
| void Keos::CMesh::Render | ( | ) | const |
Render the model.
Definition at line 49 of file KeosMesh.cpp.
References Keos::CMeshGeom::GetMaterialIndex(), Keos::CMeshGeom::m_bUseSharedVertexBuffer, Keos::CMeshGeom::m_IndexBuffer, m_MaterialList, m_MeshGeomList, Keos::CMeshGeom::m_nPrimitivesCount, Keos::CMeshGeom::m_pDeclaration, Keos::CMeshGeom::m_PrimitiveType, m_SharedVertexBuffer, Keos::CMeshGeom::m_VertexBuffer, and Renderer.
Referenced by Keos::CAnimatedMeshKF::Animate().
| uint Keos::CMesh::GetTrianglesCount | ( | void | ) |
Return the number of triangles/faces in the Mesh.
Definition at line 77 of file KeosMesh.cpp.
References m_MeshGeomList.
| void Keos::CMesh::CreateSharedVertexBuffer | ( | const CMeshGeom::TVertex * | pVertices, | |
| ulong | nVerticesCount | |||
| ) |
Create the shared vertex buffer.
| pVertices | Pointer on vertex array. | |
| nVerticesCount | Number of vertices. |
Definition at line 89 of file KeosMesh.cpp.
References Assert, m_SharedVertexBuffer, and Renderer.
| void Keos::CMesh::ComputeNormals | ( | ) |
Compute the normals for each vertex.
Definition at line 96 of file KeosMesh.cpp.
References Keos::CMeshGeom::GetTrianglesCount(), Keos::CVector3< T >::LengthSq(), Keos::LOCK_READONLY, Keos::LOCK_WRITEONLY, Keos::CMeshGeom::m_bUseSharedVertexBuffer, Keos::CMeshGeom::m_IndexBuffer, m_MeshGeomList, m_SharedVertexBuffer, Keos::CMeshGeom::m_VertexBuffer, Keos::CMeshGeom::TVertex::Normal, Keos::CVector3< T >::Normalize(), Keos::CMeshGeom::TVertex::Position, Keos::VectorBetweenTwoPoints(), and Keos::VectorCross().
Referenced by Keos::C3DSLoader::LoadFromFile(), and Keos::CMeshGen::MakeCube().
| void Keos::CMesh::AddMeshGeom | ( | CMeshGeom * | pMeshGeom | ) | [inline] |
Add a new MeshGeom.
Definition at line 71 of file KeosMesh.h.
References Keos::CMeshGeom::m_pParentMesh.
Referenced by Keos::CMDLQ1Loader::LoadFromFile(), Keos::CMDLQ1AnimatedLoader::LoadFromFile(), Keos::CMD2Loader::LoadFromFile(), Keos::CMD2AnimatedLoader::LoadFromFile(), Keos::CMeshGen::MakeCube(), and Keos::CMeshGen::MakeSphere().
| ushort Keos::CMesh::GetNumMeshGeom | ( | void | ) | const [inline] |
Gets a pointer to the MeshGeom indicated by the index.
Definition at line 204 of file KeosMesh.cpp.
References m_MeshGeomList.
Referenced by GetMeshGeom().
Gets a MeshGeom by name.
Definition at line 197 of file KeosMesh.cpp.
References _GetMeshGeomIndex(), and GetMeshGeom().
Gets the index of a MeshGeom with a given name.
Definition at line 211 of file KeosMesh.cpp.
References m_MeshGeomNameMap.
Referenced by GetMeshGeom().
| TMaterialList& Keos::CMesh::GetMaterialList | ( | ) | [inline] |
Gets a pointer to the Material indicated by the index.
Definition at line 124 of file KeosMesh.h.
Referenced by Keos::CMeshGeom::AssignMaterialColor().
| size_t Keos::CMesh::GetLastAddedMaterialIndex | ( | void | ) | [inline] |
| size_t Keos::CMesh::GetMaterialsCount | ( | void | ) | [inline] |
Gets the number of materials.
Definition at line 138 of file KeosMesh.h.
Referenced by Keos::CMeshGeom::AssignMaterialColor().
| void Keos::CMesh::AddMaterial | ( | CMaterial * | pMaterial | ) | [inline] |
Add a material.
| pMaterial | Pointer on the material. |
Definition at line 146 of file KeosMesh.h.
Referenced by Keos::CMDLQ1Loader::LoadFromFile(), Keos::CMDLQ1AnimatedLoader::LoadFromFile(), Keos::CMD2Loader::LoadFromFile(), Keos::CMD2AnimatedLoader::LoadFromFile(), Keos::CMeshGen::MakeCube(), and Keos::CMeshGen::MakeSphere().
Add a material and assign it to the MeshGeom specified by the index.
| pMaterial | Pointer on the material. | |
| nMeshGeomIndex | Index of MeshGeom. |
Definition at line 155 of file KeosMesh.h.
friend class CMeshGeom [friend] |
Definition at line 37 of file KeosMesh.h.
CBuffer<CMeshGeom::TVertex> Keos::CMesh::m_SharedVertexBuffer [protected] |
Shared vertex buffer.
Definition at line 165 of file KeosMesh.h.
Referenced by Keos::CMeshGeom::AssignColor(), ComputeNormals(), CreateSharedVertexBuffer(), and Render().
TMaterialList Keos::CMesh::m_MaterialList [protected] |
TMeshGeomList Keos::CMesh::m_MeshGeomList [protected] |
Definition at line 177 of file KeosMesh.h.
Referenced by ComputeNormals(), GetMeshGeom(), GetTrianglesCount(), Render(), and ~CMesh().
TMeshGeomNameMap Keos::CMesh::m_MeshGeomNameMap [protected] |
1.5.1-p1