![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsOpenGLHalfEdgeModel.hpp 00003 00004 Class OpenGLHalfEdgeModel is for creating an OpenGL Polygonal Model using 00005 half-edge data structure. 00006 00007 See class HalfEdgeModel (in "../OpenGLModel/TAPsHalfEdgeModel.hpp") and 00008 class OpenGLSupport ("../OpenGL/TAPsOpenGLSupport.hpp") for details. 00009 00010 SUKITTI PUNAK (04/05/2005) 00011 UPDATE (05/01/2006) 00012 ******************************************************************************/ 00013 #ifndef TAPs_OPENGL_HALF_EDGE_MODEL_HPP 00014 #define TAPs_OPENGL_HALF_EDGE_MODEL_HPP 00015 00016 #include "TAPsHalfEdgeModel.hpp" 00017 00018 BEGIN_NAMESPACE_TAPs__OpenGL 00019 //============================================================================= 00020 template <typename T> 00021 class OpenGLHalfEdgeModel : public /*virtual*/ HalfEdgeModel<T> { 00022 //------------------------------------------------------------------------- 00023 // put it through ostream 00024 friend std::ostream & operator<< ( std::ostream &output, OpenGLHalfEdgeModel<T> const &o ) 00025 { 00026 output << "\n======================\n" 00027 << "TAPs::OpenGL::OpenGLHalfEdgeModel<" 00028 << typeid(T).name() << "> Class\n" 00029 << "======================\n"; 00030 //---------------------------------------------------------------- 00031 /* 00032 // Material Node from OpenGLSupport 00033 output << "\nMaterial Node" << "\n{\n" << o.material << "\n}"; 00034 //---------------------------------------------------------------- 00035 // Nodes from XPolygonalModel<T> 00036 output << "\n\nVertices " << o.m_iNoVertices << "\n{"; 00037 for ( int i = 0; i < o.m_iNoVertices; ++i ) { 00038 output << "\n #" << i << "\t" << o.m_prXVertex[i]; 00039 } 00040 output << "\n}"; 00041 //---------------------------------------------------------------- 00042 // Neighbor vertex ring#1 00043 if ( o.m_pviVertexRing1List ) { 00044 std::vector<int>::const_iterator iterator; 00045 output << "\n\nVertexRing1 " << o.m_iNoVertices << "\n{"; 00046 for ( int i = 0; i < o.m_iNoVertices; ++i ) { 00047 output << "\n #" << i; 00048 for ( iterator = o.m_pviVertexRing1List[i].begin(); 00049 iterator != o.m_pviVertexRing1List[i].end(); 00050 ++iterator ) 00051 { 00052 output << "\t" << *iterator; 00053 } 00054 } 00055 output << "\n}"; 00056 } 00057 //---------------------------------------------------------------- 00058 // Faces Node 00059 output << "\n\nFaces " << o.m_iNoFaces << "\n{"; 00060 for ( int i = 0; i < o.m_iNoFaces; ++i ) { 00061 output << "\n #" << i << "\t" << o.m_prFace[i]; 00062 } 00063 output << "\n}"; 00064 */ 00065 return output; 00066 } 00067 //----------------------------------------------------------------------------- 00068 // Member Functions ----------------------------------------------------------- 00069 public: 00070 //------------------------------------------------------------------------- 00071 // default constructor 00072 OpenGLHalfEdgeModel(); 00073 //------------------------------------------------------------------------- 00074 // destructor 00075 virtual ~OpenGLHalfEdgeModel(); 00076 //------------------------------------------------------------------------- 00077 //void DisplayGL() 00078 //virtual void DisplayGL( OpenGL::Enum::DrawMode DM = OpenGL::Enum::POLYGON ); 00079 virtual inline void ToggleDisplayVertexNormals () 00080 { 00081 if ( !bIsDisplayVertexNormals ) { 00082 bIsDisplayVertexNormals = !bIsDisplayVertexNormals; 00083 } 00084 ++gCount; 00085 } 00086 int gCount; 00087 //------------------------------------------------------------------------- 00088 // Draw by OpenGL 00089 void DrawVertexNormals (); 00090 void DrawHalfEdgeByNextPtrs (); 00091 void DrawHalfEdgeByPrevPtrs (); 00092 void DrawHalfEdgePairs ( const HEHalfEdge<T> * pHalfEdge, Vector3<T> & color1, Vector3<T> & color2 ); 00093 00094 #ifdef TAPs_ADVANCED_SIMULATION 00095 void DrawVertexSimulationStatus (); 00096 #else //TAPs_ADVANCED_SIMULATION 00097 void DrawVertexSimulationStatus () {} 00098 #endif//TAPs_ADVANCED_SIMULATION 00099 00100 #ifdef TAPs_ENABLE_FACE_VERTEX_COLOR 00101 virtual bool EnableVertexColors ( bool b ); 00102 #endif//TAPs_ENABLE_FACE_VERTEX_COLOR 00103 00104 protected: 00105 //------------------------------------------------------------------------- 00106 // Helper Fn 00107 // void DrawGL() 00108 virtual void DrawGL( GLenum ); 00109 00110 #ifdef TAPs_ENABLE_FACE_VERTEX_COLOR 00111 virtual void DrawGLWithFaceVertexColor_RGB ( GLenum ); 00112 virtual void DrawGLWithFaceVertexColor_RGBA ( GLenum ); 00113 #endif//TAPs_ENABLE_FACE_VERTEX_COLOR 00114 00115 // Render by GLSL ------------------------------------------------------------- 00116 #ifdef TAPs_RENDER_BY_GLSL_DS_FACE_VERTEX 00117 virtual void DrawGLSLWithDSFaceVertex_RGB ( GLenum ); 00118 virtual void DrawGLSLWithDSFaceVertex_RGBA ( GLenum ); 00119 #endif//TAPs_RENDER_BY_GLSL_DS_FACE_VERTEX 00120 // ---------------------------------------------------------------------------- 00121 00122 //----------------------------------------------------------------------------- 00123 // Data Members --------------------------------------------------------------- 00124 protected: 00125 bool bIsDisplayVertexNormals; 00126 }; // CLASS END: OpenGLHalfEdgeModel ******************************************* 00127 //============================================================================= 00128 END_NAMESPACE_TAPs__OpenGL 00129 //----------------------------------------------------------------------------- 00130 // Include definition if TAPs_USE_EXPORT is not defined 00131 //#if !defined( TAPs_USE_EXPORT ) 00132 #include "TAPsOpenGLHalfEdgeModel.cpp" 00133 //#endif 00134 //----------------------------------------------------------------------------- 00135 #endif 00136 //345678901234567890123456789012345678901234567890123456789012345678901234567890 00137 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8