00001
00002
00004
00005 #ifndef MESH_MESH_H
00006 #define MESH_MESH_H
00007
00008 #include "MeshSceneGraphTypes.h"
00009 #include "MESH_TemplateMesh.h"
00010
00011 namespace X3DTK {
00012 namespace MESH {
00013
00015
00016 class VertexData;
00017 class EdgeData;
00018 class FaceData;
00019
00020 class VertexFData
00021 {
00022 public:
00024 VertexFData();
00025
00027 void setNormal(const SFVec3f &normal);
00029 void setColor(const SFColorRGBA &color);
00031 void setTexCoord(const SFVec2f &texCoord);
00032
00034 inline const SFVec3f &getNormal() const {return _normal;};
00036 inline const SFColorRGBA &getColor() const {return _color;};
00038 inline const SFVec2f &getTexCoord() const {return _texCoord;};
00039
00040 private:
00041 SFVec3f _normal;
00042 SFColorRGBA _color;
00043 SFVec2f _texCoord;
00044 };
00045
00047
00048 class VertexData
00049 {
00050 public:
00052 VertexData();
00054 ~VertexData();
00055
00057 void setPoint(const SFPoint3f &point);
00059 void addFaceData(TemplateFace<FaceData, VertexData, EdgeData> *face, VertexFData *vdata);
00060
00062 inline const SFPoint3f &getPoint() const {return _point;};
00064 VertexFData *getFaceData(TemplateFace<FaceData, VertexData, EdgeData> *face) const;
00065
00066 private:
00067 SFPoint3f _point;
00068 std::list<std::pair<TemplateFace<FaceData, VertexData, EdgeData> *, VertexFData *> > _FDataList;
00069 };
00070
00072
00073 class EdgeData
00074 {
00075 public:
00077 EdgeData();
00078 };
00079
00081
00082 class FaceData
00083 {
00084 public:
00086 FaceData();
00087
00089 void setNormal(const SFVec3f &normal);
00091 void setColor(const SFColorRGBA &color);
00092
00094 inline const SFVec3f &getNormal() const {return _normal;};
00096 inline const SFColorRGBA &getColor() const {return _color;};
00097
00098 private:
00099 SFVec3f _normal;
00100 SFColorRGBA _color;
00101 };
00102
00104
00105 class MeshData
00106 {
00107 public:
00109 MeshData();
00110
00112 void setVertexNormal(bool vertexNormal);
00114 void setVertexColor(bool vertexColor);
00116 void setVertexTexCoord(bool vertexTexCoord);
00118 void setFaceNormal(bool faceNormal);
00120 void setFaceColor(bool faceColor);
00121
00123 inline bool hasVertexNormal() const {return _vertexNormal;};
00125 inline bool hasVertexColor() const {return _vertexColor;};
00127 inline bool hasVertexTexCoord() const {return _vertexTexCoord;};
00129 inline bool hasFaceNormal() const {return _faceNormal;};
00131 inline bool hasFaceColor() const {return _faceColor;};
00132
00133 private:
00134 bool _vertexNormal;
00135 bool _vertexColor;
00136 bool _vertexTexCoord;
00137 bool _faceNormal;
00138 bool _faceColor;
00139 };
00140
00141 typedef TemplateMesh<MeshData, VertexData, EdgeData, FaceData> Mesh;
00142
00144
00145 template<>
00146 Mesh::TemplateMesh()
00147 {
00148 defineTypeName("Mesh");
00149 };
00150
00151 }
00152 }
00153
00154 #endif