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