TAPs 0.7.7.3
TAPsOpenGLSpringHalfEdgeModel.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsOpenGLSpringHalfEdgeModel.hpp
00003 
00004 Class OpenGLSpringHalfEdgeModel 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   (02/27/2006)
00011 UPDATE          (04/10/2006)
00012 ******************************************************************************/
00013 #ifndef TAPs_OPENGL_SPRING_HALF_EDGE_MODEL_HPP
00014 #define TAPs_OPENGL_SPRING_HALF_EDGE_MODEL_HPP
00015 
00016 #include "TAPsSpringHalfEdgeModel.hpp"
00017 
00018 BEGIN_NAMESPACE_TAPs__OpenGL
00019 //=============================================================================
00020 template <typename T>
00021 class OpenGLSpringHalfEdgeModel : public /*virtual*/ SpringHalfEdgeModel<T> {
00022     //-------------------------------------------------------------------------
00023     // put it through ostream
00024     friend std::ostream & operator<< ( std::ostream &output, OpenGLSpringHalfEdgeModel<T> const &o )
00025     {
00026         output  << "\n======================\n"
00027                 <<   "TAPs::OpenGL::OpenGLSpringHalfEdgeModel<"
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     // DEBUG
00072     void DrawFromListOfVertex () {
00073         Vector3<T> pos;
00074         glPointSize( 3 );
00075         glBegin( GL_POINTS );
00076         for ( int i = 0; i < GetNoVertices(); ++i ) {
00077             pos = *m_vListOfVertexPositions[i];
00078             glVertex3f ( pos[0], pos[1], pos[2] );
00079         }
00080         glEnd();
00081         glPointSize( 1 );
00082     }
00083 
00084     //-------------------------------------------------------------------------
00085     // default constructor
00086     OpenGLSpringHalfEdgeModel();
00087     //-------------------------------------------------------------------------
00088     // destructor
00089     virtual ~OpenGLSpringHalfEdgeModel();
00090     //-------------------------------------------------------------------------
00091     //void DisplayGL()
00092     //virtual void DisplayGL( OpenGL::Enum::DrawMode DM = OpenGL::Enum::POLYGON );
00093     virtual inline void ToggleDisplayVertexNormals ()
00094     { bIsDisplayVertexNormals = !bIsDisplayVertexNormals; }
00095 
00096     //-------------------------------------------------------------------------
00097 #ifdef  TAPs_ENABLE_FACE_VERTEX_COLOR
00098     virtual bool EnableVertexColors ( bool b );
00099 #endif//TAPs_ENABLE_FACE_VERTEX_COLOR
00100 
00101 #ifdef  TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00102     //virtual bool EnableVertexTextures ( bool b );
00103 #endif//TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00104 
00105 // Render by GLSL -------------------------------------------------------------
00106 #ifdef  TAPs_RENDER_BY_GLSL_DS_FACE_VERTEX
00107     virtual void DrawGLSLWithDSFaceVertex_RGB   ( GLenum );
00108     virtual void DrawGLSLWithDSFaceVertex_RGBA  ( GLenum );
00109 #endif//TAPs_RENDER_BY_GLSL_DS_FACE_VERTEX
00110 // ----------------------------------------------------------------------------
00111 
00112 protected:
00113     //-------------------------------------------------------------------------
00114     // Helper Fn
00115     // void DrawGL()
00116     virtual void DrawGL ( GLenum );
00117 
00118 #ifdef  TAPs_ENABLE_FACE_VERTEX_COLOR
00119     virtual void DrawGLWithFaceVertexColor_RGB  ( GLenum );
00120     virtual void DrawGLWithFaceVertexColor_RGBA ( GLenum );
00121 #endif//TAPs_ENABLE_FACE_VERTEX_COLOR
00122 
00123 #ifdef  TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00124     //virtual void DrawGLWithFaceVertexTexture_S     ( GLenum );
00125     //virtual void DrawGLWithFaceVertexTexture_ST    ( GLenum );
00126     //virtual void DrawGLWithFaceVertexTexture_STR ( GLenum );
00127 #endif//TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES
00128 
00129     //-------------------------------------------------------------------------
00130     // DEBUG
00131     void DrawGLParticleRef ();
00132     //-------------------------------------------------------------------------
00133     // DEBUG
00134     void DrawGLVertexRing1 ();
00135     //-------------------------------------------------------------------------
00136     // DEBUG
00137     void DrawGLSpringConnections ();
00138     //-------------------------------------------------------------------------
00139     // DEBUG
00140     void DrawGLSprings ();
00141     //-------------------------------------------------------------------------
00142 //-----------------------------------------------------------------------------
00143 // Data Members  ---------------------------------------------------------------
00144 protected:
00145     bool bIsDisplayVertexNormals;
00146 }; // CLASS END: OpenGLSpringHalfEdgeModel *******************************************
00147 //=============================================================================
00148 END_NAMESPACE_TAPs__OpenGL
00149 //-----------------------------------------------------------------------------
00150 // Include definition if TAPs_USE_EXPORT is not defined
00151 //#if !defined( TAPs_USE_EXPORT )
00152     #include "TAPsOpenGLSpringHalfEdgeModel.cpp"
00153 //#endif
00154 //-----------------------------------------------------------------------------
00155 #endif
00156 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00157 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines