00001
00002
00004
00005 #ifndef MESHMESHDATA_H
00006 #define MESHMESHDATA_H
00007
00008 #include "X3DTypes.h"
00009 #include "TypeList.h"
00010 #include "MESH_SFFace.h"
00011
00012 #include <map>
00013
00014 namespace X3DTK {
00015 namespace MESH {
00016
00019
00020 struct VertexPointData
00021 {
00023 void setPoint(const SFPoint3f &point) {_point = point;};
00025 inline const SFPoint3f &getPoint() const {return _point;};
00026
00027 private:
00028 SFPoint3f _point;
00029 };
00030
00033
00034 struct VertexNormalData
00035 {
00037 template<class FData, class VData, class EData>
00038 void setNormalOfFace(const SFVec3f &normal, SFFace<FData, VData, EData> *face);
00040 template<class FData, class VData, class EData>
00041 const SFVec3f &getNormalOfFace(SFFace<FData, VData, EData> *face) const;
00042
00043 private:
00044 MFVec3f _normalArray;
00045 std::map<void *, unsigned short> _normalMap;
00046 };
00047
00048 struct VertexColorData
00049 {
00051 template<class FData, class VData, class EData>
00052 void setColorOfFace(const SFColorRGBA &color, SFFace<FData, VData, EData> *face);
00054 template<class FData, class VData, class EData>
00055 const SFColorRGBA &getColorOfFace(SFFace<FData, VData, EData> *face) const;
00056
00057 private:
00058 MFColorRGBA _colorArray;
00059 std::map<void *, unsigned short> _colorMap;
00060 };
00061
00062 struct VertexTexCoordData
00063 {
00065 template<class FData, class VData, class EData>
00066 void setTexCoordOfFace(const SFVec2f &texCoord, SFFace<FData, VData, EData> *face);
00068 template<class FData, class VData, class EData>
00069 const SFVec2f &getTexCoordOfFace(SFFace<FData, VData, EData> *face) const;
00070
00071 private:
00072 MFVec2f _texCoordArray;
00073 std::map<void *, unsigned short> _texCoordMap;
00074 };
00075
00078
00079 struct FaceNormalData
00080 {
00082 void setNormal(const SFVec3f &normal) {_normal = normal;};
00084 inline const SFVec3f &getNormal() const {return _normal;};
00085
00086 private:
00087 SFVec3f _normal;
00088 };
00089
00090 struct FaceColorData
00091 {
00093 void setColor(const SFColorRGBA &color) {_color = color;};
00095 inline const SFColorRGBA &getColor() const {return _color;};
00096
00097 private:
00098 SFColorRGBA _color;
00099 };
00100
00103
00104 struct MeshNormalData
00105 {
00107 void setNormal(bool value) {_normal = value;};
00109 void setNormalPerVertex(bool value) {_normalPerVertex = value;};
00110
00112 inline bool hasNormal() const {return _normal;};
00114 inline bool getNormalPerVertex() const {return _normalPerVertex;};
00115
00116 private:
00117 bool _normal;
00118 bool _normalPerVertex;
00119 };
00120
00121 struct MeshColorData
00122 {
00124 void setColor(bool value) {_color = value;};
00126 void setColorPerVertex(bool value) {_colorPerVertex = value;};
00127
00129 inline bool hasColor() const {return _color;};
00131 inline bool getColorPerVertex() const {return _colorPerVertex;};
00132
00133 private:
00134 bool _color;
00135 bool _colorPerVertex;
00136 };
00137
00138 struct MeshTexCoordData
00139 {
00141 void setTexCoord(bool value) {_texCoord = value;};
00143 inline bool hasTexCoord() const {return _texCoord;};
00144
00145 private:
00146 bool _texCoord;
00147 };
00148
00149 typedef clist<tlist<VertexPointData, tlist<VertexNormalData, tlist<VertexColorData, tlist<VertexTexCoordData> > > > > VertexData;
00150 typedef nil EdgeData;
00151 typedef clist<tlist<FaceNormalData, tlist<FaceColorData> > > FaceData;
00152 typedef clist<tlist<MeshNormalData, tlist<MeshColorData, tlist<MeshTexCoordData> > > > MeshData;
00153
00154 }
00155 }
00156
00157 #include "MESH_MeshData.inl"
00158
00159 #endif