OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-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 __CompositorInstance_H__
29 #define __CompositorInstance_H__
30 
31 #include "OgrePrerequisites.h"
32 #include "OgreMaterialManager.h"
33 #include "OgreTexture.h"
34 #include "OgreRenderQueue.h"
36 
37 namespace Ogre {
45 
50  {
51  public:
53  virtual ~CompositorInstance();
58  {
59  public:
60  virtual ~Listener();
61 
71  virtual void notifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
72 
81  virtual void notifyMaterialRender(uint32 pass_id, MaterialPtr &mat);
82 
86  virtual void notifyResourcesCreated(bool forResizeOnly);
87 
88  };
94  {
95  public:
96  virtual ~RenderSystemOperation();
98  virtual void execute(SceneManager *sm, RenderSystem *rs) = 0;
99  };
101  typedef std::pair<int, RenderSystemOperation*> RenderSystemOpPair;
106  {
107  public:
109  {
110  }
112  target(inTarget), currentQueueGroupID(0), visibilityMask(0xFFFFFFFF),
113  lodBias(1.0f),
114  onlyInitial(false), hasBeenRendered(false), findVisibleObjects(false),
115  materialScheme(MaterialManager::DEFAULT_SCHEME_NAME), shadowsEnabled(true)
116  {
117  }
120 
123 
127 
131 
134  float lodBias;
135 
138  typedef std::bitset<RENDER_QUEUE_COUNT> RenderQueueBitSet;
139 
142 
157  };
159 
163  void setEnabled(bool value);
164 
167  bool getEnabled();
168 
179  const String& getTextureInstanceName(const String& name, size_t mrtIndex);
180 
191  TexturePtr getTextureInstance(const String& name, size_t mrtIndex);
192 
199  RenderTarget* getRenderTarget(const String& name);
200 
201 
205  virtual void _compileTargetOperations(CompiledState &compiledState);
206 
210  virtual void _compileOutputOperation(TargetOperation &finalState);
211 
214  Compositor *getCompositor();
215 
218  CompositionTechnique *getTechnique();
219 
225  void setTechnique(CompositionTechnique* tech, bool reuseTextures = true);
226 
238  void setScheme(const String& schemeName, bool reuseTextures = true);
239 
241  const String& getScheme() const { return mActiveScheme; }
242 
248  void notifyResized();
249 
250 
253  CompositorChain *getChain();
254 
260  void addListener(Listener *l);
261 
265  void removeListener(Listener *l);
266 
269  void _fireNotifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
270 
273  void _fireNotifyMaterialRender(uint32 pass_id, MaterialPtr &mat);
274 
277  void _fireNotifyResourcesCreated(bool forResizeOnly);
278  private:
286  bool mEnabled;
299 
303 
306 
309 
313  virtual void collectPasses(TargetOperation &finalState, CompositionTargetPass *target);
314 
319  MaterialPtr createLocalMaterial(const String& srcName);
320 
323  void createResources(bool forResizeOnly);
324 
327  void freeResources(bool forResizeOnly, bool clearReserveTextures);
328 
331  RenderTarget *getTargetForTex(const String &name);
332 
337  const String &getSourceForTex(const String &name, size_t mrtIndex = 0);
338 
342  void queueRenderSystemOp(TargetOperation &finalState, RenderSystemOperation *op);
343 
345  String getMRTTexLocalName(const String& baseName, size_t attachment);
346 
350  void deriveTextureRenderTargetOptions(const String& texname,
351  bool *hwGammaWrite, uint *fsaa, String* fsaaHint);
352 
353  friend class CompositorChain;
354  };
358 }
359 
360 #endif
Chain of compositor effects applying to one viewport.
A 'canvas' which can receive the results of a rendering operation.
CompositionTechnique * mTechnique
Composition technique used by this instance.
ReserveTextureMap mReserveTextures
Textures that are not currently in use, but that we want to keep for now, for example if we switch te...
map< String, MultiRenderTarget * >::type LocalMRTMap
Store a list of MRTs we've created.
unsigned int uint32
Definition: OgrePlatform.h:246
#define _OgreExport
Definition: OgrePlatform.h:203
bool shadowsEnabled
Whether shadows will be enabled.
vector< RenderSystemOpPair >::type RenderSystemOpPairs
Manages the organisation and rendering of a 'scene' i.e.
std::bitset< RENDER_QUEUE_COUNT > RenderQueueBitSet
A set of render queues to either include or exclude certain render queues.
bool hasBeenRendered
"Has been rendered" flag; used in combination with onlyInitial to determine whether to skip this targ...
String materialScheme
Which material scheme this op will use.
map< String, TexturePtr >::type LocalTextureMap
Map from name->local texture.
CompositorInstance * mPreviousInstance
Previous instance (set by chain)
Class representing a Compositor object.
bool mEnabled
Is this instance enabled?
map< int, MaterialPtr >::type QuadMaterialMap
RenderQueueBitSet renderQueues
Which renderqueues to render from scene.
CompositorChain * mChain
Composition chain of which this instance is part.
Class for managing Material settings for Ogre.
Provides an interface to "listen in" to to render system operations executed by this CompositorInstan...
Compositor * mCompositor
Compositor of which this is an instance.
const String & getScheme() const
Returns the name of the scheme this compositor is using.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Specialisation of SharedPtr to allow SharedPtr to be assigned to TexturePtr.
Definition: OgreTexture.h:440
bool findVisibleObjects
Whether this op needs to find visible scene objects or not.
vector< TargetOperation >::type CompiledState
const size_t RENDER_QUEUE_COUNT
RenderSystemOpPairs renderSystemOperations
RenderSystem operations to queue into the scene manager, by uint8.
Base composition technique, can be subclassed in plugins.
std::map< K, V, P, A > type
An instance of a Compositor object for one Viewport.
uint32 visibilityMask
Scene visibility mask If this is 0, the scene is not rendered at all.
Operation setup for a RenderTarget (collected).
vector< Listener * >::type Listeners
Vector of listeners.
Final possible render queue, don't exceed this.
String mActiveScheme
The scheme which is being used in this instance.
_StringBase String
Specialisation of SharedPtr to allow SharedPtr to be assigned to MaterialPtr.
Definition: OgreMaterial.h:677
Defines the functionality of a 3D API.
std::pair< int, RenderSystemOperation * > RenderSystemOpPair
unsigned int uint
Object representing one render to a RenderTarget or Viewport in the Ogre Composition framework...
map< CompositionTechnique::TextureDefinition *, TexturePtr >::type ReserveTextureMap