# OgreViewport.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 __Viewport_H__
    00030 #define __Viewport_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033 #include "OgreCommon.h"
    00034 #include "OgreColourValue.h"
    00035
    00036 namespace Ogre {
    00050     class _OgreExport Viewport : public ViewportAlloc
    00051     {
    00052     public:
    00075         Viewport(
    00076             Camera* camera,
    00077             RenderTarget* target,
    00078             Real left, Real top,
    00079             Real width, Real height,
    00080             int ZOrder);
    00081
    00084         virtual ~Viewport();
    00085
    00093         void _updateDimensions(void);
    00094
    00097         void update(void);
    00098
    00101         RenderTarget* getTarget(void) const;
    00102
    00105         Camera* getCamera(void) const;
    00106
    00108         void setCamera(Camera* cam);
    00109
    00111         int getZOrder(void) const;
    00115         Real getLeft(void) const;
    00116
    00120         Real getTop(void) const;
    00121
    00126         Real getWidth(void) const;
    00131         Real getHeight(void) const;
    00136         int getActualLeft(void) const;
    00141         int getActualTop(void) const;
    00145         int getActualWidth(void) const;
    00150         int getActualHeight(void) const;
    00151
    00164         void setDimensions(Real left, Real top, Real width, Real height);
    00165
    00169         void setBackgroundColour(const ColourValue& colour);
    00170
    00173         const ColourValue& getBackgroundColour(void) const;
    00174
    00184         void setClearEveryFrame(bool clear, unsigned int buffers = FBT_COLOUR | FBT_DEPTH);
    00185
    00188         bool getClearEveryFrame(void) const;
    00189
    00191         unsigned int getClearBuffers(void) const;
    00192
    00200         void setMaterialScheme(const String& schemeName)
    00201         { mMaterialSchemeName = schemeName; }
    00202
    00205         const String& getMaterialScheme(void) const
    00206         { return mMaterialSchemeName; }
    00207
    00210         void getActualDimensions(
    00211             int &left, int &top, int &width, int &height ) const;
    00212
    00213         bool _isUpdated(void) const;
    00214         void _clearUpdatedFlag(void);
    00215
    00218         unsigned int _getNumRenderedFaces(void) const;
    00219
    00222         unsigned int _getNumRenderedBatches(void) const;
    00223
    00234         void setOverlaysEnabled(bool enabled);
    00235
    00238         bool getOverlaysEnabled(void) const;
    00239
    00250         void setSkiesEnabled(bool enabled);
    00251
    00254         bool getSkiesEnabled(void) const;
    00255
    00264         void setShadowsEnabled(bool enabled);
    00265
    00268         bool getShadowsEnabled(void) const;
    00269
    00270
    00279         void setVisibilityMask(uint32 mask) { mVisibilityMask = mask; }
    00280
    00284         uint getVisibilityMask(void) const { return mVisibilityMask; }
    00285
    00298         virtual void setRenderQueueInvocationSequenceName(const String& sequenceName);
    00300         virtual const String& getRenderQueueInvocationSequenceName(void) const;
    00302         RenderQueueInvocationSequence* _getRenderQueueInvocationSequence(void);
    00303
    00304     protected:
    00305         Camera* mCamera;
    00306         RenderTarget* mTarget;
    00307         // Relative dimensions, irrespective of target dimensions (0..1)
    00308         float mRelLeft, mRelTop, mRelWidth, mRelHeight;
    00309         // Actual dimensions, based on target dimensions
    00310         int mActLeft, mActTop, mActWidth, mActHeight;
    00312         int mZOrder;
    00314         ColourValue mBackColour;
    00315         bool mClearEveryFrame;
    00316         unsigned int mClearBuffers;
    00317         bool mUpdated;
    00318         bool mShowOverlays;
    00319         bool mShowSkies;
    00320         bool mShowShadows;
    00321         uint32 mVisibilityMask;
    00322         // Render queue invocation sequence name
    00323         String mRQSequenceName;
    00324         RenderQueueInvocationSequence* mRQSequence;
    00326         String mMaterialSchemeName;
    00327     };
    00328
    00329 }
    00330
    00331 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat Apr 11 14:26:48 2009