OgreCompositorInstance.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 __CompositorInstance_H__
29 #define __CompositorInstance_H__
30 
31 #include "OgrePrerequisites.h"
32 #include "OgreMaterialManager.h"
33 #include "OgreTexture.h"
34 #include "OgreRenderQueue.h"
36 #include "OgreHeaderPrefix.h"
37 
38 namespace Ogre {
46 
51  {
52  public:
54  virtual ~CompositorInstance();
59  {
60  public:
61  virtual ~Listener();
62 
74  virtual void notifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
75 
86  virtual void notifyMaterialRender(uint32 pass_id, MaterialPtr &mat);
87 
92  virtual void notifyResourcesCreated(bool forResizeOnly);
93 
94  };
100  {
101  public:
102  virtual ~RenderSystemOperation();
104  virtual void execute(SceneManager *sm, RenderSystem *rs) = 0;
105  };
107  typedef std::pair<int, RenderSystemOperation*> RenderSystemOpPair;
112  {
113  public:
115  {
116  }
118  target(inTarget), currentQueueGroupID(0), visibilityMask(0xFFFFFFFF),
119  lodBias(1.0f),
120  onlyInitial(false), hasBeenRendered(false), findVisibleObjects(false),
121  materialScheme(MaterialManager::DEFAULT_SCHEME_NAME), shadowsEnabled(true)
122  {
123  }
126 
129 
133 
137 
140  float lodBias;
141 
144  typedef std::bitset<RENDER_QUEUE_COUNT> RenderQueueBitSet;
145 
148 
163  };
165 
170  void setEnabled(bool value);
171 
174  bool getEnabled() const { return mEnabled; }
175 
182  void setAlive(bool value);
183 
186  bool getAlive() const { return mAlive; }
187 
201  const String& getTextureInstanceName(const String& name, size_t mrtIndex);
202 
216  TexturePtr getTextureInstance(const String& name, size_t mrtIndex);
217 
224  RenderTarget* getRenderTarget(const String& name);
225 
226 
231  virtual void _compileTargetOperations(CompiledState &compiledState);
232 
236  virtual void _compileOutputOperation(TargetOperation &finalState);
237 
240  Compositor *getCompositor();
241 
244  CompositionTechnique *getTechnique();
245 
253  void setTechnique(CompositionTechnique* tech, bool reuseTextures = true);
254 
268  void setScheme(const String& schemeName, bool reuseTextures = true);
269 
271  const String& getScheme() const { return mTechnique ? mTechnique->getSchemeName() : StringUtil::BLANK; }
272 
278  void notifyResized();
279 
282  CompositorChain *getChain();
283 
289  void addListener(Listener *l);
290 
294  void removeListener(Listener *l);
295 
298  void _fireNotifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
299 
302  void _fireNotifyMaterialRender(uint32 pass_id, MaterialPtr &mat);
303 
306  void _fireNotifyResourcesCreated(bool forResizeOnly);
307  private:
315  bool mEnabled;
317  bool mAlive;
330 
334 
337 
341  virtual void collectPasses(TargetOperation &finalState, CompositionTargetPass *target);
342 
347  MaterialPtr createLocalMaterial(const String& srcName);
348 
351  void createResources(bool forResizeOnly);
352 
355  void freeResources(bool forResizeOnly, bool clearReserveTextures);
356 
359  RenderTarget *getTargetForTex(const String &name);
360 
367  const String &getSourceForTex(const String &name, size_t mrtIndex = 0);
368 
371  void queueRenderSystemOp(TargetOperation &finalState, RenderSystemOperation *op);
372 
374  String getMRTTexLocalName(const String& baseName, size_t attachment);
375 
379  void deriveTextureRenderTargetOptions(const String& texname,
380  bool *hwGammaWrite, uint *fsaa, String* fsaaHint);
381 
383  void notifyCameraChanged(Camera* camera);
384 
385  friend class CompositorChain;
386  };
390 } // namespace Ogre
391 
392 #include "OgreHeaderSuffix.h"
393 
394 #endif // __CompositorInstance_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 16 2013 14:35:42