Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

OpenGLViewportC.h

00001 #ifndef __DEMOPAJA_OPENGLVIEWPORTC_H__
00002 #define __DEMOPAJA_OPENGLVIEWPORTC_H__
00003 
00004 #include "PajaTypes.h"
00005 #include "DeviceInterfaceI.h"
00006 #include "GraphicsViewportI.h"
00007 #include "Vector2C.h"
00008 #include "BBox2C.h"
00009 #include <gl\gl.h>
00010 
00011 
00012 namespace PajaSystem {
00013 
00015     const PluginClass::ClassIdC CLASS_OPENGL_VIEWPORT = PluginClass::ClassIdC( 0, 10001 );
00016 
00017 
00019 
00023     class OpenGLViewportC : public GraphicsViewportI
00024     {
00025     public:
00026 
00027         virtual Edit::DataBlockI*               create();
00028         static OpenGLViewportC*                 create_new();
00029         virtual PluginClass::ClassIdC           get_class_id() const;
00030         virtual const char*                     get_class_name();
00031 
00033 
00042         virtual void                set_perspective( const PajaTypes::BBox2C& rBBox, PajaTypes::float32 f32FOV, PajaTypes::float32 f32Aspect,
00043                                         PajaTypes::float32 f32ZNear, PajaTypes::float32 f32ZFar );
00044 
00046 
00055         virtual void                set_ortho( const PajaTypes::BBox2C& rBBox,
00056                                         PajaTypes::float32 f32Left, PajaTypes::float32 f32Right,
00057                                         PajaTypes::float32 f32Top, PajaTypes::float32 f32Bottom,
00058                                         PajaTypes::float32 f32ZNear = -1, PajaTypes::float32 f32ZFar = 1 );
00059 
00060         virtual void                set_ortho_pixel( const PajaTypes::BBox2C& rBBox, PajaTypes::float32 f32ZNear = -1, PajaTypes::float32 f32ZFar = 1 );
00061 
00063         virtual PajaTypes::Vector2C client_to_layout( const PajaTypes::Vector2C& rVec );
00065         virtual PajaTypes::Vector2C layout_to_client( const PajaTypes::Vector2C& rVec );
00067         virtual PajaTypes::Vector2C delta_client_to_layout( const PajaTypes::Vector2C& rVec );
00069         virtual PajaTypes::Vector2C delta_layout_to_client( const PajaTypes::Vector2C& rVec );
00070 
00072         virtual const PajaTypes::BBox2C&    get_viewport();
00074         virtual const PajaTypes::BBox2C&    get_layout();
00076         virtual PajaTypes::int32            get_width();
00078         virtual PajaTypes::int32            get_height();
00080         virtual PajaTypes::float32          get_pixel_aspect_ratio();
00081 
00083         virtual void                set_pixel_aspect_ratio( PajaTypes::float32 f32PixelAspect );
00085         virtual void                set_dimension( PajaTypes::int32 i32PosX, PajaTypes::int32 i32PosY, PajaTypes::int32 i32Width, PajaTypes::int32 i32Height );
00087         virtual void                set_viewport( const PajaTypes::BBox2C& rViewport );
00089         virtual void                set_layout( const PajaTypes::BBox2C& rLayout );
00090 
00092         virtual void                activate();
00093 
00094     protected:
00096         OpenGLViewportC();
00098         virtual ~OpenGLViewportC();
00099 
00100     private:
00102         void                        set_scissor( const PajaTypes::BBox2C& rBBox );
00104         void                        recalc_mapping();
00105 
00106         PajaTypes::BBox2C   m_rViewport;            // The viewport size in paja (include pan and zoom).
00107         PajaTypes::BBox2C   m_rLayout;              // Layout bbox.
00108         PajaTypes::int32    m_i32Width;             // Actual screen size in pixels.
00109         PajaTypes::int32    m_i32Height;
00110         PajaTypes::int32    m_i32PosX;              // Position of lower left corner in pixels.
00111         PajaTypes::int32    m_i32PosY;
00112         PajaTypes::float64  m_f64LayoutAspectX;     // Conversion variables.
00113         PajaTypes::float64  m_f64LayoutAspectY;
00114         PajaTypes::float64  m_f64ClientAspectX;
00115         PajaTypes::float64  m_f64ClientAspectY;
00116 
00117         PajaTypes::float32  m_f32PixelsAspect;
00118 
00119         // Current viewport.
00120         enum ViewportTypeE {
00121             OPENGL_VIEWPORT_ORTHO = 0,
00122             OPENGL_VIEWPORT_PERSPECTIVE,
00123             OPENGL_VIEWPORT_ORTHO_PIXEL,
00124         };
00125         PajaTypes::uint32   m_ui32ViewportType;
00126         PajaTypes::int32    m_i32ScissorX;
00127         PajaTypes::int32    m_i32ScissorY;
00128         PajaTypes::int32    m_i32ScissorWidth;
00129         PajaTypes::int32    m_i32ScissorHeight;
00130         PajaTypes::float64  m_f64FrustumLeft;
00131         PajaTypes::float64  m_f64FrustumRight;
00132         PajaTypes::float64  m_f64FrustumBottom;
00133         PajaTypes::float64  m_f64FrustumTop;
00134         PajaTypes::float64  m_f64FrustumNearZ;
00135         PajaTypes::float64  m_f64FrustumFarZ;
00136     };
00137 
00138 };
00139 
00140 #endif // __OpenGLViewportC_H__
00141 

Moppi Demopaja SDK Documentation -- Copyright © 2000-2002 Moppi Productions