TAPs 0.7.7.3
TAPsOpenGLVolPresPolygonalModel.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsOpenGLVolPresPolygonalModel.hpp
00003 
00004 Class TAPsOpenGLVolPresPolygonalModel is for a deformable mesh model with 
00005 volume preservation.
00006 
00007 SUKITTI PUNAK   (11/11/2004)
00008 UPDATE          (11/15/2004)
00009 ******************************************************************************/
00010 #ifndef TAPs_OPENGL_VOL_PRES_POLYGONAL_MODEL_HPP
00011 #define TAPs_OPENGL_VOL_PRES_POLYGONAL_MODEL_HPP
00012 
00013 #include "TAPsVolPresPolygonalModel.hpp"
00014 
00015 BEGIN_NAMESPACE_TAPs__OpenGL
00016 //=============================================================================
00017 template <typename T>
00018 class OpenGLVolPresPolygonalModel : public /*virtual*/ VolPresPolygonalModel<T> {
00019     //-------------------------------------------------------------------------
00020     // put it through ostream
00021     friend std::ostream & operator<< ( std::ostream &output, OpenGLVolPresPolygonalModel<T> const &o )
00022     {
00023         output  << "\n======================\n"
00024                 <<   "TAPs::OpenGL::OpenGLVolPresPolygonalModel<"
00025                 << typeid(T).name() << "> Class\n"
00026                 <<   "======================\n";
00027         //----------------------------------------------------------------
00028         // Material Node from OpenGLSupport
00029         output  << "\nMaterial Node" << "\n{\n" << o.material << "\n}";
00030         //----------------------------------------------------------------
00031         // Nodes from XPolygonalModel<T>
00032         output  << "\n\nVertices " << o.m_iNoVertices << "\n{";
00033         for ( int i = 0; i < o.m_iNoVertices; ++i ) {
00034             output << "\n  #" << i << "\t" << o.m_prXVertex[i];
00035         }
00036         output  << "\n}";
00037         //----------------------------------------------------------------
00038         // Neighbor vertex ring#1
00039         if ( o.m_pviVertexRing1List ) {
00040             std::vector<int>::const_iterator iterator;
00041             output  << "\n\nVertexRing1 " << o.m_iNoVertices << "\n{";
00042             for ( int i = 0; i < o.m_iNoVertices; ++i ) {
00043                 output << "\n  #" << i;
00044                 for (   iterator = o.m_pviVertexRing1List[i].begin(); 
00045                         iterator != o.m_pviVertexRing1List[i].end();
00046                         ++iterator )
00047                 {
00048                     output << "\t" << *iterator;
00049                 }
00050             }
00051             output  << "\n}";
00052         }
00053         //----------------------------------------------------------------
00054         // Faces Node
00055         output  << "\n\nFaces " << o.m_iNoFaces  << "\n{";
00056         for ( int i = 0; i < o.m_iNoFaces; ++i ) {
00057             output << "\n  #" << i << "\t" << o.m_prFace[i];
00058         }
00059         output  << "\n}";
00060         return output;
00061     }
00062 //-----------------------------------------------------------------------------
00063 // Member Functions  -----------------------------------------------------------
00064 public:
00065     //-------------------------------------------------------------------------
00066     // default constructor
00067     OpenGLVolPresPolygonalModel();
00068     //-------------------------------------------------------------------------
00069     // destructor
00070     virtual ~OpenGLVolPresPolygonalModel();
00071     //-------------------------------------------------------------------------
00072     //void DisplayGL()
00073     //virtual void DisplayGL ( OpenGL::Enum::DrawMode DM = OpenGL::Enum::POLYGON );
00074     void DisplayGLText ( T x = 0, T y = 0, T z = 0 );
00075 protected:
00076     //-------------------------------------------------------------------------
00077     // void DrawGL()
00078     virtual void DrawGL ( GLenum );
00079 
00080     //-------------------------------------------------------------------------
00081     // For Simulation
00082     void DisplayGL_VertexRings ();
00083     void DisplayGL_ParticleNormals ();
00084     void DisplayGL_DeformedFaceNo ();
00085 public:
00086     void ToggleSimulation ()    { bRunSimulation = !bRunSimulation; }
00087     void ToggleShowVertexNormals () { bFlagShowVertexNormals = !bFlagShowVertexNormals; }
00088     void ToggleShowVertexRings ()   { bFlagShowVertexRings = !bFlagShowVertexRings; }
00089     void ToggleShowDeformedFace ()  { bFlagShowDeformedFace = !bFlagShowDeformedFace; }
00090     void SetShowVertexNormals ( bool b )    { bFlagShowVertexNormals = b; }
00091     void SetShowVertexRings ( bool b )      { bFlagShowVertexRings = b; }
00092     void SetShowDeformedFace ( bool b )     { bFlagShowDeformedFace = b; }
00093     //--------------------------------------------------------------------------
00094 // Data Members
00095 protected:
00096     bool bRunSimulation;
00097     bool bFlagShowVertexNormals;
00098     bool bFlagShowVertexRings;
00099     bool bFlagShowDeformedFace;
00100 //-----------------------------------------------------------------------------
00101 };
00102 //=============================================================================
00103 END_NAMESPACE_TAPs__OpenGL
00104 //-----------------------------------------------------------------------------
00105 // Include definition if TAPs_USE_EXPORT is not defined
00106 //#if !defined( TAPs_USE_EXPORT )
00107     #include "TAPsOpenGLVolPresPolygonalModel.cpp"
00108 //#endif
00109 //-----------------------------------------------------------------------------
00110 #endif
00111 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00112 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines