OgreCompositorChain.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 __CompositorChain_H__
#define __CompositorChain_H__
#include "OgrePrerequisites.h"
#include "OgreRenderTargetListener.h"
#include "OgreRenderQueueListener.h"
#include "OgreCompositorInstance.h"
#include "OgreCompositor.h"
#include "OgreViewport.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
class _OgreExport CompositorChain : public RenderTargetListener, public Viewport::Listener, public CompositorInstAlloc
{
public:
CompositorChain(Viewport *vp);
virtual ~CompositorChain();
typedef vector<CompositorInstance*>::type Instances;
typedef VectorIterator<Instances> InstanceIterator;
static const size_t LAST = (size_t)-1;
static const size_t BEST = 0;
CompositorInstance* addCompositor(CompositorPtr filter, size_t addPosition=LAST, const String& scheme = StringUtil::BLANK);
void removeCompositor(size_t position=LAST);
size_t getNumCompositors();
void removeAllCompositors();
CompositorInstance *getCompositor(size_t index);
CompositorInstance *getCompositor(const String& name);
CompositorInstance* _getOriginalSceneCompositor(void) { return mOriginalScene; }
InstanceIterator getCompositors();
void setCompositorEnabled(size_t position, bool state);
virtual void preRenderTargetUpdate(const RenderTargetEvent& evt);
virtual void postRenderTargetUpdate(const RenderTargetEvent& evt);
virtual void preViewportUpdate(const RenderTargetViewportEvent& evt);
virtual void postViewportUpdate(const RenderTargetViewportEvent& evt);
virtual void viewportCameraChanged(Viewport* viewport);
virtual void viewportDimensionsChanged(Viewport* viewport);
virtual void viewportDestroyed(Viewport* viewport);
void _markDirty();
Viewport *getViewport();
void _removeInstance(CompositorInstance *i);
void _queuedOperation(CompositorInstance::RenderSystemOperation* op);
void _compile();
CompositorInstance* getPreviousInstance(CompositorInstance* curr, bool activeOnly = true);
CompositorInstance* getNextInstance(CompositorInstance* curr, bool activeOnly = true);
protected:
Viewport *mViewport;
CompositorInstance *mOriginalScene;
Instances mInstances;
bool mDirty;
bool mAnyCompositorsEnabled;
String mOriginalSceneScheme;
CompositorInstance::CompiledState mCompiledState;
CompositorInstance::TargetOperation mOutputOperation;
typedef vector<CompositorInstance::RenderSystemOperation*>::type RenderSystemOperations;
RenderSystemOperations mRenderSystemOperations;
void clearCompiledState();
void preTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
void postTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
void createOriginalScene();
void destroyOriginalScene();
void destroyResources(void);
class _OgreExport RQListener: public RenderQueueListener
{
public:
RQListener() : mOperation(0), mSceneManager(0), mRenderSystem(0), mViewport(0) {}
virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, bool& skipThisInvocation);
virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, bool& repeatThisInvocation);
void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs);
void notifyViewport(Viewport* vp) { mViewport = vp; }
void flushUpTo(uint8 id);
private:
CompositorInstance::TargetOperation *mOperation;
SceneManager *mSceneManager;
RenderSystem *mRenderSystem;
Viewport* mViewport;
CompositorInstance::RenderSystemOpPairs::iterator currentOp, lastOp;
};
RQListener mOurListener;
unsigned int mOldClearEveryFrameBuffers;
uint32 mOldVisibilityMask;
bool mOldFindVisibleObjects;
float mOldLodBias;
String mOldMaterialScheme;
bool mOldShadowsEnabled;
};
} // namespace Ogre
#include "OgreHeaderSuffix.h"
#endif // __CompositorChain_H__
OgreRenderQueueListener.h
Ogre::VectorIterator
Concrete IteratorWrapper for nonconst access to the underlying container.
Definition: OgreIteratorWrapper.h:186
OgreCompositorInstance.h
Ogre::CompositorChain::mOriginalSceneScheme
String mOriginalSceneScheme
Definition: OgreCompositorChain.h:173
Ogre::CompositorChain::mOldMaterialScheme
String mOldMaterialScheme
Store old viewport material scheme.
Definition: OgreCompositorChain.h:239
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::Viewport::Listener
Listener interface so you can be notified of Viewport changes.
Definition: OgreViewport.h:61
Ogre::CompositorInstance
An instance of a Compositor object for one Viewport.
Definition: OgreCompositorInstance.h:50
Ogre::CompositorChain::mOldFindVisibleObjects
bool mOldFindVisibleObjects
Store old find visible objects.
Definition: OgreCompositorChain.h:235
Ogre::CompositorInstance::TargetOperation
Operation setup for a RenderTarget (collected).
Definition: OgreCompositorInstance.h:111
Ogre::Viewport
An abstraction of a viewport, i.e.
Definition: OgreViewport.h:57
Ogre::CompositorChain::RQListener::mOperation
CompositorInstance::TargetOperation * mOperation
Definition: OgreCompositorChain.h:223
Ogre::CompositorChain::mOutputOperation
CompositorInstance::TargetOperation mOutputOperation
Definition: OgreCompositorChain.h:177
OgrePrerequisites.h
OgreViewport.h
Ogre::CompositorChain::mOldClearEveryFrameBuffers
unsigned int mOldClearEveryFrameBuffers
Old viewport settings.
Definition: OgreCompositorChain.h:231
Ogre::uint8
unsigned char uint8
Definition: OgrePlatform.h:361
Ogre::RenderSystem
Defines the functionality of a 3D API.
Definition: OgreRenderSystem.h:125
Ogre::CompositorChain::mInstances
Instances mInstances
Postfilter instances in this chain.
Definition: OgreCompositorChain.h:166
Ogre::CompositorChain::RQListener::mRenderSystem
RenderSystem * mRenderSystem
Definition: OgreCompositorChain.h:225
Ogre::CompositorInstance::CompiledState
vector< TargetOperation >::type CompiledState
Definition: OgreCompositorInstance.h:164
Ogre::CompositorChain::InstanceIterator
VectorIterator< Instances > InstanceIterator
Definition: OgreCompositorChain.h:59
Ogre::RenderTargetViewportEvent
Struct containing information about a RenderTarget Viewport-specific event.
Definition: OgreRenderTargetListener.h:52
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::CompositorChain::RQListener::mViewport
Viewport * mViewport
Definition: OgreCompositorChain.h:226
Ogre::CompositorChain::mAnyCompositorsEnabled
bool mAnyCompositorsEnabled
Any compositors enabled?
Definition: OgreCompositorChain.h:171
Ogre::CompositorChain::mRenderSystemOperations
RenderSystemOperations mRenderSystemOperations
Definition: OgreCompositorChain.h:182
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
Ogre::CompositorChain
Chain of compositor effects applying to one viewport.
Definition: OgreCompositorChain.h:48
OgreHeaderSuffix.h
Ogre::CompositorChain::mOriginalScene
CompositorInstance * mOriginalScene
Plainly renders the scene; implicit first compositor in the chain.
Definition: OgreCompositorChain.h:163
Ogre::CompositorInstance::RenderSystemOperation
Specific render system operation.
Definition: OgreCompositorInstance.h:99
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::RenderQueueListener
Abstract interface which classes must implement if they wish to receive events from the render queue...
Definition: OgreRenderQueueListener.h:56
Ogre::CompositorChain::RenderSystemOperations
vector< CompositorInstance::RenderSystemOperation * >::type RenderSystemOperations
Render System operations queued by last compile, these are created by this instance thus managed and ...
Definition: OgreCompositorChain.h:181
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::CompositorChain::RQListener::lastOp
CompositorInstance::RenderSystemOpPairs::iterator lastOp
Definition: OgreCompositorChain.h:227
Ogre::RenderTargetEvent
Struct containing information about a RenderTarget event.
Definition: OgreRenderTargetListener.h:44
Ogre::RenderTargetListener
A interface class defining a listener which can be used to receive notifications of RenderTarget even...
Definition: OgreRenderTargetListener.h:77
Ogre::SharedPtr
Reference-counted shared pointer, used for objects where implicit destruction is required.
Definition: OgrePrerequisites.h:310
Ogre::vector
Definition: OgrePrerequisites.h:491
OgreHeaderPrefix.h
Ogre::CompositorChain::RQListener::mSceneManager
SceneManager * mSceneManager
Definition: OgreCompositorChain.h:224
Ogre::CompositorChain::RQListener::notifyViewport
void notifyViewport(Viewport *vp)
Notify current destination viewport.
Definition: OgreCompositorChain.h:218
Ogre::CompositorChain::mCompiledState
CompositorInstance::CompiledState mCompiledState
Compiled state (updated with _compile)
Definition: OgreCompositorChain.h:176
Ogre::CompositorChain::mOldVisibilityMask
uint32 mOldVisibilityMask
Store old scene visibility mask.
Definition: OgreCompositorChain.h:233
Ogre::CompositorChain::mOurListener
RQListener mOurListener
Definition: OgreCompositorChain.h:229
Ogre::CompositorChain::mDirty
bool mDirty
State needs recompile.
Definition: OgreCompositorChain.h:169
OgreCompositor.h
Ogre::CompositorChain::mViewport
Viewport * mViewport
Viewport affected by this CompositorChain.
Definition: OgreCompositorChain.h:159
Ogre::CompositorChain::_getOriginalSceneCompositor
CompositorInstance * _getOriginalSceneCompositor(void)
Get the original scene compositor instance for this chain (internal use).
Definition: OgreCompositorChain.h:100
Ogre::CompositorChain::mOldLodBias
float mOldLodBias
Store old camera LOD bias.
Definition: OgreCompositorChain.h:237
Ogre::SceneManager
Manages the organisation and rendering of a &#39;scene&#39; i.e.
Definition: OgreSceneManager.h:143
Ogre::CompositorChain::mOldShadowsEnabled
bool mOldShadowsEnabled
Store old shadows enabled flag.
Definition: OgreCompositorChain.h:241
OgreRenderTargetListener.h
Ogre::CompositorChain::RQListener
Render queue listener used to set up rendering events.
Definition: OgreCompositorChain.h:202
Ogre::StringUtil::BLANK
static const String BLANK
Constant blank string, useful for returning by ref where local does not exist.
Definition: OgreString.h:196
Ogre::CompositorChain::RQListener::RQListener
RQListener()
Definition: OgreCompositorChain.h:205
Ogre::CompositorChain::Instances
vector< CompositorInstance * >::type Instances
Data types.
Definition: OgreCompositorChain.h:58
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58

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