#include <PolygonalMesh.h>
Its primary purpose is for loading geometry from files, which can then be used for visualization or collision detection. For example, the following lines load a mesh from a Wavefront OBJ file, then create a DecorativeMesh from it.
PolygonalMesh mesh; std::ifstream file; file.open("teapot.obj"); mesh.loadObjFile(file); file.close(); DecorativeMesh decoration(mesh);
Public Member Functions | |
PolygonalMesh () | |
Create a PolygonalMesh, which initially contains no vertices or faces. | |
PolygonalMesh (const PolygonalMesh ©) | |
PolygonalMesh & | operator= (const PolygonalMesh ©) |
~PolygonalMesh () | |
int | getNumFaces () const |
Get the number of faces in the mesh. | |
int | getNumVertices () const |
Get the number of vertices in the mesh. | |
const Vec3 & | getVertexPosition (int vertex) const |
Get the position of a vertex in the mesh. | |
int | getNumVerticesForFace (int face) const |
Get the number of vertices that make up a face. | |
int | getFaceVertex (int face, int vertex) const |
Get the index of one of the vertices of a face. | |
int | addVertex (const Vec3 &position) |
Add a vertex to the mesh. | |
int | addFace (const std::vector< int > &vertices) |
Add a face to the mesh. | |
void | scaleMesh (Real scale) |
Scale a mesh by multiplying every vertex by a fix value. | |
void | transformMesh (const Transform &transform) |
Transform a mesh by applying a Transform to every vertex. | |
void | loadObjFile (std::istream &file) |
Load a Wavefront OBJ file, adding the vertices and faces it contains to this mesh. | |
const PolygonalMeshImpl & | getImpl () const |
PolygonalMeshImpl & | updImpl () |
PolygonalMesh | ( | ) |
Create a PolygonalMesh, which initially contains no vertices or faces.
PolygonalMesh | ( | const PolygonalMesh & | copy | ) |
~PolygonalMesh | ( | ) |
PolygonalMesh& operator= | ( | const PolygonalMesh & | copy | ) |
int getNumFaces | ( | ) | const |
Get the number of faces in the mesh.
int getNumVertices | ( | ) | const |
Get the number of vertices in the mesh.
const Vec3& getVertexPosition | ( | int | vertex | ) | const |
Get the position of a vertex in the mesh.
vertex | the index of the vertex to get |
int getNumVerticesForFace | ( | int | face | ) | const |
Get the number of vertices that make up a face.
face | the index of the face |
int getFaceVertex | ( | int | face, | |
int | vertex | |||
) | const |
Get the index of one of the vertices of a face.
face | the index of the face | |
vertex | the index of the vertex within the face (from 0, 1, or 2 for a triangular face, etc.) |
int addVertex | ( | const Vec3 & | position | ) |
Add a vertex to the mesh.
position | the position of the vertex to add |
int addFace | ( | const std::vector< int > & | vertices | ) |
Add a face to the mesh.
vertices | the indices of the vertices which make up the new face |
void scaleMesh | ( | Real | scale | ) |
Scale a mesh by multiplying every vertex by a fix value.
void transformMesh | ( | const Transform & | transform | ) |
void loadObjFile | ( | std::istream & | file | ) |
Load a Wavefront OBJ file, adding the vertices and faces it contains to this mesh.
file | an input stream from which to load the file contents |
const PolygonalMeshImpl& getImpl | ( | ) | const |
PolygonalMeshImpl& updImpl | ( | ) |