XEngine::Geometry Class Reference
[XEngine]
#include <Geometry.h>
Inheritance diagram for XEngine::Geometry:
Detailed Description
- Author:
- Koray Balci
- Version:
- 1.0
- Date:
- May 2003
IMesh objects are created and stored inside IModelLoader (or derived) instances, and stored in MeshManager class.
Here is a typical usage in IModelLoader;
IndexedFaceSet* m_pMesh = new IndexedFaceSet("TestMesh"); // Create an instance (IndexedFaceSet IS-A IMesh) // Set a unique name in ctor m_pMesh->setVertices(m_Vertices); // Set the vertices and others.. m_pMesh->setIndices(m_Indices); // Set the indices m_pMesh->createMesh(); // You SHOULD call this one to get normals correctly! // MeshManager is a singleton class. MeshManager::getInstance()->registerMesh(m_pMesh); // Add the mesh to MeshManager
Then when you need to use that mesh in a different place (e.g. in Renderer);
const IndexedGFaceSet* test = MeshManager::getInstance()->getMesh("TestMesh");
- Note:
- Texture coordinates, normals and vertices are stored in seperate arrays. Maybe we can consider using a single array (interleaved) later on. And also currently only one texture layer is supported. For multitexturing we might add more arrays for texture coordinates in the future versions.
Public Member Functions | |
virtual Geometry & | copyFrom (const Geometry &rhs) |
virtual void | setVertices (const Vector3 *pVert, unsigned int size) |
virtual void | setVertices (const std::vector< Vector3 > &vertices) |
virtual void | setNormals (const std::vector< Vector3 > &normals) |
virtual void | setNormals (const Vector3 *pNorm, unsigned int size) |
virtual void | setTexCoords (const Vertex2D *pTex, unsigned int size) |
virtual void | setTexCoords (const std::vector< Vertex2D > &texCoords) |
const std::vector< Vector3 > & | getVertices () const |
Accessor for vertices (x, y, z). | |
const std::vector< Vector3 > & | getNormals () const |
Accessor for normals. | |
const std::vector< Vertex2D > & | getTexCoords () const |
Accessor for texture coordinates. | |
size_t | getVertexCount () const |
Accessor for vertex count. | |
Static Public Member Functions | |
static Vector3 | computeFaceNormal (const Vector3 &p1, const Vector3 &p2, const Vector3 &p3) |
Member Function Documentation
|
Computes the facenormal by crossing two vectors defined by (p2-p1) and (p3-p1). The parameters are assumed to be passed in counter-clockwise order. |
|
We do NOT override the = operator but implement a new method, because in some cases, we only want to copy the data, not the name of the Geometry. |
|
|
|
Vertex normals are set through here. |
|
Texture coordinates are set through here. |
|
Texture coordinates are set through here. |
|
Vertices are set through here. Reimplemented in XEngine::DeformableGeometry. |
|
|
The documentation for this class was generated from the following files:
- Geometry.h
- Geometry.cpp
Generated on Mon Aug 28 15:39:25 2006 for Xface Core Library by 1.4.6-NO