OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreCompositorChain.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __CompositorChain_H__
29 #define __CompositorChain_H__
30 
31 #include "OgrePrerequisites.h"
34 #include "OgreCompositorInstance.h"
35 #include "OgreCompositor.h"
36 namespace Ogre {
37 
47  {
48  public:
54  virtual ~CompositorChain();
55 
59 
61  static const size_t LAST = (size_t)-1;
63  static const size_t BEST = 0;
64 
70  CompositorInstance* addCompositor(CompositorPtr filter, size_t addPosition=LAST, const String& scheme = StringUtil::BLANK);
71 
75  void removeCompositor(size_t position=LAST);
76 
79  size_t getNumCompositors();
80 
83  void removeAllCompositors();
84 
87  CompositorInstance *getCompositor(size_t index);
88 
91  CompositorInstance *getCompositor(const String& name);
92 
95  CompositorInstance* _getOriginalSceneCompositor(void) { return mOriginalScene; }
96 
99  InstanceIterator getCompositors();
100 
106  void setCompositorEnabled(size_t position, bool state);
107 
109  virtual void preRenderTargetUpdate(const RenderTargetEvent& evt);
111  virtual void postRenderTargetUpdate(const RenderTargetEvent& evt);
113  virtual void preViewportUpdate(const RenderTargetViewportEvent& evt);
115  virtual void postViewportUpdate(const RenderTargetViewportEvent& evt);
117  virtual void viewportRemoved(const RenderTargetViewportEvent& evt);
118 
121  void _markDirty();
122 
125  Viewport *getViewport();
126 
128  void _notifyViewport(Viewport* vp);
129 
133  void _removeInstance(CompositorInstance *i);
134 
136  void _queuedOperation(CompositorInstance::RenderSystemOperation* op);
137 
140  void _compile();
141 
144  CompositorInstance* getPreviousInstance(CompositorInstance* curr, bool activeOnly = true);
147  CompositorInstance* getNextInstance(CompositorInstance* curr, bool activeOnly = true);
148 
149  protected:
152 
156 
159 
161  bool mDirty;
164 
173 
174 
176  void clearCompiledState();
177 
180  void preTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
181 
184  void postTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
185 
187  void destroyResources(void);
188 
191  {
192  public:
195  virtual void renderQueueStarted(uint8 id, const String& invocation, bool& skipThisQueue);
198  virtual void renderQueueEnded(uint8 id, const String& invocation, bool& repeatThisQueue);
199 
201  void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs);
202 
204  void notifyViewport(Viewport* vp) { mViewport = vp; }
205 
207  void flushUpTo(uint8 id);
208  private:
213  CompositorInstance::RenderSystemOpPairs::iterator currentOp, lastOp;
214  };
223  float mOldLodBias;
228 
229  };
232 }
233 
234 #endif
Chain of compositor effects applying to one viewport.
unsigned char uint8
Definition: OgrePlatform.h:248
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:85
void notifyViewport(Viewport *vp)
Notify current destination viewport.
unsigned int uint32
Definition: OgrePlatform.h:246
#define _OgreExport
Definition: OgrePlatform.h:203
CompositorInstance::RenderSystemOpPairs::iterator lastOp
Struct containing information about a RenderTarget Viewport-specific event.
unsigned int mOldClearEveryFrameBuffers
Old viewport settings.
CompositorInstance::CompiledState mCompiledState
Compiled state (updated with _compile)
Specialisation of SharedPtr to allow SharedPtr to be assigned to CompositorPtr.
Manages the organisation and rendering of a 'scene' i.e.
VectorIterator< Instances > InstanceIterator
bool mDirty
State needs recompile.
String mOldMaterialScheme
Store old viewport material scheme.
bool mOldShadowsEnabled
Store old shadows enabled flag.
Render queue listener used to set up rendering events.
Instances mInstances
Postfilter instances in this chain.
bool mAnyCompositorsEnabled
Any compositors enabled?
CompositorInstance * mOriginalScene
Plainly renders the scene; implicit first compositor in the chain.
Struct containing information about a RenderTarget event.
uint32 mOldVisibilityMask
Store old scene visibility mask.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Abstract interface which classes must implement if they wish to receive events from the render queue...
A interface class defining a listener which can be used to receive notifications of RenderTarget even...
vector< TargetOperation >::type CompiledState
bool mOldFindVisibleObjects
Store old find visible objects.
static const String BLANK
Constant blank string, useful for returning by ref where local does not exist.
Definition: OgreString.h:180
An abstraction of a viewport, i.e.
Definition: OgreViewport.h:56
An instance of a Compositor object for one Viewport.
float mOldLodBias
Store old camera LOD bias.
RenderSystemOperations mRenderSystemOperations
Operation setup for a RenderTarget (collected).
vector< CompositorInstance::RenderSystemOperation * >::type RenderSystemOperations
Render System operations queued by last compile, these are created by this instance thus managed and ...
Viewport * mViewport
Viewport affected by this CompositorChain.
_StringBase String
Concrete IteratorWrapper for nonconst access to the underlying container.
Defines the functionality of a 3D API.
CompositorInstance::TargetOperation mOutputOperation
vector< CompositorInstance * >::type Instances
Data types.
CompositorInstance::TargetOperation * mOperation
CompositorInstance * _getOriginalSceneCompositor(void)
Get the original scene compositor instance for this chain (internal use).