// Mesh.h // NKU CSC 480/580 - Kirby // --------------------------------------------------------- // An simple immutable class for representing a mesh, // using a file format simplified from the .X format. // Revised 3/29/06 to add a getBoundingRadius() member. // // Normals are associated with faces, not vertices. // Faces are vectors of indices into the vector of vertices. // --------------------------------------------------------- #ifndef MESH_H #define MESH_H #include "Geometry.h" #include #include using namespace std ; using namespace csc480 ; class Mesh { public: explicit Mesh( ifstream& meshfile ) ; void dump( ostream& out ) const ; // Vertex inspectors int getNumVertices() const { return (int) _vertices.size() ; } const Point3& getVertex( int i ) const { return _vertices.at(i) ; } double getBoundingRadius() const { return _radius ; } // Face inspectors int getNumFaces() const { return (int) _faces.size() ; } const vector& getFace( int j ) const { return _faces.at(j ) ; } const Vector3& getNormal( int j ) const { return _normals.at( j ) ; } // Create an OpenGL display list. int makeDisplayList() const ; private: vector< Point3 > _vertices ; vector< vector > _faces ; vector< Vector3 > _normals ; double _radius ; } ; /* Constructor, dump(), and makeDisplayList() are defined in file Mesh.cpp. */ #endif