OGRE  1.9.0
OgreCompositorChain.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __CompositorChain_H__
29#define __CompositorChain_H__
30
31#include "OgrePrerequisites.h"
35#include "OgreCompositor.h"
36#include "OgreViewport.h"
37#include "OgreHeaderPrefix.h"
38
39namespace Ogre {
49 {
50 public:
56
60
62 static const size_t LAST = (size_t)-1;
64 static const size_t BEST = 0;
65
74 CompositorInstance* addCompositor(CompositorPtr filter, size_t addPosition=LAST, const String& scheme = StringUtil::BLANK);
75
80 void removeCompositor(size_t position=LAST);
81
85
89
93
97
100 CompositorInstance* _getOriginalSceneCompositor(void) { return mOriginalScene; }
101
105
112 void setCompositorEnabled(size_t position, bool state);
113
115 virtual void preRenderTargetUpdate(const RenderTargetEvent& evt);
122
124 virtual void viewportCameraChanged(Viewport* viewport);
126 virtual void viewportDimensionsChanged(Viewport* viewport);
128 virtual void viewportDestroyed(Viewport* viewport);
129
133
137
142
145
148 void _compile();
149
156
157 protected:
160
164
167
169 bool mDirty;
172
174
183
186
190
194
197
200
203 {
204 public:
205 RQListener() : mOperation(0), mSceneManager(0), mRenderSystem(0), mViewport(0) {}
206
209 virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, bool& skipThisInvocation);
212 virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, bool& repeatThisInvocation);
213
216
218 void notifyViewport(Viewport* vp) { mViewport = vp; }
219
221 void flushUpTo(uint8 id);
222 private:
227 CompositorInstance::RenderSystemOpPairs::iterator currentOp, lastOp;
228 };
242
243 };
246} // namespace Ogre
247
248#include "OgreHeaderSuffix.h"
249
250#endif // __CompositorChain_H__
#define _OgreExport
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
A viewpoint from which the scene will be rendered.
Definition OgreCamera.h:87
Render queue listener used to set up rendering events.
void notifyViewport(Viewport *vp)
Notify current destination viewport.
void flushUpTo(uint8 id)
Flush remaining render system operations.
void setOperation(CompositorInstance::TargetOperation *op, SceneManager *sm, RenderSystem *rs)
Set current operation and target.
CompositorInstance::TargetOperation * mOperation
virtual void renderQueueStarted(uint8 queueGroupId, const String &invocation, bool &skipThisInvocation)
Event raised before a queue group is rendered.
virtual void renderQueueEnded(uint8 queueGroupId, const String &invocation, bool &repeatThisInvocation)
Event raised after a queue group is rendered.
CompositorInstance::RenderSystemOpPairs::iterator currentOp
Chain of compositor effects applying to one viewport.
CompositorInstance * getCompositor(size_t index)
Get compositor instance by position.
CompositorInstance * getCompositor(const String &name)
Get compositor instance by name.
vector< CompositorInstance * >::type Instances
Data types.
void _markDirty()
Mark state as dirty, and to be recompiled next frame.
void removeCompositor(size_t position=LAST)
Remove a compositor.
size_t getNumCompositors()
Get the number of compositors.
void preTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam)
Prepare a viewport, the camera and the scene for a rendering operation.
CompositorInstance::CompiledState mCompiledState
Compiled state (updated with _compile)
Viewport * getViewport()
Get viewport that is the target of this chain.
virtual void preRenderTargetUpdate(const RenderTargetEvent &evt)
RenderSystemOperations mRenderSystemOperations
bool mDirty
State needs recompile.
bool mOldFindVisibleObjects
Store old find visible objects.
void setCompositorEnabled(size_t position, bool state)
Enable or disable a compositor, by position.
void _queuedOperation(CompositorInstance::RenderSystemOperation *op)
Internal method for registering a queued operation for deletion later.
virtual void postViewportUpdate(const RenderTargetViewportEvent &evt)
CompositorInstance * getPreviousInstance(CompositorInstance *curr, bool activeOnly=true)
Get the previous instance in this chain to the one specified.
CompositorInstance * addCompositor(CompositorPtr filter, size_t addPosition=LAST, const String &scheme=StringUtil::BLANK)
Apply a compositor.
CompositorInstance * _getOriginalSceneCompositor(void)
Get the original scene compositor instance for this chain (internal use).
Viewport * mViewport
Viewport affected by this CompositorChain.
void destroyResources(void)
destroy internal resources
void clearCompiledState()
Clear compiled state.
virtual void viewportDimensionsChanged(Viewport *viewport)
bool mAnyCompositorsEnabled
Any compositors enabled?
void removeAllCompositors()
Remove all compositors.
CompositorInstance::TargetOperation mOutputOperation
float mOldLodBias
Store old camera LOD bias.
void _removeInstance(CompositorInstance *i)
Remove a compositor by pointer.
CompositorInstance * getNextInstance(CompositorInstance *curr, bool activeOnly=true)
Get the next instance in this chain to the one specified.
virtual ~CompositorChain()
Another gcc warning here, which is no problem because RenderTargetListener is never used to delete an...
String mOldMaterialScheme
Store old viewport material scheme.
void _compile()
Compile this Composition chain into a series of RenderTarget operations.
vector< CompositorInstance::RenderSystemOperation * >::type RenderSystemOperations
Render System operations queued by last compile, these are created by this instance thus managed and ...
virtual void postRenderTargetUpdate(const RenderTargetEvent &evt)
CompositorInstance * mOriginalScene
Plainly renders the scene; implicit first compositor in the chain.
CompositorChain(Viewport *vp)
void postTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam)
Restore a viewport, the camera and the scene after a rendering operation.
bool mOldShadowsEnabled
Store old shadows enabled flag.
VectorIterator< Instances > InstanceIterator
virtual void preViewportUpdate(const RenderTargetViewportEvent &evt)
virtual void viewportDestroyed(Viewport *viewport)
Instances mInstances
Postfilter instances in this chain.
unsigned int mOldClearEveryFrameBuffers
Old viewport settings.
InstanceIterator getCompositors()
Get an iterator over the compositor instances.
uint32 mOldVisibilityMask
Store old scene visibility mask.
virtual void viewportCameraChanged(Viewport *viewport)
Operation setup for a RenderTarget (collected).
An instance of a Compositor object for one Viewport.
vector< TargetOperation >::type CompiledState
Abstract interface which classes must implement if they wish to receive events from the render queue.
Defines the functionality of a 3D API.
A interface class defining a listener which can be used to receive notifications of RenderTarget even...
Manages the organisation and rendering of a 'scene' i.e.
Reference-counted shared pointer, used for objects where implicit destruction is required.
Concrete IteratorWrapper for nonconst access to the underlying container.
Listener interface so you can be notified of Viewport changes.
An abstraction of a viewport, i.e.
unsigned char uint8
unsigned int uint32
_StringBase String
Struct containing information about a RenderTarget event.
Struct containing information about a RenderTarget Viewport-specific event.
std::vector< T, A > type