Go to the documentation of this file.00001
00002
00003 #ifndef _VIEWPORT_H_
00004 #define _VIEWPORT_H_
00005
00006 #include <EngineConfig.h>
00007 #include <core/Types.h>
00008 #include <render/Color.h>
00009 #include <engine/Object.h>
00010
00011 namespace render
00012 {
00013
00014 class Camera;
00015 class RenderTarget;
00016
00026 class ENGINE_PUBLIC_EXPORT Viewport: public engine::Object
00027 {
00028 public:
00029
00036 Viewport(Camera* camera, RenderTarget* target, f32 left, f32 top, f32 width, f32 height);
00037 Viewport(const std::string& name, Camera* camera, RenderTarget* target, f32 left, f32 top, f32 width, f32 height);
00038 ~Viewport();
00039
00043 void updateDimensions();
00044
00046 RenderTarget* getTarget();
00048 Camera* getCamera();
00050 f32 getLeft();
00052 f32 getTop();
00054 f32 getWidth();
00056 f32 getHeight();
00058 s32 getActualLeft();
00060 s32 getActualTop();
00062 s32 getActualWidth();
00064 s32 getActualHeight();
00065
00067
00071 void setDimensions(f32 left, f32 top, f32 width, f32 height);
00072
00074 void setBackgroundColor(Color& color);
00076 Color getBackgroundColor();
00077
00084 void setClearEveryFrame(bool clear);
00085
00087 bool getClearEveryFrame();
00088
00090 void getActualDimensions(s32& left, s32& top, s32& width, s32& height);
00091
00092 bool isUpdated();
00093
00094 void setVisible(bool enabled);
00095 bool isVisible();
00096
00098 void notifyRenderedFaces(u32 numfaces);
00100 u32 getNumRenderedFaces() const;
00101
00102 void setShowOverlays(bool enabled);
00103 bool getShowOverlays();
00104
00105 void clearUpdatedFlag();
00106
00107 protected:
00108
00109
00110 static u32 msNextGeneratedViewportIndex;
00111
00112 void initProperties();
00113
00114 void updateImpl(f32 elapsedTime);
00115
00116 Camera* mCamera;
00117 RenderTarget* mTarget;
00118
00119
00120 f32 mRelLeft, mRelTop, mRelWidth, mRelHeight;
00121
00122 s32 mActLeft, mActTop, mActWidth, mActHeight;
00123
00124
00125 u32 mRenderedFaces;
00126
00127
00128 Color mBackColor;
00129 bool mClearEveryFrame;
00130
00131 bool mUpdated;
00132
00133 bool mIsVisible;
00134
00135 bool mShowOverlays;
00136 };
00137
00138 }
00139
00140 #endif