Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
00001 // Copyright 2006-2011 by Kat'Oun 00002 00003 #ifndef _RENDER_TARGET_H_ 00004 #define _RENDER_TARGET_H_ 00005 00006 #include <EngineConfig.h> 00007 #include <core/Types.h> 00008 #include <platform/Timer.h> 00009 #include <platform/PlatformManager.h> 00010 #include <render/RenderTargetEventReceiver.h> 00011 #include <engine/Object.h> 00012 00013 #include <list> 00014 #include <map> 00015 00016 namespace render 00017 { 00018 00019 class Camera; 00020 class Viewport; 00021 struct RenderTargetEvent; 00022 class RenderTargetViewportEvent; 00023 00029 class ENGINE_PUBLIC_EXPORT RenderTarget: public engine::Object 00030 { 00031 public: 00032 00033 struct FrameStats 00034 { 00035 f32 lastFPS; 00036 f32 avgFPS; 00037 f32 bestFPS; 00038 f32 worstFPS; 00039 f32 bestFrameTime; 00040 f32 worstFrameTime; 00041 s32 triangleCount; 00042 }; 00043 00044 RenderTarget(); 00045 RenderTarget(const std::string& name); 00046 virtual ~RenderTarget(); 00047 00049 virtual u32 getWidth() const; 00050 virtual u32 getHeight() const; 00051 virtual u32 getColorDepth() const; 00052 00068 virtual Viewport* createViewport(Camera* cam, f32 left = 0.0f, f32 top = 0.0f , f32 width = 1.0f, f32 height = 1.0f); 00069 00071 virtual Viewport* getViewport(const u32& id); 00072 00074 virtual void removeViewport(Viewport* vp); 00075 00077 virtual void removeViewport(const u32& id); 00078 00080 virtual void removeAllViewports(); 00081 00082 virtual const FrameStats& getStatistics() const; 00083 00085 virtual f32 getLastFPS() const; 00087 virtual f32 getAverageFPS() const; 00089 virtual f32 getBestFPS() const; 00091 virtual f32 getWorstFPS() const; 00093 virtual f32 getBestFrameTime() const; 00095 virtual f32 getWorstFrameTime() const; 00097 virtual s32 getTriangleCount() const; 00098 00100 virtual void resetStatistics(); 00101 00108 virtual void setPriority(u32 priority); 00110 virtual u32 getPriority() const; 00111 00113 virtual bool isActive() const; 00114 00116 virtual void setActive(bool state); 00117 00118 void addRenderTargetEventReceiver(RenderTargetEventReceiver* newEventReceiver); 00119 void removeRenderTargetEventReceiver(RenderTargetEventReceiver* oldEventReceiver); 00120 00121 std::map<u32, Viewport*>& getViewports(); 00122 00123 protected: 00124 00125 // Incremented count for next index 00126 static u32 msNextGeneratedRenderTargetIndex; 00127 00128 void initProperties(); 00129 00130 virtual void updateImpl(f32 elapsedTime); 00131 00133 std::map<u32, Viewport*> mViewports; 00134 00135 // The priority of the render target. 00136 u32 mPriority; 00137 00138 u32 mWidth; 00139 u32 mHeight; 00140 u32 mColorDepth; 00141 bool mIsDepthBuffered; 00142 00143 // Stats 00144 FrameStats mStats; 00145 00146 platform::Timer* mTimer; 00147 u32 mLastSecond; 00148 u32 mLastTime; 00149 s32 mFrameCount; 00150 00151 bool mActive; 00152 bool mAutoUpdate; 00153 00154 RenderTargetEvent* mRenderTargetEvent; 00155 00156 std::list<RenderTargetEventReceiver*> mRenderTargetEventReceivers; 00157 00158 void updateStats(); 00159 00161 virtual void firePreUpdate(); 00163 virtual void firePostUpdate(); 00164 }; 00165 00166 } // end namespace render 00167 00168 #endif
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:05 by
Doxygen
(1.7.4)
|