polyhedron_gl.h

00001 /***************************************************************************
00002  *   Copyright (C) 2007 by Pablo Diaz-Gutierrez   *
00003  *   pablo@ics.uci.edu   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Library General Public License as       *
00007  *   published by the Free Software Foundation; either version 2 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU Library General Public     *
00016  *   License along with this program; if not, write to the                 *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
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__

Generated on Wed Apr 9 19:22:37 2008 for HalfEdge library by  doxygen 1.5.3