Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class 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 (c) 2000-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef __RenderTarget_H__
    00030 #define __RenderTarget_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033
    00034 #include "OgreString.h"
    00035 #include "OgreTextureManager.h"
    00036 #include "OgreViewport.h"
    00037 #include "OgreTimer.h"
    00038
    00039 /* Define the number of priority groups for the render system's render targets. */
    00040 #ifndef OGRE_NUM_RENDERTARGET_GROUPS
    00041     #define OGRE_NUM_RENDERTARGET_GROUPS 10
    00042     #define OGRE_DEFAULT_RT_GROUP 4
    00043     #define OGRE_REND_TO_TEX_RT_GROUP 2
    00044 #endif
    00045
    00046 namespace Ogre {
    00047
    00059     class _OgreExport RenderTarget
    00060     {
    00061     public:
    00062         enum StatFlags
    00063         {
    00064             SF_NONE           = 0,
    00065             SF_FPS            = 1,
    00066             SF_AVG_FPS        = 2,
    00067             SF_BEST_FPS       = 4,
    00068             SF_WORST_FPS      = 8,
    00069             SF_TRIANGLE_COUNT = 16,
    00070             SF_ALL            = 0xFFFF
    00071         };
    00072
    00073         struct FrameStats
    00074         {
    00075             float lastFPS;
    00076             float avgFPS;
    00077             float bestFPS;
    00078             float worstFPS;
    00079             unsigned long bestFrameTime;
    00080             unsigned long worstFrameTime;
    00081             size_t triangleCount;
    00082             size_t batchCount;
    00083         };
    00084
    00085         RenderTarget();
    00086         virtual ~RenderTarget();
    00087
    00089         virtual const String& getName(void) const;
    00090
    00092         virtual void getMetrics(unsigned int& width, unsigned int& height, unsigned int& colourDepth);
    00093
    00094         virtual unsigned int getWidth(void) const;
    00095         virtual unsigned int getHeight(void) const;
    00096         virtual unsigned int getColourDepth(void) const;
    00097
    00111         virtual void update(void);
    00112
    00136         virtual Viewport* addViewport(Camera* cam, int ZOrder = 0, float left = 0.0f, float top = 0.0f ,
    00137             float width = 1.0f, float height = 1.0f);
    00138
    00140         virtual unsigned short getNumViewports(void) const;
    00141
    00143         virtual Viewport* getViewport(unsigned short index);
    00144
    00147         virtual void removeViewport(int ZOrder);
    00148
    00151         virtual void removeAllViewports(void);
    00152
    00171         virtual void getStatistics(float& lastFPS, float& avgFPS,
    00172             float& bestFPS, float& worstFPS) const;  // Access to stats
    00173
    00174         virtual const FrameStats& getStatistics(void) const;
    00175
    00178         virtual float getLastFPS() const;
    00179
    00182         virtual float getAverageFPS() const;
    00183
    00186         virtual float getBestFPS() const;
    00187
    00190         virtual float getWorstFPS() const;
    00191
    00194         virtual float getBestFrameTime() const;
    00195
    00198         virtual float getWorstFrameTime() const;
    00199
    00202         virtual void resetStatistics(void);
    00203
    00213         virtual void getCustomAttribute(const String& name, void* pData);
    00214
    00223         virtual void addListener(RenderTargetListener* listener);
    00225         virtual void removeListener(RenderTargetListener* listener);
    00227         virtual void removeAllListeners(void);
    00228
    00236         virtual void setPriority( uchar priority ) { mPriority = priority; }
    00238         virtual uchar getPriority() const { return mPriority; }
    00239
    00242         virtual bool isActive() const;
    00243
    00246         virtual void setActive( bool state );
    00247
    00259         virtual void setAutoUpdated(bool autoupdate);
    00263         virtual bool isAutoUpdated(void) const;
    00264
    00266         virtual void writeContentsToFile(const String& filename) = 0;
    00267
    00270     virtual String writeContentsToTimestampedFile(const String& filenamePrefix, const String& filenameSuffix);
    00271
    00272         virtual bool requiresTextureFlipping() const = 0;
    00273
    00275         virtual size_t getTriangleCount(void) const;
    00277         virtual size_t getBatchCount(void) const;
    00281         virtual void _notifyCameraRemoved(const Camera* cam);
    00282
    00289         virtual bool isPrimary(void) const;
    00290
    00291
    00295         class Impl
    00296         {
    00297         protected:
    00303             ~Impl() { };
    00304         };
    00310         virtual Impl *_getImpl();
    00311     protected:
    00313         String mName;
    00315         uchar mPriority;
    00316
    00317         unsigned int mWidth;
    00318         unsigned int mHeight;
    00319         unsigned int mColourDepth;
    00320         bool mIsDepthBuffered;
    00321
    00322         // Stats
    00323         FrameStats mStats;
    00324
    00325         Timer* mTimer ;
    00326         unsigned long mLastSecond;
    00327         unsigned long mLastTime;
    00328         size_t mFrameCount;
    00329
    00330         bool mActive;
    00331         bool mAutoUpdate;
    00332
    00333         void updateStats(void);
    00334
    00335         typedef std::map<int, Viewport*, std::less<int> > ViewportList;
    00337         ViewportList mViewportList;
    00338
    00339         typedef std::vector<RenderTargetListener*> RenderTargetListenerList;
    00340         RenderTargetListenerList mListeners;
    00341
    00342
    00344         virtual void firePreUpdate(void);
    00346         virtual void firePostUpdate(void);
    00348         virtual void fireViewportPreUpdate(Viewport* vp);
    00350         virtual void fireViewportPostUpdate(Viewport* vp);
    00352         virtual void fireViewportAdded(Viewport* vp);
    00354         virtual void fireViewportRemoved(Viewport* vp);
    00355     };
    00356
    00357 } // Namespace
    00358
    00359 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 30 10:50:57 2007