00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __MESH_H__
00013 #define __MESH_H__
00014
00015 #include "Geometry.h"
00016 #include "Vector3.h"
00017 #include "Matrix4x4.h"
00018 #include <vector>
00019
00020
00021 class Mesh : public Geometry
00022 {
00023 public:
00024 enum SHADING {SMOOTH_SHADING, FLAT_SHADING};
00025 protected:
00027 virtual bool addVertex(const Vector3<float>& v, unsigned int &indx) = 0;
00028
00029
00030 virtual bool findNeighbourTriangles(const unsigned int vertexIndex, std::vector<unsigned int>& foundTriangles) const = 0;
00031
00032 SHADING mShadingFlag;
00033 public:
00034 Mesh() : mShadingFlag(SMOOTH_SHADING) { }
00035 ~Mesh() { }
00036
00038 virtual bool addTriangle(const Vector3<float> &v1, const Vector3<float> &v2, const Vector3<float> & v3) = 0;
00039
00041 virtual float area() const;
00043 virtual float volume() const;
00044
00046 virtual int genus() const;
00047
00049 static float triArea(const Vector3<float> &v1, const Vector3<float> &v2, const Vector3<float> & v3);
00050 virtual float curvature(const unsigned int vertexIndex, const Vector3<float>& n) = 0;
00051
00053 virtual void calculateFaceNormals();
00054 virtual void calculateVertexNormals();
00055
00057 virtual void draw() = 0;
00058 void setShadingFlag(SHADING s);
00059 SHADING getShadingFlag() const;
00060 };
00061
00062
00063 #endif