TAPs 0.7.7.3
TAPsOpenGLViewManager.hpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsOpenGLViewManager.hpp
00003 
00004 LOCAL TO THIS PROJECT
00005 Inherited from class OpenGLBaseViewManager.
00006 For setting up OpenGL display functions.
00007 
00008 SUKITTI PUNAK   (05/07/2006)
00009 UPDATE          (05/07/2006)
00010 ******************************************************************************/
00011 #ifndef TAPs_OPENGL_VIEW_MANAGER_HPP
00012 #define TAPs_OPENGL_VIEW_MANAGER_HPP
00013 
00014 #include <TAPs/OpenGL/TAPsOpenGLFns.hpp>
00015 #include "TAPsBaseOpenGLViewManager.hpp"
00016 
00017 BEGIN_NAMESPACE_TAPs__OpenGL
00018 //=============================================================================
00019 template <typename T>
00020 class OpenGLViewManager : public /*virtual*/ BaseOpenGLViewManager<T> {
00021 public:
00022     //---------------------------------------------------------------
00023     // Default Constructor and Destructor
00024     OpenGLViewManager ();
00025     virtual ~OpenGLViewManager ();
00026     //---------------------------------------------------------------
00027     // Override Pure Virtual Fns inherited from Class OpenGLBaseViewManager
00028     virtual void Setup ();
00029     virtual void Cleanup ();
00030     //---------------------------------------------------------------
00031     virtual void ReshapeView ( int width, int height );
00032     virtual void UpdateView ();
00033     virtual bool IsModifyingView () const;
00034     virtual void StartModifyView ( enum ModifyViewType type, int x, int y );
00035     virtual void StopModifyView ();
00036     virtual void ModifyView ( int x, int y );
00037     virtual bool ToScreen ( const Vector3<T> &obj, Vector3<T> &win ) const;
00038     virtual bool FromScreen ( const Vector3<T> &win, Vector3<T> &obj ) const;
00039     virtual T GetWindowToWorldScale () const;
00040     virtual const Matrix4x4<T> & GetViewTransform () const;
00041     virtual const Matrix4x4<T> & GetProjTransform () const;
00042     //---------------------------------------------------------------
00043     // Get/Set Fns
00044     virtual int GetWindowWidth () const  { return m_aiViewport[2]; }
00045     virtual int GetWindowHeight () const { return m_aiViewport[3]; }
00046     //---------------------------------------------------------------
00047     virtual void GLSetCamera () const;
00048 protected:
00049     //---------------------------------------------------------------
00050     // Helper Fn(s)
00051     T ProjectToTrackBall ( T radius, T x, T y );
00052     void UpdateWindowToWorldScale ();
00053     //---------------------------------------------------------------
00054     // Data Members
00055     Vector3<T>      m_vViewPosition;
00056     Matrix4x4<T>    m_mViewRotation;
00057     T               m_tViewScale;
00058     Vector3<T>      m_vLookAt;
00059     T               m_tWindowToWorldScale;
00060     Matrix4x4<T>    m_mWorldToView;
00061     Matrix4x4<T>    m_mViewToClip;
00062     int             m_aiViewport[4];
00063     int             m_iLastMouseX, m_iLastMouseY;
00064     ModifyViewType  m_eModifyViewType;
00065     //---------------------------------------------------------------
00066 }; // CLASS END: OpenGLViewManager *********************************************
00067 //=============================================================================
00068 END_NAMESPACE_TAPs__OpenGL
00069 //-----------------------------------------------------------------------------
00070 // Include definition if TAPs_USE_EXPORT is not defined
00071 //#if !defined( TAPs_USE_EXPORT )
00072     #include "TAPsOpenGLViewManager.cpp"
00073 //#endif
00074 //-----------------------------------------------------------------------------
00075 #endif
00076 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00077 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines