![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsOpenGLModelStrand.hpp 00003 00004 Class OpenGLModelStrand is for creating an OpenGL Strand Model. 00005 00006 See class ModelStrand (in "../Model/TAPsModelStrand.hpp") and 00007 class OpenGLSupport ("../OpenGL/TAPsOpenGLSupport.hpp") for detail. 00008 00009 SUKITTI PUNAK (07/10/2005) 00010 UPDATE (06/15/2006) 00011 ******************************************************************************/ 00012 #ifndef TAPs_OPENGL_STRAND_MODEL_HPP 00013 #define TAPs_OPENGL_STRAND_MODEL_HPP 00014 00015 #include "TAPsModelStrand.hpp" 00016 #include "../OpenGL/TAPsOpenGLUsefulObjs.hpp" 00017 00018 BEGIN_NAMESPACE_TAPs__OpenGL 00019 //============================================================================= 00020 template <typename T> 00021 class OpenGLModelStrand : public /*virtual*/ ModelStrand<T> { 00022 //------------------------------------------------------------------------- 00023 // put it through ostream 00024 friend std::ostream & operator<< ( std::ostream &output, OpenGLModelStrand<T> const &o ) 00025 { 00026 output << "\n======================\n" 00027 << "TAPs::OpenGL::OpenGLModelStrand<" 00028 << typeid(T).name() << "> Class\n" 00029 << "======================\n"; 00030 //---------------------------------------------------------------- 00031 output << "\n# of Links " << o.m_iNoLinks 00032 << "\nEach link has length " << o.m_tLinkLength 00033 << " and weight " << o.m_tPointWeight << "\n"; 00034 return output; 00035 } 00036 //----------------------------------------------------------------------------- 00037 // Member Functions ----------------------------------------------------------- 00038 public: 00039 //------------------------------------------------------------------------- 00040 // Constructor(s) 00041 OpenGLModelStrand (); 00042 OpenGLModelStrand ( int iNoLinks, T tLength, T tWeight, 00043 Vector3<T> & posOfVertex0 = Vector3<T>(), 00044 T radius = 0.05, int numSlices = 12, int numStacks = 3 ); 00045 //------------------------------------------------------------------------- 00046 // Destructor 00047 virtual ~OpenGLModelStrand (); 00048 //------------------------------------------------------------------------- 00049 //------------------------------------------------------------------------- 00050 // Abstract Virtual Fn(s) from OpenGLSupport 00051 // void DisplayGL() 00052 //virtual void DisplayGL( OpenGL::Enum::DrawMode DM = OpenGL::Enum::LINES ); 00053 //------------------------------------------------------------------------- 00054 // Abstract Virtual Fn(s) from Model<T> 00055 virtual T GetMaxHalfLength () const { return m_iNoLinks * m_tLinkLength; } 00056 virtual void Initialize () {}; 00057 //------------------------------------------------------------------------- 00058 // Abstract Virtual Fn(s) from ColDetSupport<T> 00059 // Collision Detection Fn(s) 00060 virtual void CalBoundingAABB () {}; 00061 virtual void CalBoundingEllipsoid () {}; 00062 virtual void CalBoundingSphere () {}; 00063 //------------------------------------------------------------------------- 00064 //----------------------------------------------------------------------------- 00065 protected: 00066 //------------------------------------------------------------------------- 00067 // Helper Fn 00068 // void DrawGL() 00069 virtual void DrawGL ( GLenum drawMode ); 00070 // void DrawTorsions (); 00071 // void DrawOrigShape (); 00072 void SetUpOpenGLDisplayList (); 00073 // void DrawBezierCurve (); 00074 // For DEBUG 00075 // void DrawBB (); 00076 //------------------------------------------------------------------- 00077 // Data Members 00078 GLuint m_uiDisplayList; // For drawing Glut Cylinder & Sphere 00079 int m_iNumSlices; // around the cylinder radius 00080 int m_iNumStacks; // along the cylinder body 00081 00082 //----------------------------------------------------------------------------- 00083 }; 00084 //============================================================================= 00085 END_NAMESPACE_TAPs__OpenGL 00086 //----------------------------------------------------------------------------- 00087 // Include definition if TAPs_USE_EXPORT is not defined 00088 //#if !defined( TAPs_USE_EXPORT ) 00089 #include "TAPsOpenGLModelStrand.cpp" 00090 //#endif 00091 //----------------------------------------------------------------------------- 00092 #endif 00093 //345678901234567890123456789012345678901234567890123456789012345678901234567890 00094 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8