00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2005 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #ifndef __RenderTarget_H__ 00026 #define __RenderTarget_H__ 00027 00028 #include "OgrePrerequisites.h" 00029 00030 #include "OgreString.h" 00031 #include "OgreTextureManager.h" 00032 #include "OgreViewport.h" 00033 #include "OgreTimer.h" 00034 00035 /* Define the number of priority groups for the render system's render targets. */ 00036 #ifndef OGRE_NUM_RENDERTARGET_GROUPS 00037 #define OGRE_NUM_RENDERTARGET_GROUPS 10 00038 #define OGRE_DEFAULT_RT_GROUP 4 00039 #define OGRE_REND_TO_TEX_RT_GROUP 2 00040 #endif 00041 00042 namespace Ogre { 00043 00055 class _OgreExport RenderTarget 00056 { 00057 public: 00058 enum StatFlags 00059 { 00060 SF_NONE = 0, 00061 SF_FPS = 1, 00062 SF_AVG_FPS = 2, 00063 SF_BEST_FPS = 4, 00064 SF_WORST_FPS = 8, 00065 SF_TRIANGLE_COUNT = 16, 00066 SF_ALL = 0xFFFF 00067 }; 00068 00069 struct FrameStats 00070 { 00071 float lastFPS; 00072 float avgFPS; 00073 float bestFPS; 00074 float worstFPS; 00075 unsigned long bestFrameTime; 00076 unsigned long worstFrameTime; 00077 size_t triangleCount; 00078 }; 00079 00080 RenderTarget(); 00081 virtual ~RenderTarget(); 00082 00084 virtual const String& getName(void) const; 00085 00087 virtual void getMetrics(unsigned int& width, unsigned int& height, unsigned int& colourDepth); 00088 00089 virtual unsigned int getWidth(void) const; 00090 virtual unsigned int getHeight(void) const; 00091 virtual unsigned int getColourDepth(void) const; 00092 00106 virtual void update(void); 00107 00131 virtual Viewport* addViewport(Camera* cam, int ZOrder = 0, float left = 0.0f, float top = 0.0f , 00132 float width = 1.0f, float height = 1.0f); 00133 00135 virtual unsigned short getNumViewports(void) const; 00136 00138 virtual Viewport* getViewport(unsigned short index); 00139 00142 virtual void removeViewport(int ZOrder); 00143 00146 virtual void removeAllViewports(void); 00147 00166 virtual void getStatistics(float& lastFPS, float& avgFPS, 00167 float& bestFPS, float& worstFPS) const; // Access to stats 00168 00169 virtual const FrameStats& getStatistics(void) const; 00170 00173 virtual float getLastFPS() const; 00174 00177 virtual float getAverageFPS() const; 00178 00181 virtual float getBestFPS() const; 00182 00185 virtual float getWorstFPS() const; 00186 00189 virtual float getBestFrameTime() const; 00190 00193 virtual float getWorstFrameTime() const; 00194 00197 virtual void resetStatistics(void); 00198 00208 virtual void getCustomAttribute(const String& name, void* pData); 00209 00211 virtual void setDebugText(const String& text); 00212 00214 const String& getDebugText() const; 00215 00224 virtual void addListener(RenderTargetListener* listener); 00226 virtual void removeListener(RenderTargetListener* listener); 00228 virtual void removeAllListeners(void); 00229 00237 virtual void setPriority( uchar priority ) { mPriority = priority; } 00239 virtual uchar getPriority() const { return mPriority; } 00240 00243 virtual bool isActive() const; 00244 00247 virtual void setActive( bool state ); 00248 00260 virtual void setAutoUpdated(bool autoupdate); 00264 virtual bool isAutoUpdated(void) const; 00265 00267 virtual void writeContentsToFile(const String& filename) = 0; 00268 00271 virtual String writeContentsToTimestampedFile(const String& filenamePrefix, const String& filenameSuffix); 00272 00273 virtual bool requiresTextureFlipping() const = 0; 00274 00276 virtual size_t getTriangleCount(void) const; 00280 virtual void _notifyCameraRemoved(const Camera* cam); 00281 00288 virtual bool isPrimary(void) const; 00289 00290 protected: 00292 String mName; 00294 uchar mPriority; 00295 00296 unsigned int mWidth; 00297 unsigned int mHeight; 00298 unsigned int mColourDepth; 00299 bool mIsDepthBuffered; 00300 00301 // Stats 00302 FrameStats mStats; 00303 00304 Timer* mTimer ; 00305 String mDebugText; 00306 unsigned long mLastSecond; 00307 unsigned long mLastTime; 00308 size_t mFrameCount; 00309 00310 bool mActive; 00311 bool mAutoUpdate; 00312 00313 void updateStats(void); 00314 00315 typedef std::map<int, Viewport*, std::less<int> > ViewportList; 00317 ViewportList mViewportList; 00318 00319 typedef std::vector<RenderTargetListener*> RenderTargetListenerList; 00320 RenderTargetListenerList mListeners; 00321 00323 virtual void firePreUpdate(void); 00325 virtual void firePostUpdate(void); 00327 virtual void fireViewportPreUpdate(Viewport* vp); 00329 virtual void fireViewportPostUpdate(Viewport* vp); 00330 }; 00331 00332 } // Namespace 00333 00334 #endif
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 12:59:51 2006