00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://ogre.sourceforge.net/ 00006 00007 Copyright © 2000-2002 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 00034 /* Define the number of priority groups for the render system's render targets. */ 00035 #ifndef OGRE_NUM_RENDERTARGET_GROUPS 00036 #define OGRE_NUM_RENDERTARGET_GROUPS 10 00037 #define OGRE_DEFAULT_RT_GROUP 4 00038 #define OGRE_REND_TO_TEX_RT_GROUP 2 00039 #endif 00040 00041 namespace Ogre { 00042 00054 class _OgreExport RenderTarget 00055 { 00056 public: 00057 enum StatFlags 00058 { 00059 SF_NONE = 0, 00060 SF_FPS = 1, 00061 SF_AVG_FPS = 2, 00062 SF_BEST_FPS = 4, 00063 SF_WORST_FPS = 8, 00064 SF_TRIANGLE_COUNT = 16, 00065 SF_ALL = 0xFFFF 00066 }; 00067 00068 RenderTarget(); 00069 virtual ~RenderTarget(); 00070 00072 virtual String getName(void); 00073 00075 virtual void getMetrics(int &width, int &height, int &colourDepth); 00076 00077 virtual int getWidth(void); 00078 virtual int getHeight(void); 00079 virtual int getColourDepth(void); 00080 00094 virtual void update(void); 00095 00119 virtual Viewport* addViewport(Camera* cam, int ZOrder = 0, float left = 0, float top = 0 , 00120 float width = 100, float height = 100); 00121 00123 virtual unsigned short getNumViewports(void); 00124 00126 virtual Viewport* getViewport(unsigned short index); 00127 00130 virtual void removeViewport(int ZOrder); 00131 00134 virtual void removeAllViewports(void); 00135 00147 virtual void setStatsDisplay(StatFlags sf); 00148 00167 virtual void getStatistics(float& lastFPS, float& avgFPS, 00168 float& bestFPS, float& worstFPS); // Access to stats 00169 00172 virtual float getLastFPS(); 00173 00176 virtual float getAverageFPS(); 00177 00180 virtual float getBestFPS(); 00181 00184 virtual float getWorstFPS(); 00185 00188 virtual void resetStatistics(void); 00189 00192 virtual void outputText(int x, int y, const String& text) = 0; 00193 00203 virtual void getCustomAttribute(String name, void* pData); 00204 00206 virtual void setDebugText(const String& text); 00207 00209 const String& RenderTarget::getDebugText() const; 00210 00219 virtual void addListener(RenderTargetListener* listener); 00221 virtual void removeListener(RenderTargetListener* listener); 00223 virtual void removeAllListeners(void); 00224 00232 virtual void setPriority( uchar priority ) { mPriority = priority; } 00234 virtual uchar getPriority() const { return mPriority; } 00235 00238 virtual bool isActive() const; 00239 00242 virtual void setActive( bool state ); 00243 00245 virtual void writeContentsToFile(const String& filename) = 0; 00246 00247 virtual bool requiresTextureFlipping() const = 0; 00248 00249 protected: 00251 String mName; 00253 uchar mPriority; 00254 00255 int mWidth; 00256 int mHeight; 00257 int mColourDepth; 00258 bool mIsDepthBuffered; 00259 00260 // Stats 00261 StatFlags mStatFlags; 00262 float mLastFPS; 00263 float mAvgFPS; 00264 float mBestFPS; 00265 float mWorstFPS; 00266 unsigned int mTris; 00267 String mDebugText; 00268 00269 bool mActive; 00270 00271 void updateStats(void); 00272 00273 typedef std::map<int, Viewport*, std::less<int> > ViewportList; 00275 ViewportList mViewportList; 00276 00277 typedef std::vector<RenderTargetListener*> RenderTargetListenerList; 00278 RenderTargetListenerList mListeners; 00279 00281 virtual void firePreUpdate(void); 00283 virtual void firePostUpdate(void); 00284 }; 00285 00286 } // Namespace 00287 00288 #endif
Copyright © 2002 by The OGRE Team