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-2013 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 #include "OgreViewport.h"
37 #include "OgreHeaderPrefix.h"
38 
39 namespace Ogre {
49  {
50  public:
55  virtual ~CompositorChain();
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 
84  size_t getNumCompositors();
85 
88  void removeAllCompositors();
89 
92  CompositorInstance *getCompositor(size_t index);
93 
96  CompositorInstance *getCompositor(const String& name);
97 
100  CompositorInstance* _getOriginalSceneCompositor(void) { return mOriginalScene; }
101 
104  InstanceIterator getCompositors();
105 
112  void setCompositorEnabled(size_t position, bool state);
113 
115  virtual void preRenderTargetUpdate(const RenderTargetEvent& evt);
117  virtual void postRenderTargetUpdate(const RenderTargetEvent& evt);
119  virtual void preViewportUpdate(const RenderTargetViewportEvent& evt);
121  virtual void postViewportUpdate(const RenderTargetViewportEvent& evt);
122 
124  virtual void viewportCameraChanged(Viewport* viewport);
126  virtual void viewportDimensionsChanged(Viewport* viewport);
128  virtual void viewportDestroyed(Viewport* viewport);
129 
132  void _markDirty();
133 
136  Viewport *getViewport();
137 
141  void _removeInstance(CompositorInstance *i);
142 
144  void _queuedOperation(CompositorInstance::RenderSystemOperation* op);
145 
148  void _compile();
149 
152  CompositorInstance* getPreviousInstance(CompositorInstance* curr, bool activeOnly = true);
155  CompositorInstance* getNextInstance(CompositorInstance* curr, bool activeOnly = true);
156 
157  protected:
160 
164 
167 
169  bool mDirty;
172 
174 
183 
185  void clearCompiledState();
186 
189  void preTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
190 
193  void postTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
194 
195  void createOriginalScene();
196  void destroyOriginalScene();
197 
199  void destroyResources(void);
200 
203  {
204  public:
207  virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, bool& skipThisInvocation);
210  virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, bool& repeatThisInvocation);
211 
213  void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs);
214 
216  void notifyViewport(Viewport* vp) { mViewport = vp; }
217 
219  void flushUpTo(uint8 id);
220  private:
225  CompositorInstance::RenderSystemOpPairs::iterator currentOp, lastOp;
226  };
235  float mOldLodBias;
240 
241  };
244 } // namespace Ogre
245 
246 #include "OgreHeaderSuffix.h"
247 
248 #endif // __CompositorChain_H__

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Oct 23 2013 06:57:23