eng_view.hh

Go to the documentation of this file.
00001 /*
00008  * LEGAL:   COPYRIGHT (C) 2004 JIM E. BROOKS
00009  *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
00010  *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
00011  *****************************************************************************/
00012 
00013 #ifndef ENG_VIEW_HH
00014 #define ENG_VIEW_HH 1
00015 
00016 namespace eng {
00017 
00029 class View : public Shared
00030 {
00031 friend class Engine;
00032 public:
00033     enum { MAIN_VIEW_NUM = 0 };
00034 
00040     class Eye
00041     {
00042     
00043     public:
00044                             Eye( void );
00045                             ~Eye();
00046         void                SetPosition( const WorldVertex& pos );
00047         WorldVertex         GetPosition( void );
00048         void                PositionChanged( void );
00049         SharedPtr<const Matrix> GetMatrix( void ) { return &mMatrix; }
00050         void                SetMatrix( const Matrix& matrix );
00051         void                Translate( uint axis, fp inc );
00052         void                Translate( const Vector3& v );
00053         void                Rotate( uint axis, Radian rad );
00054 
00055     private:
00056         void                CorrectPosition_( void );
00057 
00058     private:
00059         Matrix              mMatrix;
00060     };
00061 
00062 public:
00063                         View( const Rect<int>& rect, const uint dim = 3, bool enable = true );
00064     virtual             ~View();
00065     void                Enable( bool enable = true ) { mEnable = enable; }
00066     bool                IfEnabled( void ) { return mEnable; }
00067     bool                If3D( void ) { return mDim == 3; }
00068     uint                GetFPS( void );
00069     void                SetRect( const Rect<int>& rect ) { mRect = rect; }
00070     Rect<int>           GetRect( void ) { return mRect; }
00071     // For reshape, View derivatives will need to divide the main view's rectangle.
00072     virtual void        Reshape( const Rect<int>& mainViewRect ) { SetRect(mainViewRect); }
00073 
00074     // Eye methods (these pass-thrus astract/hide the Eye object):
00075     SharedPtr<const Matrix> GetMatrix( void );
00076     void                SetMatrix( const Matrix& matrix );
00077     void                Translate( uint axis, fp inc );
00078     void                Translate( const Vector3& v );
00079     void                Rotate( uint axis, Radian rad );
00080     void                SetPosition( const WorldVertex& pos );
00081     WorldVertex         GetPosition( void );
00082     Degree              GetRollDeg( void );            // supports Sprites
00083     void                SetRollDeg( Degree rollDeg );  // supports Sprites
00084 
00085 public:
00086     CLASS_CONST uint INVALID_FRAME_CNT = 0;
00087 
00088 private:
00089     Rect<int>       mRect;      
00090     const uint      mDim;       
00091     bool            mEnable;
00092     Eye             mEye;
00093     Degree          mRollDeg;   
00094 };
00095 
00096 } // namespace eng
00097 
00098 #endif // ENG_VIEW_HH
Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:09 2007