MultiMeshModel< T > Class Template Reference

#include <TAPsMultiMeshModel.hpp>

Inheritance diagram for MultiMeshModel< T >:

Inheritance graph
[legend]
Collaboration diagram for MultiMeshModel< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void ApplyAndResetTransform ()
virtual void BuildBVHTree (TAPs::Enum::CD treeType)
virtual void CalAndSetPhysicsCenterOfMass ()
virtual void DisplayGL (OpenGL::Enum::DrawMode=OpenGL::Enum::POLYGON)
virtual void DisplayGLUsingColorMaterial (OpenGL::Enum::DrawMode=OpenGL::Enum::POLYGON, OpenGL::Enum::Face=OpenGL::Enum::FRONT)
virtual void DrawBVHOfEachMesh (int startLevel, int endLevel) const
virtual void DrawBVHOfEachMesh () const
virtual void DrawBVHOfEachMeshOnlyEndLevel () const
int GetID () const
std::vector< MeshModel< T > * > & GetModelList ()
std::vector< MeshModel< T >
* > const & 
GetModelList () const
char const *const GetName () const
TransformationSupport< T > & GetTransform ()
TransformationSupport< T > const & GetTransform () const
virtual void Initialize ()
 MultiMeshModel (char *name)
 MultiMeshModel ()
virtual void Reset ()
void SetID (int id)
void SetName (char *name)
virtual ~MultiMeshModel ()

Protected Member Functions

virtual void CalBoundingAABB ()
virtual void CalBoundingEllipsoid ()
virtual void CalBoundingSphere ()

Protected Attributes

int m_iId
char * m_pcName
TransformationSupport< T > m_Transform
std::vector< MeshModel< T > * > m_vModelPtrList

Static Protected Attributes

static int m_iTotal = 0


Detailed Description

template<typename T>
class MultiMeshModel< T >

Definition at line 26 of file TAPsMultiMeshModel.hpp.


Constructor & Destructor Documentation

template<typename T>
MultiMeshModel< T >::MultiMeshModel (  )  [inline]

Definition at line 24 of file TAPsMultiMeshModel.cpp.

00025     : ColDetSupport<T>(), 
00026       PhysicsSupport<T>(), 
00027       m_iId( m_iTotal++ ), m_pcName( NULL )
00028 {
00029     #ifdef  TAPs_DEBUG_MODE
00030     std::cout   << "MultiMeshModel<" << typeid(T).name() << "> #" << m_iId << " constructor\n";
00031     #endif//TAPs_DEBUG_MODE
00032 }

template<typename T>
MultiMeshModel< T >::MultiMeshModel ( char *  name  )  [inline]

Definition at line 36 of file TAPsMultiMeshModel.cpp.

00037     : //TransformationSupport<T>(), 
00038       m_iId( m_iTotal++ ), m_pcName( NULL )
00039 {
00040     SetName( name );
00041 
00042     #ifdef  TAPs_DEBUG_MODE
00043     std::cout   << "MultiMeshModel<" << typeid(T).name() << "> #" << m_iId << " constructor\n";
00044     #endif//TAPs_DEBUG_MODE
00045 }

template<typename T>
MultiMeshModel< T >::~MultiMeshModel (  )  [inline, virtual]

Definition at line 49 of file TAPsMultiMeshModel.cpp.

00050 {
00051     if ( m_pcName ) {
00052         delete [] m_pcName;
00053         m_pcName = NULL;
00054     }
00055     --m_iTotal;
00056 
00057     #ifdef  TAPs_DEBUG_MODE
00058     std::cout   << "MultiMeshModel<" << typeid(T).name() << "> #" << m_iId << " destructor\n";
00059     #endif//TAPs_DEBUG_MODE
00060 }


Member Function Documentation

template<typename T>
void MultiMeshModel< T >::ApplyAndResetTransform (  )  [inline, virtual]

Definition at line 108 of file TAPsMultiMeshModel.cpp.

00109 {
00110     std::vector< MeshModel<T> * >::iterator pos = m_vModelPtrList.begin();
00111     while ( pos != m_vModelPtrList.end() ) {
00112         assert( *pos != NULL );
00113         (*pos)->GetTransform().SetTranslation( GetTransform().GetTranslation() );
00114 //      (*pos)->GetTransform().SetRotationAngles( GetTransform().GetRotationAngles() );
00115 //      (*pos)->GetTransform().SetScale( GetTransform().GetScale() );
00116         (*pos)->GetTransform().SetMatrixTransform( GetTransform().GetMatrixTransform() );
00117         (*pos)->ApplyAndResetTransform();
00118         ++pos;
00119     }
00120     GetTransform().MakeIdentity();
00121 }

template<typename T>
void MultiMeshModel< T >::BuildBVHTree ( TAPs::Enum::CD  treeType  )  [inline, virtual]

Definition at line 147 of file TAPsMultiMeshModel.cpp.

00148 {
00149     //-----------------------------------------------------
00150     // Check Model Type
00151     for ( int i = 0; i < static_cast<int>( m_vModelPtrList.size() ); ++i ) {
00152         m_vModelPtrList[i]->BuildBVHTree( treeType );
00153     }
00154     //-----------------------------------------------------
00155 }

template<typename T>
virtual void MultiMeshModel< T >::CalAndSetPhysicsCenterOfMass (  )  [inline, virtual]

Calculate and set the center of mass. Inherited from class TransformationSupport.

Implements PhysicsSupport< T >.

Definition at line 41 of file TAPsMultiMeshModel.hpp.

00042     {
00043         std::cout << "MultiMeshModel::CalAndSetPhysicsCenterOfMass() need to be coded!!!\n";
00044         SetPhysicsCenterOfMass( Vector3<T>( 0, 0, 0 ) );
00045     }

template<typename T>
virtual void MultiMeshModel< T >::CalBoundingAABB (  )  [inline, protected, virtual]

Reimplemented from ColDetSupport< T >.

Definition at line 93 of file TAPsMultiMeshModel.hpp.

00093 {};         // AABB for the whole object

template<typename T>
virtual void MultiMeshModel< T >::CalBoundingEllipsoid (  )  [inline, protected, virtual]

Reimplemented from ColDetSupport< T >.

Definition at line 94 of file TAPsMultiMeshModel.hpp.

00094 {}; // Ellipsoid for the whole object

template<typename T>
virtual void MultiMeshModel< T >::CalBoundingSphere (  )  [inline, protected, virtual]

Reimplemented from ColDetSupport< T >.

Definition at line 95 of file TAPsMultiMeshModel.hpp.

00095 {};     // Sphere for the whole object

template<typename T>
void MultiMeshModel< T >::DisplayGL ( OpenGL::Enum::DrawMode  DM = OpenGL::Enum::POLYGON  )  [inline, virtual]

Definition at line 162 of file TAPsMultiMeshModel.cpp.

00163 {
00164     glPushMatrix();
00165     GetTransform().TransformByOpenGLForDrawing();
00166 
00167     std::vector< MeshModel<T> * >::iterator pos = m_vModelPtrList.begin();
00168     while ( pos != m_vModelPtrList.end() ) {
00169         assert( *pos != NULL );
00170         (*pos)->DisplayGL( DM );
00171         ++pos;
00172     }
00173     glPopMatrix();
00174 }

template<typename T>
void MultiMeshModel< T >::DisplayGLUsingColorMaterial ( OpenGL::Enum::DrawMode  DM = OpenGL::Enum::POLYGON,
OpenGL::Enum::Face  F = OpenGL::Enum::FRONT 
) [inline, virtual]

Definition at line 178 of file TAPsMultiMeshModel.cpp.

00181 {
00182     glPushMatrix();
00183     GetTransform().TransformByOpenGLForDrawing();
00184 
00185     glPushAttrib( GL_CURRENT_BIT | GL_LIGHTING_BIT );
00186     //---------------------------------------------------------------
00187     glEnable( GL_COLOR_MATERIAL );
00188 
00189     //glColorMaterial( F, GL_AMBIENT_AND_DIFFUSE );
00190     //glColorMaterial( F, GL_AMBIENT );
00191     glColorMaterial( F, GL_DIFFUSE );
00192     //glColorMaterial( F, GL_SPECULAR );
00193     //glColorMaterial( F, GL_EMISSION );
00194 
00195     static GLfloat specular[4] = { 1, 1, 1, 1 };        //<--------- Hack for Specular Highlight
00196     glMaterialfv( GL_FRONT, GL_SPECULAR, specular );    //<--------- Hack for Specular Highlight
00197 
00198     std::vector< MeshModel<T> * >::iterator pos = m_vModelPtrList.begin();
00199     while ( pos != m_vModelPtrList.end() ) {
00200         assert( *pos != NULL );
00201         (*pos)->GetMaterial()->ApplyRGBAColor();
00202         (*pos)->DisplayGL( DM );
00203         //(*pos)->DrawBVH();
00204         ++pos;
00205     }
00206     //---------------------------------------------------------------
00207     glPopAttrib();
00208     glPopMatrix();
00209 }

template<typename T>
void MultiMeshModel< T >::DrawBVHOfEachMesh ( int  startLevel,
int  endLevel 
) const [inline, virtual]

Definition at line 230 of file TAPsMultiMeshModel.cpp.

00231 {
00232     glPushMatrix();
00233     GetTransform().TransformByOpenGLForDrawing();
00234 
00235     std::vector< MeshModel<T> * >::const_iterator pos = m_vModelPtrList.begin();
00236     while ( pos != m_vModelPtrList.end() ) {
00237         assert( *pos != NULL );
00238         (*pos)->DrawBVH( startLevel, endLevel );
00239         ++pos;
00240     }
00241 
00242     glPopMatrix();
00243 }

template<typename T>
void MultiMeshModel< T >::DrawBVHOfEachMesh (  )  const [inline, virtual]

Draw BVH of each mash

Where 0 level is root level.

Definition at line 213 of file TAPsMultiMeshModel.cpp.

00214 {
00215     glPushMatrix();
00216     GetTransform().TransformByOpenGLForDrawing();
00217 
00218     std::vector< MeshModel<T> * >::const_iterator pos = m_vModelPtrList.begin();
00219     while ( pos != m_vModelPtrList.end() ) {
00220         assert( *pos != NULL );
00221         (*pos)->DrawBVH();
00222         ++pos;
00223     }
00224 
00225     glPopMatrix();
00226 }

template<typename T>
void MultiMeshModel< T >::DrawBVHOfEachMeshOnlyEndLevel (  )  const [inline, virtual]

Definition at line 247 of file TAPsMultiMeshModel.cpp.

00248 {
00249     glPushMatrix();
00250     GetTransform().TransformByOpenGLForDrawing();
00251 
00252     std::vector< MeshModel<T> * >::const_iterator pos = m_vModelPtrList.begin();
00253     while ( pos != m_vModelPtrList.end() ) {
00254         assert( *pos != NULL );
00255         (*pos)->DrawBVHOnlyEndLevel();
00256         ++pos;
00257     }
00258 
00259     glPopMatrix();
00260 }

template<typename T>
int MultiMeshModel< T >::GetID (  )  const [inline]

Definition at line 64 of file TAPsMultiMeshModel.cpp.

00065 {
00066     return m_iId;
00067 }

template<typename T>
std::vector< MeshModel<T> * >& MultiMeshModel< T >::GetModelList (  )  [inline]

Definition at line 65 of file TAPsMultiMeshModel.hpp.

00066         { return m_vModelPtrList; }

template<typename T>
std::vector< MeshModel<T> * > const& MultiMeshModel< T >::GetModelList (  )  const [inline]

Definition at line 63 of file TAPsMultiMeshModel.hpp.

00064         { return m_vModelPtrList; }

template<typename T>
char const *const MultiMeshModel< T >::GetName (  )  const [inline]

Definition at line 76 of file TAPsMultiMeshModel.cpp.

00077 {
00078     return m_pcName;
00079 }

template<typename T>
TransformationSupport<T>& MultiMeshModel< T >::GetTransform (  )  [inline]

Definition at line 59 of file TAPsMultiMeshModel.hpp.

00060         { return m_Transform; }

template<typename T>
TransformationSupport<T> const& MultiMeshModel< T >::GetTransform (  )  const [inline]

Definition at line 57 of file TAPsMultiMeshModel.hpp.

00058         { return m_Transform; }

template<typename T>
void MultiMeshModel< T >::Initialize (  )  [inline, virtual]

Definition at line 94 of file TAPsMultiMeshModel.cpp.

00095 {
00096     std::vector< MeshModel<T> * >::iterator pos = m_vModelPtrList.begin();
00097     while ( pos != m_vModelPtrList.end() ) {
00098         assert( *pos != NULL );
00099         (*pos)->Initialize();
00100         ++pos;
00101     }
00102 }

template<typename T>
virtual void MultiMeshModel< T >::Reset (  )  [inline, virtual]

Definition at line 69 of file TAPsMultiMeshModel.hpp.

00069 {};

template<typename T>
void MultiMeshModel< T >::SetID ( int  id  )  [inline]

Definition at line 70 of file TAPsMultiMeshModel.cpp.

00071 {
00072     m_iId = id;
00073 }

template<typename T>
void MultiMeshModel< T >::SetName ( char *  name  )  [inline]

Definition at line 82 of file TAPsMultiMeshModel.cpp.

00083 {
00084     if ( m_pcName ) {
00085         delete [] m_pcName;
00086         m_pcName = NULL;
00087     }
00088     m_pcName = new char[ strlen(name) + 1 ];
00089     strcpy( m_pcName, name );
00090 }


Member Data Documentation

template<typename T>
int MultiMeshModel< T >::m_iId [protected]

Definition at line 104 of file TAPsMultiMeshModel.hpp.

template<typename T>
BEGIN_NAMESPACE_TAPs__OpenGL int MultiMeshModel< T >::m_iTotal = 0 [inline, static, protected]

Definition at line 103 of file TAPsMultiMeshModel.hpp.

template<typename T>
char* MultiMeshModel< T >::m_pcName [protected]

Definition at line 105 of file TAPsMultiMeshModel.hpp.

template<typename T>
TransformationSupport<T> MultiMeshModel< T >::m_Transform [protected]

Definition at line 111 of file TAPsMultiMeshModel.hpp.

template<typename T>
std::vector< MeshModel<T> * > MultiMeshModel< T >::m_vModelPtrList [protected]

Definition at line 108 of file TAPsMultiMeshModel.hpp.


The documentation for this class was generated from the following files:

Generated on Mon Oct 13 11:45:39 2008 for TAPs by  doxygen 1.5.6