![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsOpenGLViewManager.hpp 00003 00004 Inherited from class OpenGLBaseViewManager. 00005 For setting up OpenGL display functions. 00006 00007 SUKITTI PUNAK (07/20/2005) 00008 UPDATE (07/30/2005) 00009 ******************************************************************************/ 00010 #ifndef TAPs_OPENGL_VIEW_MANAGER_HPP 00011 #define TAPs_OPENGL_VIEW_MANAGER_HPP 00012 00013 #include "../../Core/TAPsLib.hpp" 00014 #include "../../OpenGL/TAPsOpenGLFns.hpp" 00015 #include "TAPsOpenGLBaseViewManager.hpp" 00016 00017 BEGIN_NAMESPACE_TAPs__OpenGL 00018 //============================================================================= 00019 template <typename T> 00020 class OpenGLViewManager : public /*virtual*/ OpenGLBaseViewManager<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 virtual void ReshapeView ( int width, int height ); 00031 virtual void UpdateView (); 00032 virtual int GetWindowWidth () const { return m_aiViewport[2]; } 00033 virtual int GetWindowHeight () const { return m_aiViewport[3]; } 00034 virtual bool IsModifyingView () const; 00035 virtual void StartModifyView ( enum ModifyViewType type, int x, int y ); 00036 virtual void StopModifyView (); 00037 virtual void ModifyView ( int x, int y ); 00038 virtual bool ToScreen ( const Vector3<T> &obj, Vector3<T> &win ) const; 00039 virtual bool FromScreen ( const Vector3<T> &win, Vector3<T> &obj ) const; 00040 virtual T GetWindowToWorldScale () const; 00041 virtual const Matrix4x4<T> & GetViewTransform () const; 00042 virtual const Matrix4x4<T> & GetProjTransform () const; 00043 //---------------------------------------------------------------- 00044 protected: 00045 //---------------------------------------------------------------- 00046 // Helper Fn(s) 00047 T ProjectToTrackBall ( T radius, T x, T y ); 00048 void UpdateWindowToWorldScale (); 00049 //---------------------------------------------------------------- 00050 // Data Members 00051 Vector3<T> m_vViewPosition; 00052 Matrix4x4<T> m_mViewRotation; 00053 T m_tViewScale; 00054 Vector3<T> m_vLookAt; 00055 T m_tWindowToWorldScale; 00056 Matrix4x4<T> m_mWorldToView; 00057 Matrix4x4<T> m_mViewToClip; 00058 int m_aiViewport[4]; 00059 int m_iLastMouseX, m_iLastMouseY; 00060 ModifyViewType m_eModifyViewType; 00061 //---------------------------------------------------------------- 00062 }; // CLASS END: OpenGLViewManager ********************************************* 00063 //============================================================================= 00064 END_NAMESPACE_TAPs__OpenGL 00065 //----------------------------------------------------------------------------- 00066 // Include definition if TAPs_USE_EXPORT is not defined 00067 //#if !defined( TAPs_USE_EXPORT ) 00068 #include "TAPsOpenGLViewManager.cpp" 00069 //#endif 00070 //----------------------------------------------------------------------------- 00071 #endif 00072 //345678901234567890123456789012345678901234567890123456789012345678901234567890 00073 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8