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

# OgreRenderTarget.h

Go to the documentation of this file.

    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 © 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 #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
    00159         virtual void setStatsDisplay(StatFlags sf);
    00160
    00179         virtual void getStatistics(float& lastFPS, float& avgFPS,
    00180             float& bestFPS, float& worstFPS) const;  // Access to stats
    00181
    00182         virtual const FrameStats& getStatistics(void) const;
    00183
    00186         virtual float getLastFPS() const;
    00187
    00190         virtual float getAverageFPS() const;
    00191
    00194         virtual float getBestFPS() const;
    00195
    00198         virtual float getWorstFPS() const;
    00199
    00202         virtual float getBestFrameTime() const;
    00203
    00206         virtual float getWorstFrameTime() const;
    00207
    00210         virtual void resetStatistics(void);
    00211
    00221         virtual void getCustomAttribute(const String& name, void* pData);
    00222
    00224         virtual void setDebugText(const String& text);
    00225
    00227         const String& getDebugText() const;
    00228
    00237         virtual void addListener(RenderTargetListener* listener);
    00239         virtual void removeListener(RenderTargetListener* listener);
    00241         virtual void removeAllListeners(void);
    00242
    00250         virtual void setPriority( uchar priority ) { mPriority = priority; }
    00252         virtual uchar getPriority() const { return mPriority; }
    00253
    00256         virtual bool isActive() const;
    00257
    00260         virtual void setActive( bool state );
    00261
    00273         virtual void setAutoUpdated(bool autoupdate);
    00277         virtual bool isAutoUpdated(void) const;
    00278
    00280         virtual void writeContentsToFile(const String& filename) = 0;
    00281
    00284     virtual String writeContentsToTimestampedFile(const String& filenamePrefix, const String& filenameSuffix);
    00285
    00286         virtual bool requiresTextureFlipping() const = 0;
    00287
    00289         virtual size_t getTriangleCount(void) const;
    00293         virtual void _notifyCameraRemoved(const Camera* cam);
    00294
    00295     protected:
    00297         String mName;
    00299         uchar mPriority;
    00300
    00301         unsigned int mWidth;
    00302         unsigned int mHeight;
    00303         unsigned int mColourDepth;
    00304         bool mIsDepthBuffered;
    00305
    00306         // Stats
    00307         StatFlags mStatFlags;
    00308         FrameStats mStats;
    00309
    00310         Timer* mTimer ;
    00311         String mDebugText;
    00312         unsigned long mLastSecond;
    00313         unsigned long mLastTime;
    00314         size_t mFrameCount;
    00315
    00316         bool mActive;
    00317         bool mAutoUpdate;
    00318
    00319         void updateStats(void);
    00320
    00321         typedef std::map<int, Viewport*, std::less<int> > ViewportList;
    00323         ViewportList mViewportList;
    00324
    00325         typedef std::vector<RenderTargetListener*> RenderTargetListenerList;
    00326         RenderTargetListenerList mListeners;
    00327
    00329         virtual void firePreUpdate(void);
    00331         virtual void firePostUpdate(void);
    00333         virtual void fireViewportPreUpdate(Viewport* vp);
    00335         virtual void fireViewportPostUpdate(Viewport* vp);
    00336     };
    00337
    00338 } // Namespace
    00339
    00340 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:42 2004