![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsMeshModel.hpp 00003 00004 A Base (Abstract) Mesh Model for polygonal mesh model 00005 00006 SUKITTI PUNAK (11/02/2004) 00007 ******************************************************************************/ 00008 #ifndef TAPs_MESH_MODEL_HPP 00009 #define TAPs_MESH_MODEL_HPP 00010 00011 #include "TAPsOpenGLModel.hpp" 00012 #include <vector> 00013 00014 #if ( defined TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES || defined TAPs_ENABLE_VERTEX_TEXTURE_COORDINATES ) 00015 #include "../DataStructure/TAPsFlag.hpp" 00016 #endif 00017 00018 //#include "../GeometricDataStructure/TAPsVertex.hpp" 00019 //#include "../GeometricDataStructure/TAPsXVertex.hpp" 00020 //#include "../GeometricDataStructure/TAPsFace.hpp" 00021 00022 //class ReadTAPsFile; 00023 BEGIN_NAMESPACE_TAPs__OpenGL 00024 //============================================================================= 00025 template <typename T> 00026 class MeshModel : public /*virtual*/ OpenGLModel<T> { 00027 friend class ReadTAPsFile; 00028 //----------------------------------------------------------------------------- 00029 // Member Functions ----------------------------------------------------------- 00030 public: 00031 //------------------------------------------------------------------------- 00032 // default constructor 00033 MeshModel (); 00034 //------------------------------------------------------------------------- 00035 // destructor 00036 virtual ~MeshModel (); 00037 //------------------------------------------------------------------------- 00038 // Get/Set Fn(s) 00039 inline int GetNumVertices() const; 00040 inline int GetNumFaces() const; 00041 inline int GetNumTexCoords() const; 00042 inline int GetNoVertices() const { return GetNumVertices(); } 00043 inline int GetNoFaces() const { return GetNumFaces(); } 00044 inline int GetNoTexCoords() const { return GetNumTexCoords(); } 00045 00046 inline virtual void SetNumVertices( int n ); 00047 inline virtual void SetNumFaces( int n ); 00048 inline virtual void SetNumTexCoords( int n ); 00049 inline virtual void SetNoVertices( int n ) { SetNumVertices( n ); } 00050 inline virtual void SetNoFaces( int n ) { SetNumFaces( n ); } 00051 inline virtual void SetNoTexCoords( int n ) { SetNumTexCoords(n ); } 00052 00053 00054 #ifdef TAPs_ENABLE_FACE_VERTEX_COLOR 00055 00058 inline int GetDimensionOfVertexColors () const; 00059 00063 inline int GetNumVetexColors () const; 00064 inline int GetNoVetexColors () const { return GetNumVetexColors(); } 00065 00074 inline void SetNumVetexColors ( int n, int dimension ); 00075 inline void SetNoVetexColors ( int n, int dimension ) { SetNumVetexColors( n, int dimension ); } 00076 00080 //template< typename T2 > 00081 //inline void GetVertexColor( int n, T2 vertexColor[] ) const; 00082 template< typename T2 > inline void GetVertexColor( int n, T2 *r ) const; 00083 template< typename T2 > inline void GetVertexColor( int n, T2 *r, T2 *g ) const; 00084 template< typename T2 > inline void GetVertexColor( int n, T2 *r, T2 *g, T2 *b ) const; 00085 template< typename T2 > inline void GetVertexColor( int n, T2 *r, T2 *g, T2 *b, T2 *a ) const; 00086 00090 //template< typename T2 > 00091 //inline void SetVertexColor( int n, T2 vertexColor[] ); 00092 template< typename T2 > inline void SetVertexColor( int n, T2 *r ); 00093 template< typename T2 > inline void SetVertexColor( int n, T2 *r, T2 *g ); 00094 template< typename T2 > inline void SetVertexColor( int n, T2 *r, T2 *g, T2 *b ); 00095 template< typename T2 > inline void SetVertexColor( int n, T2 *r, T2 *g, T2 *b, T2 *a ); 00096 #endif//TAPs_ENABLE_FACE_VERTEX_COLOR 00097 00098 00099 #ifdef TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES 00100 00103 inline int GetDimensionOfVertexTextures () const; 00104 00108 inline int GetNumVetexTextures () const; 00109 inline int GetNoVetexTextures () const { return GetNumVetexTextures(); } 00110 00119 inline void SetNumVetexTextures ( int n, int dimension ); 00120 inline void SetNoVetexTextures ( int n, int dimension ) { SetNumVetexTextures( n, int dimension ); } 00121 00125 //template< typename T2 > 00126 //inline void GetVertexTexture( int n, T2 vertexTexture[] ) const; 00127 template< typename T2 > inline void GetVertexTexture( int n, T2 *s ) const; 00128 template< typename T2 > inline void GetVertexTexture( int n, T2 *s, T2 *t ) const; 00129 template< typename T2 > inline void GetVertexTexture( int n, T2 *s, T2 *t, T2 *r ) const; 00130 template< typename T2 > inline void GetVertexTexture( int n, T2 *s, T2 *t, T2 *r, T2 *q ) const; 00131 00135 //template< typename T2 > 00136 //inline void SetVertexTexture( int n, T2 vertexTexture[] ); 00137 template< typename T2 > inline void SetVertexTexture( int n, T2 *s ); 00138 template< typename T2 > inline void SetVertexTexture( int n, T2 *s, T2 *t ); 00139 template< typename T2 > inline void SetVertexTexture( int n, T2 *s, T2 *t, T2 *r ); 00140 template< typename T2 > inline void SetVertexTexture( int n, T2 *s, T2 *t, T2 *r, T2 *q ); 00141 #endif//TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES 00142 00143 00144 //----------------------------------------------------------------------------- 00145 // Data Members -------------------------------------------------------------- 00146 protected: 00147 int m_iNoVertices; 00148 int m_iNoFaces; 00149 int m_iNoTexCoords; 00150 00151 inline void Init (); 00152 00153 #ifdef TAPs_ENABLE_FACE_VERTEX_COLOR 00154 unsigned char m_ucDimOfVertexColor; 00155 std::vector<T> m_svVertexColors; 00156 #endif//TAPs_ENABLE_FACE_VERTEX_COLOR 00157 00158 #ifdef TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES 00159 unsigned char m_ucDimOfVertexTexture; 00160 std::vector<T> m_svVertexTextures; 00161 #endif//TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES 00162 00163 #if ( defined TAPs_ENABLE_FACE_VERTEX_TEXTURE_COORDINATES || defined TAPs_ENABLE_VERTEX_TEXTURE_COORDINATES ) 00164 TAPs::DS::Flag< TAPs::Enum::Render::TextureMapping, 16 > m_FlagsForTextureMapping; 00165 #endif 00166 00167 }; 00168 //============================================================================= 00169 END_NAMESPACE_TAPs__OpenGL 00170 //----------------------------------------------------------------------------- 00171 #include "TAPsMeshModel.cpp" 00172 //----------------------------------------------------------------------------- 00173 #endif 00174 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00175 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----