![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsImplicitObject.hpp 00003 ******************************************************************************/ 00010 /****************************************************************************** 00011 SUKITTI PUNAK (10/14/2009) 00012 UPDATE (10/14/2009) 00013 ******************************************************************************/ 00014 #ifndef TAPs_IMPLICIT_OBJECT_HPP 00015 #define TAPs_IMPLICIT_OBJECT_HPP 00016 00017 #include "../../Support/TAPsColDetSupport.hpp" 00018 #include "../../Support/TAPsTransformationSupport.hpp" 00019 00020 BEGIN_NAMESPACE_TAPs 00021 //============================================================================= 00022 template <typename T> 00023 class ImplicitObject : public /*virtual*/ ColDetSupport<T> { 00024 //============================================================================= 00025 public: 00026 // Member Functions ------------------------------------------------------- 00028 friend std::ostream & operator<< ( std::ostream &output, ImplicitObject<T> const &obj ) 00029 { 00030 output << obj.StrInfo(); 00031 return output; 00032 } 00033 //------------------------------------------------------------------------- 00035 ImplicitObject ( Enum::Shape shape = Enum::UNDEFINED_SHAPE, std::string & name = std::string("") ); 00037 ImplicitObject ( ImplicitObject<T> const &orig ); 00039 virtual ~ImplicitObject (); 00040 //------------------------------------------------------------------------- 00042 virtual std::string StrInfo () const; 00043 //------------------------------------------------------------------------- 00045 inline ImplicitObject<T> & operator= ( ImplicitObject<T> const &orig ); 00046 //------------------------------------------------------------------------- 00048 inline std::string const & GetName () const { return m_Name; } 00050 inline std::string & GetName () { return m_Name; } 00052 inline void SetName( std::string name ) { m_Name = name; } 00053 00055 inline unsigned int GetID () const { return m_ID; } 00056 00058 inline Enum::Shape GetShape () const { return m_Shape; } 00059 00061 static inline unsigned int GetTotalObjects () { return g_NumOfObjects; } 00062 00064 virtual void BuildBVHTree ( int detail_level = 0, Enum::CD treeType = Enum::BVH_TREE_BINARY_SPHERE ) = 0; 00065 00067 TransformationSupport<T> const & GetTransform() const { return m_Trx; } 00069 TransformationSupport<T> & GetTransform() { return m_Trx; } 00070 00072 inline void SetTransform ( TransformationSupport<T> & Trx ); 00073 00075 inline Vector3<T> GetTransformedCenter () const; 00076 00077 #ifdef TAPs_SHOW_COLLISION_STATE 00078 bool IsCollided; 00079 #endif//TAPs_SHOW_COLLISION_STATE 00080 00081 // Data Members ----------------------------------------------------------- 00082 //============================================================================= 00083 protected: 00084 // Member Functions ------------------------------------------------------- 00085 // Data Members ----------------------------------------------------------- 00086 static unsigned int g_NumOfObjects; // total number of objects 00087 unsigned int m_ID; // the id of this object 00088 Enum::Shape m_Shape; // the shape of this implicit object 00089 std::string m_Name; // name of this object 00090 TransformationSupport<T> m_Trx; // transformation support 00091 //============================================================================= 00092 private: 00093 // Member Functions ------------------------------------------------------- 00094 // Data Members ----------------------------------------------------------- 00095 //============================================================================= 00096 00097 #if defined(__gl_h_) || defined(__GL_H__) 00098 public: 00102 virtual void Draw ( GLenum mode = GL_TRIANGLES, GLint detail_1 = 10, GLint detail_2 = 10 ) = 0; 00103 00104 #ifdef TAPs_USE_GLSL 00105 OpenGL::GlobalGLSLShaderPool::SHADER ShaderName; 00106 #endif//TAPs_USE_GLSL 00107 #endif 00108 00109 //============================================================================= 00110 }; // END CLASS ImplicitObject 00111 //============================================================================= 00112 //----------------------------------------------------------------------------- 00114 typedef ImplicitObject<int> ImplicitObjecti; 00115 typedef ImplicitObject<float> ImplicitObjectf; 00116 typedef ImplicitObject<double> ImplicitObjectd; 00117 //============================================================================= 00118 END_NAMESPACE_TAPs 00119 //----------------------------------------------------------------------------- 00121 #include "TAPsImplicitObject.cpp" 00122 00124 // Include definition if TAPs_USE_EXPORT is not defined 00125 //#if !defined( TAPs_USE_EXPORT ) 00126 // #include "TAPsImplicitObject.cpp" 00127 //#endif 00128 //----------------------------------------------------------------------------- 00129 #endif 00130 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00131 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----