TAPs 0.7.7.3
TAPsMultiMeshModel.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsMultiMeshModel.hpp
00003 
00004 A collection of mesh models - 
00005 can be any mixing of Polygonal, XPolygonal, and Halfedge Models.
00006 It has a (std::vector) list of model pointers.
00007 
00008 SUKITTI PUNAK   (08/08/2006)
00009 UPDATE          (08/09/2006)
00010 ******************************************************************************/
00011 #ifndef TAPs_MULTI_MESH_MODEL_HPP
00012 #define TAPs_MULTI_MESH_MODEL_HPP
00013 
00014 // These are included in TAPsMeshModel.hpp.
00015 // Inheritance
00016 //#include "../Support/TAPsColDetSupport.hpp"           // Is A
00017 //#include "../Support/TAPsPhysicsSupport.hpp"          // Is A
00018 // Association
00019 //#include "../Support/TAPsTransformationSupport.hpp"   // Has A
00020 #include "TAPsMeshModel.hpp"
00021 
00022 BEGIN_NAMESPACE_TAPs__OpenGL
00023 //=============================================================================
00024 template <typename T>
00025 class MultiMeshModel : public /*virtual*/ ColDetSupport<T>, 
00026                        public /*virtual*/ PhysicsSupport<T> {
00027 //-----------------------------------------------------------------------------
00028 // Member Functions ------------------------------------------------------------
00029 public:
00030     //-------------------------------------------------------------------------
00031     // constructors
00032     MultiMeshModel ();
00033     MultiMeshModel ( char * name );
00034     //-------------------------------------------------------------------------
00035     // destructor
00036     virtual ~MultiMeshModel ();
00037     //-------------------------------------------------------------------------
00040     virtual void CalAndSetPhysicsCenterOfMass ()
00041     {
00042         std::cout << "MultiMeshModel::CalAndSetPhysicsCenterOfMass() need to be coded!!!\n";
00043         SetPhyPropCenterOfMass( 0, 0, 0 );
00044     }
00045     //-------------------------------------------------------------------------
00046 //  // Get Half Length
00047 //  virtual T GetMaxHalfLength () const = 0;    // abstract fn
00048     //-------------------------------------------------------------------------
00049     // Get/Set Fn(s)
00050     inline int  GetID () const;
00051     inline void SetID ( int id );
00052     inline char const * const GetName () const;
00053     inline void SetName ( char * name );
00054     //-------------------------------------------------------------------------
00055     // Get/Set Transformation Fn(s)
00056     TransformationSupport<T> const &    GetTransform () const
00057         { return m_Transform; }
00058     TransformationSupport<T> &          GetTransform ()
00059         { return m_Transform; }
00060     //-------------------------------------------------------------------------
00061     // Get/Set Model List Fn(s)
00062     std::vector< MeshModel<T> * > const &   GetModelList () const
00063         { return m_vModelPtrList; }
00064     std::vector< MeshModel<T> * > &         GetModelList ()
00065         { return m_vModelPtrList; }
00066     //-------------------------------------------------------------------------
00067     // Misc Fn(s)
00068     virtual void Reset () {};
00069     virtual void Initialize ();
00070     virtual void ApplyAndResetTransform ();
00071     //-------------------------------------------------------------------------
00072     // Display By OpenGL
00073     virtual void DisplayGL ( OpenGL::Enum::DrawMode = OpenGL::Enum::POLYGON );
00074     //virtual void DisplayGLUsingColorMaterial ( OpenGL::Enum::DrawMode = OpenGL::Enum::POLYGON );
00075     virtual void DisplayGLUsingColorMaterial ( 
00076         OpenGL::Enum::DrawMode = OpenGL::Enum::POLYGON, 
00077         OpenGL::Enum::Face = OpenGL::Enum::FRONT );
00083     virtual void DrawBVHOfEachMesh () const;
00084     virtual void DrawBVHOfEachMesh ( int startLevel, int endLevel ) const;
00085     virtual void DrawBVHOfEachMeshOnlyEndLevel () const;
00086     //-------------------------------------------------------------------------
00087     // Override Virtual Fns from class ColDetSupport
00088     //-----------------------------------------------------
00089     // Virtual Fns from Collision Detection from ColDetSupport class <-----
00090     // OpenGLModel class
00091 protected:
00092     virtual void CalBoundingAABB () {};         // AABB for the whole object
00093     virtual void CalBoundingEllipsoid () {};    // Ellipsoid for the whole object
00094     virtual void CalBoundingSphere () {};       // Sphere for the whole object
00095 public:
00096     virtual void BuildBVHTree ( TAPs::Enum::CD treeType ); // Create BVHTree
00097 //-----------------------------------------------------------------------------
00098 // Data Members  ---------------------------------------------------------------
00099 protected:
00100     //-------------------------------------------------------------------------
00101     // Model Identification
00102     static int  m_iTotal;       // total number of models
00103     int         m_iId;          // identification number
00104     char *      m_pcName;       // model name
00105     //-------------------------------------------------------------------------
00106     // Model List
00107     std::vector< MeshModel<T> * >   m_vModelPtrList;
00108 //-----------------------------------------------------------------------------
00109     // Transformation Support (from class TransformationSupport<T>
00110     TransformationSupport<T>    m_Transform;
00111 //-----------------------------------------------------------------------------
00112 };
00113 //=============================================================================
00114 END_NAMESPACE_TAPs__OpenGL
00115 //-----------------------------------------------------------------------------
00116 // Include definition if TAPs_USE_EXPORT is not defined
00117 //#if !defined( TAPs_USE_EXPORT )
00118     #include "TAPsMultiMeshModel.cpp"
00119 //#endif
00120 //-----------------------------------------------------------------------------
00121 #endif
00122 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00123 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines