00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __POLYHEDRON_GL__
00022 #define __POLYHEDRON_GL__
00023
00024 #include "polyhedron.h"
00025
00026 namespace HE
00027 {
00034 class Polyhedron_GL
00035 {
00036 public:
00041 Polyhedron_GL(const Polyhedron* p);
00042
00046 void drawBoundingBox() const;
00047
00051 void drawVertices() const;
00052
00056 void drawCentroids() const;
00057
00061 void drawEdges() const;
00062
00066 void drawHoles() const;
00067
00077 void drawFaces(bool flat=false, bool faceColors=false) const;
00078
00089 void drawFaces(const std::map<const Face*,Geometry::Vector3Df>& fnormals, bool faceColors=false) const;
00090
00100 void drawFacesWithColors(const std::map<const Vertex*,Geometry::Vector3Df>& vcolors, bool flat=false) const;
00101
00109 void drawFacesWithTexture(const std::map<const Vertex*,Geometry::Vector3Df>& tCoords, bool flat=false) const;
00110
00120 void drawTriangles(bool flat=false, bool faceColors=false) const;
00121
00126 void drawNormals() const;
00127
00132 void drawFaceNormals() const;
00133
00139 void drawFaceNormals(const std::map<const Face*,Geometry::Vector3Df>& fn) const;
00140
00145 void recomputeNormals();
00146
00150 void recomputeCentroids();
00151
00155 void recomputeColors();
00156
00160 void recomputeBoundingBox();
00161
00166 float normalLen() const { return _normalLen; }
00167
00172 void normalLen(float l) { _normalLen = l; }
00173
00174 protected:
00175 const Polyhedron* _poly;
00176 std::map<const Vertex*,Geometry::Vector3Df> _vNormals;
00177 std::map<const Face*,Geometry::Vector3Df> _fNormals;
00178 std::map<const Face*,Geometry::Vector3Df> _centroids;
00179 std::map<const Face*,Geometry::Vector3Df> _randomColors;
00180 float _normalLen;
00181 Geometry::Vector3Df _bbox[2];
00182 };
00183 };
00184
00185 #endif // __POLYHEDRON_GL__