OgreViewport.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __Viewport_H__
#define __Viewport_H__
#include "OgrePrerequisites.h"
#include "OgreCommon.h"
#include "OgreColourValue.h"
#include "OgreFrustum.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
class _OgreExport Viewport : public ViewportAlloc
{
public:
class _OgreExport Listener
{
public:
virtual ~Listener() {}
virtual void viewportCameraChanged(Viewport* viewport) {}
virtual void viewportDimensionsChanged(Viewport* viewport) {}
virtual void viewportDestroyed(Viewport* viewport) {}
};
Viewport(
Camera* camera,
RenderTarget* target,
Real left, Real top,
Real width, Real height,
int ZOrder);
virtual ~Viewport();
void _updateDimensions(void);
void update(void);
void clear(unsigned int buffers = FBT_COLOUR | FBT_DEPTH,
const ColourValue& colour = ColourValue::Black,
Real depth = 1.0f, unsigned short stencil = 0);
RenderTarget* getTarget(void) const;
Camera* getCamera(void) const;
void setCamera(Camera* cam);
int getZOrder(void) const;
Real getLeft(void) const;
Real getTop(void) const;
Real getWidth(void) const;
Real getHeight(void) const;
int getActualLeft(void) const;
int getActualTop(void) const;
int getActualWidth(void) const;
int getActualHeight(void) const;
void setDimensions(Real left, Real top, Real width, Real height);
void setOrientationMode(OrientationMode orientationMode, bool setDefault = true);
OrientationMode getOrientationMode() const;
static void setDefaultOrientationMode(OrientationMode orientationMode);
static OrientationMode getDefaultOrientationMode();
void setBackgroundColour(const ColourValue& colour);
const ColourValue& getBackgroundColour(void) const;
void setDepthClear( Real depth );
Real getDepthClear(void) const;
void setClearEveryFrame(bool clear, unsigned int buffers = FBT_COLOUR | FBT_DEPTH);
bool getClearEveryFrame(void) const;
unsigned int getClearBuffers(void) const;
void setAutoUpdated(bool autoupdate);
bool isAutoUpdated() const;
void setMaterialScheme(const String& schemeName)
{ mMaterialSchemeName = schemeName; }
const String& getMaterialScheme(void) const
{ return mMaterialSchemeName; }
void getActualDimensions(
int &left, int &top, int &width, int &height ) const;
bool _isUpdated(void) const;
void _clearUpdatedFlag(void);
unsigned int _getNumRenderedFaces(void) const;
unsigned int _getNumRenderedBatches(void) const;
void setOverlaysEnabled(bool enabled);
bool getOverlaysEnabled(void) const;
void setSkiesEnabled(bool enabled);
bool getSkiesEnabled(void) const;
void setShadowsEnabled(bool enabled);
bool getShadowsEnabled(void) const;
void setVisibilityMask(uint32 mask) { mVisibilityMask = mask; }
uint getVisibilityMask(void) const { return mVisibilityMask; }
virtual void setRenderQueueInvocationSequenceName(const String& sequenceName);
virtual const String& getRenderQueueInvocationSequenceName(void) const;
RenderQueueInvocationSequence* _getRenderQueueInvocationSequence(void);
void pointOrientedToScreen(const Vector2 &v, int orientationMode, Vector2 &outv);
void pointOrientedToScreen(Real orientedX, Real orientedY, int orientationMode,
Real &screenX, Real &screenY);
void addListener(Listener* l);
void removeListener(Listener* l);
protected:
Camera* mCamera;
RenderTarget* mTarget;
float mRelLeft, mRelTop, mRelWidth, mRelHeight;
int mActLeft, mActTop, mActWidth, mActHeight;
int mZOrder;
ColourValue mBackColour;
Real mDepthClearValue;
bool mClearEveryFrame;
unsigned int mClearBuffers;
bool mUpdated;
bool mShowOverlays;
bool mShowSkies;
bool mShowShadows;
uint32 mVisibilityMask;
// Render queue invocation sequence name
String mRQSequenceName;
RenderQueueInvocationSequence* mRQSequence;
String mMaterialSchemeName;
OrientationMode mOrientationMode;
static OrientationMode mDefaultOrientationMode;
bool mIsAutoUpdated;
typedef vector<Listener*>::type ListenerList;
ListenerList mListeners;
};
}
#include "OgreHeaderSuffix.h"
#endif
Ogre::RenderTarget
A &#39;canvas&#39; which can receive the results of a rendering operation.
Definition: OgreRenderTarget.h:65
Ogre::Viewport::mDepthClearValue
Real mDepthClearValue
Definition: OgreViewport.h:400
Ogre::Viewport::mShowOverlays
bool mShowOverlays
Definition: OgreViewport.h:404
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::Viewport::mOrientationMode
OrientationMode mOrientationMode
Viewport orientation mode.
Definition: OgreViewport.h:414
Ogre::uint
unsigned int uint
Definition: OgrePrerequisites.h:114
Ogre::Viewport::mDefaultOrientationMode
static OrientationMode mDefaultOrientationMode
Definition: OgreViewport.h:415
Ogre::Viewport::mRQSequenceName
String mRQSequenceName
Definition: OgreViewport.h:409
Ogre::Viewport::mListeners
ListenerList mListeners
Definition: OgreViewport.h:421
Ogre::Viewport::Listener
Listener interface so you can be notified of Viewport changes.
Definition: OgreViewport.h:61
Ogre::Viewport::mMaterialSchemeName
String mMaterialSchemeName
Material scheme.
Definition: OgreViewport.h:412
Ogre::Vector2
Standard 2-dimensional vector.
Definition: OgreVector2.h:51
Ogre::ColourValue
Class representing colour.
Definition: OgreColourValue.h:57
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::FBT_COLOUR
Definition: OgreCommon.h:296
Ogre::ColourValue::Black
static const ColourValue Black
Definition: OgreColourValue.h:61
Ogre::Viewport::mBackColour
ColourValue mBackColour
Background options.
Definition: OgreViewport.h:399
Ogre::Viewport::mRelWidth
float mRelWidth
Definition: OgreViewport.h:393
Ogre::Viewport
An abstraction of a viewport, i.e.
Definition: OgreViewport.h:57
Ogre::Viewport::setVisibilityMask
void setVisibilityMask(uint32 mask)
Sets a per-viewport visibility mask.
Definition: OgreViewport.h:354
Ogre::Viewport::Listener::viewportDestroyed
virtual void viewportDestroyed(Viewport *viewport)
Notification of when target listening Viewport&#39;s is destroyed.
Definition: OgreViewport.h:73
Ogre::Viewport::Listener::viewportDimensionsChanged
virtual void viewportDimensionsChanged(Viewport *viewport)
Notification of when target listening Viewport&#39;s dimensions changed.
Definition: OgreViewport.h:70
Ogre::Viewport::Listener::viewportCameraChanged
virtual void viewportCameraChanged(Viewport *viewport)
Notification of when a new camera is set to target listening Viewport.
Definition: OgreViewport.h:67
OgreCommon.h
Ogre::Viewport::getMaterialScheme
const String & getMaterialScheme(void) const
Get the material scheme which the viewport should use.
Definition: OgreViewport.h:280
Ogre::OrientationMode
OrientationMode
Specifies orientation mode.
Definition: OgreFrustum.h:49
Ogre::RenderQueueInvocationSequence
Class to hold a linear sequence of RenderQueueInvocation objects.
Definition: OgreRenderQueueInvocation.h:173
Ogre::Viewport::mActWidth
int mActWidth
Definition: OgreViewport.h:395
Ogre::Viewport::getVisibilityMask
uint getVisibilityMask(void) const
Gets a per-viewport visibility mask.
Definition: OgreViewport.h:359
OgrePrerequisites.h
Ogre::Viewport::mCamera
Camera * mCamera
Definition: OgreViewport.h:390
Ogre::Viewport::Listener::~Listener
virtual ~Listener()
Definition: OgreViewport.h:64
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::Viewport::mClearEveryFrame
bool mClearEveryFrame
Definition: OgreViewport.h:401
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
OgreHeaderSuffix.h
Ogre::Viewport::mZOrder
int mZOrder
Z-order.
Definition: OgreViewport.h:397
Ogre::Viewport::mRQSequence
RenderQueueInvocationSequence * mRQSequence
Definition: OgreViewport.h:410
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::Viewport::mVisibilityMask
uint32 mVisibilityMask
Definition: OgreViewport.h:407
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::Viewport::mTarget
RenderTarget * mTarget
Definition: OgreViewport.h:391
OgreFrustum.h
Ogre::vector
Definition: OgrePrerequisites.h:491
OgreColourValue.h
Ogre::Viewport::mShowShadows
bool mShowShadows
Definition: OgreViewport.h:406
OgreHeaderPrefix.h
Ogre::Viewport::mUpdated
bool mUpdated
Definition: OgreViewport.h:403
Ogre::FBT_DEPTH
Definition: OgreCommon.h:297
Ogre::Viewport::ListenerList
vector< Listener * >::type ListenerList
Definition: OgreViewport.h:420
Ogre::Viewport::mIsAutoUpdated
bool mIsAutoUpdated
Automatic rendering on/off.
Definition: OgreViewport.h:418
Ogre::Viewport::mShowSkies
bool mShowSkies
Definition: OgreViewport.h:405
Ogre::Viewport::setMaterialScheme
void setMaterialScheme(const String &schemeName)
Set the material scheme which the viewport should use.
Definition: OgreViewport.h:275
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre::Viewport::mClearBuffers
unsigned int mClearBuffers
Definition: OgreViewport.h:402

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.