00001 00002 #ifndef __TRIANGLE_H 00003 #define __TRIANGLE_H 00004 00005 #include <ostream> 00006 #include <vector> 00007 00008 #include "MS3D.h" 00009 00010 #include "Vector.h" 00011 #include "Matrix.h" 00012 00013 #include "Vertex.h" 00014 00015 class Model; 00016 00029 class Triangle { 00030 protected: 00032 std::vector<const Vertex*> m_vertices; 00034 Vector m_normal; 00036 std::vector<Vector> m_vertexNormals; 00038 std::vector<Vector> m_textureCoordinates; 00054 std::vector<int> m_edgeIndices; 00055 00102 std::vector<Matrix> m_objectToTangentSpace; 00103 00105 const Model& m_model; 00106 00107 private: 00109 Triangle(const Triangle& copy); 00111 Triangle& operator=(const Triangle& rhs); 00112 00113 public: 00118 Triangle(const MS3DTriangle* const triangle, const Model& model); 00119 00121 const Vertex& getVertex(unsigned int which) const; 00123 const Vector& getNormal() const; 00125 const Vector& getNormal(unsigned int which) const; 00130 const Vector& getTextureCoordinates(unsigned int which) const; 00135 const Matrix& getObjectToTangentSpaceMatrix(unsigned int which) const; 00139 int getEdgeIndex(unsigned int which) const; 00140 00149 bool isFacing(const Vector& point) const; 00150 00155 friend std::ostream& operator<< (std::ostream& out, const Triangle& triangle); 00156 }; 00157 00158 #endif // __TRIANGLE_H