OgreCompositorInstance.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __CompositorInstance_H__
#define __CompositorInstance_H__
#include "OgrePrerequisites.h"
#include "OgreMaterialManager.h"
#include "OgreTexture.h"
#include "OgreRenderQueue.h"
#include "OgreCompositionTechnique.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
const size_t RENDER_QUEUE_COUNT = RENDER_QUEUE_MAX+1;
class _OgreExport CompositorInstance : public CompositorInstAlloc
{
public:
CompositorInstance(CompositionTechnique *technique, CompositorChain *chain);
virtual ~CompositorInstance();
class _OgreExport Listener
{
public:
virtual ~Listener();
virtual void notifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
virtual void notifyMaterialRender(uint32 pass_id, MaterialPtr &mat);
virtual void notifyResourcesCreated(bool forResizeOnly);
};
class _OgreExport RenderSystemOperation : public CompositorInstAlloc
{
public:
virtual ~RenderSystemOperation();
virtual void execute(SceneManager *sm, RenderSystem *rs) = 0;
};
typedef map<int, MaterialPtr>::type QuadMaterialMap;
typedef std::pair<int, RenderSystemOperation*> RenderSystemOpPair;
typedef vector<RenderSystemOpPair>::type RenderSystemOpPairs;
class TargetOperation
{
public:
TargetOperation()
{
}
TargetOperation(RenderTarget *inTarget):
target(inTarget), currentQueueGroupID(0), visibilityMask(0xFFFFFFFF),
lodBias(1.0f),
onlyInitial(false), hasBeenRendered(false), findVisibleObjects(false),
materialScheme(MaterialManager::DEFAULT_SCHEME_NAME), shadowsEnabled(true)
{
}
RenderTarget *target;
int currentQueueGroupID;
RenderSystemOpPairs renderSystemOperations;
uint32 visibilityMask;
float lodBias;
typedef std::bitset<RENDER_QUEUE_COUNT> RenderQueueBitSet;
RenderQueueBitSet renderQueues;
bool onlyInitial;
bool hasBeenRendered;
bool findVisibleObjects;
String materialScheme;
bool shadowsEnabled;
};
typedef vector<TargetOperation>::type CompiledState;
void setEnabled(bool value);
bool getEnabled() const { return mEnabled; }
void setAlive(bool value);
bool getAlive() const { return mAlive; }
const String& getTextureInstanceName(const String& name, size_t mrtIndex);
TexturePtr getTextureInstance(const String& name, size_t mrtIndex);
RenderTarget* getRenderTarget(const String& name);
virtual void _compileTargetOperations(CompiledState &compiledState);
virtual void _compileOutputOperation(TargetOperation &finalState);
Compositor *getCompositor();
CompositionTechnique *getTechnique();
void setTechnique(CompositionTechnique* tech, bool reuseTextures = true);
void setScheme(const String& schemeName, bool reuseTextures = true);
const String& getScheme() const { return mTechnique ? mTechnique->getSchemeName() : StringUtil::BLANK; }
void notifyResized();
CompositorChain *getChain();
void addListener(Listener *l);
void removeListener(Listener *l);
void _fireNotifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
void _fireNotifyMaterialRender(uint32 pass_id, MaterialPtr &mat);
void _fireNotifyResourcesCreated(bool forResizeOnly);
private:
Compositor *mCompositor;
CompositionTechnique *mTechnique;
CompositorChain *mChain;
bool mEnabled;
bool mAlive;
typedef map<String,TexturePtr>::type LocalTextureMap;
LocalTextureMap mLocalTextures;
typedef map<String,MultiRenderTarget*>::type LocalMRTMap;
LocalMRTMap mLocalMRTs;
typedef map<CompositionTechnique::TextureDefinition*, TexturePtr>::type ReserveTextureMap;
ReserveTextureMap mReserveTextures;
typedef vector<Listener*>::type Listeners;
Listeners mListeners;
CompositorInstance *mPreviousInstance;
virtual void collectPasses(TargetOperation &finalState, CompositionTargetPass *target);
MaterialPtr createLocalMaterial(const String& srcName);
void createResources(bool forResizeOnly);
void freeResources(bool forResizeOnly, bool clearReserveTextures);
RenderTarget *getTargetForTex(const String &name);
const String &getSourceForTex(const String &name, size_t mrtIndex = 0);
void queueRenderSystemOp(TargetOperation &finalState, RenderSystemOperation *op);
String getMRTTexLocalName(const String& baseName, size_t attachment);
void deriveTextureRenderTargetOptions(const String& texname,
bool *hwGammaWrite, uint *fsaa, String* fsaaHint);
void notifyCameraChanged(Camera* camera);
friend class CompositorChain;
};
} // namespace Ogre
#include "OgreHeaderSuffix.h"
#endif // __CompositorInstance_H__
Ogre::RenderTarget
A &#39;canvas&#39; which can receive the results of a rendering operation.
Definition: OgreRenderTarget.h:65
Ogre::CompositorInstance::mChain
CompositorChain * mChain
Composition chain of which this instance is part.
Definition: OgreCompositorInstance.h:313
Ogre::CompositorInstance::getEnabled
bool getEnabled() const
Get enabled flag.
Definition: OgreCompositorInstance.h:174
Ogre::CompositorInstance::mReserveTextures
ReserveTextureMap mReserveTextures
Textures that are not currently in use, but that we want to keep for now, for example if we switch te...
Definition: OgreCompositorInstance.h:329
Ogre::CompositorInstance::TargetOperation::onlyInitial
bool onlyInitial
Definition: OgreCompositorInstance.h:151
Ogre::CompositorInstance::Listeners
vector< Listener * >::type Listeners
Vector of listeners.
Definition: OgreCompositorInstance.h:332
OgreRenderQueue.h
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::uint
unsigned int uint
Definition: OgrePrerequisites.h:114
Ogre::CompositorInstance::TargetOperation::renderSystemOperations
RenderSystemOpPairs renderSystemOperations
RenderSystem operations to queue into the scene manager, by uint8.
Definition: OgreCompositorInstance.h:132
Ogre::CompositorInstance::TargetOperation::renderQueues
RenderQueueBitSet renderQueues
Which renderqueues to render from scene.
Definition: OgreCompositorInstance.h:147
Ogre::CompositorInstance
An instance of a Compositor object for one Viewport.
Definition: OgreCompositorInstance.h:50
Ogre::CompositionTargetPass
Object representing one render to a RenderTarget or Viewport in the Ogre Composition framework...
Definition: OgreCompositionTargetPass.h:45
Ogre::CompositorInstance::getAlive
bool getAlive() const
Get alive flag.
Definition: OgreCompositorInstance.h:186
Ogre::CompositorInstance::mLocalMRTs
LocalMRTMap mLocalMRTs
Definition: OgreCompositorInstance.h:323
Ogre::CompositorInstance::Listener
Provides an interface to "listen in" to to render system operations executed by this CompositorInstan...
Definition: OgreCompositorInstance.h:58
Ogre::CompositorInstance::TargetOperation
Operation setup for a RenderTarget (collected).
Definition: OgreCompositorInstance.h:111
Ogre::CompositorInstance::TargetOperation::target
RenderTarget * target
Target.
Definition: OgreCompositorInstance.h:125
Ogre::RENDER_QUEUE_COUNT
const size_t RENDER_QUEUE_COUNT
Definition: OgreCompositorInstance.h:45
Ogre::CompositorInstance::LocalTextureMap
map< String, TexturePtr >::type LocalTextureMap
Map from name->local texture.
Definition: OgreCompositorInstance.h:319
Ogre::MaterialManager
Class for managing Material settings for Ogre.
Definition: OgreMaterialManager.h:64
Ogre::CompositorInstance::LocalMRTMap
map< String, MultiRenderTarget * >::type LocalMRTMap
Store a list of MRTs we&#39;ve created.
Definition: OgreCompositorInstance.h:322
Ogre::CompositorInstance::TargetOperation::materialScheme
String materialScheme
Which material scheme this op will use.
Definition: OgreCompositorInstance.h:160
Ogre::CompositorInstance::mCompositor
Compositor * mCompositor
Compositor of which this is an instance.
Definition: OgreCompositorInstance.h:309
Ogre::CompositorInstance::QuadMaterialMap
map< int, MaterialPtr >::type QuadMaterialMap
Definition: OgreCompositorInstance.h:106
Ogre::CompositorInstance::TargetOperation::shadowsEnabled
bool shadowsEnabled
Whether shadows will be enabled.
Definition: OgreCompositorInstance.h:162
Ogre::CompositionTechnique
Base composition technique, can be subclassed in plugins.
Definition: OgreCompositionTechnique.h:45
Ogre::CompositorInstance::TargetOperation::currentQueueGroupID
int currentQueueGroupID
Current group ID.
Definition: OgreCompositorInstance.h:128
Ogre::Compositor
Class representing a Compositor object.
Definition: OgreCompositor.h:50
OgreCompositionTechnique.h
OgrePrerequisites.h
Ogre::map::type
std::map< K, V, P, A > type
Definition: OgrePrerequisites.h:536
OgreTexture.h
Ogre::CompositorInstance::TargetOperation::hasBeenRendered
bool hasBeenRendered
"Has been rendered" flag; used in combination with onlyInitial to determine whether to skip this targ...
Definition: OgreCompositorInstance.h:155
Ogre::RenderSystem
Defines the functionality of a 3D API.
Definition: OgreRenderSystem.h:125
Ogre::CompositorInstance::TargetOperation::TargetOperation
TargetOperation()
Definition: OgreCompositorInstance.h:114
Ogre::CompositorInstance::CompiledState
vector< TargetOperation >::type CompiledState
Definition: OgreCompositorInstance.h:164
Ogre::CompositorInstance::TargetOperation::RenderQueueBitSet
std::bitset< RENDER_QUEUE_COUNT > RenderQueueBitSet
A set of render queues to either include or exclude certain render queues.
Definition: OgreCompositorInstance.h:144
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::CompositorInstance::TargetOperation::TargetOperation
TargetOperation(RenderTarget *inTarget)
Definition: OgreCompositorInstance.h:117
Ogre::RENDER_QUEUE_MAX
Final possible render queue, don&#39;t exceed this.
Definition: OgreRenderQueue.h:76
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
Ogre::CompositorChain
Chain of compositor effects applying to one viewport.
Definition: OgreCompositorChain.h:48
OgreHeaderSuffix.h
Ogre::CompositorInstance::mLocalTextures
LocalTextureMap mLocalTextures
Definition: OgreCompositorInstance.h:320
Ogre::CompositorInstance::RenderSystemOperation
Specific render system operation.
Definition: OgreCompositorInstance.h:99
Ogre::CompositorInstance::mPreviousInstance
CompositorInstance * mPreviousInstance
Previous instance (set by chain).
Definition: OgreCompositorInstance.h:336
OgreMaterialManager.h
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::CompositorInstance::RenderSystemOpPair
std::pair< int, RenderSystemOperation * > RenderSystemOpPair
Definition: OgreCompositorInstance.h:107
Ogre::SharedPtr< Material >
Ogre::vector
Definition: OgrePrerequisites.h:491
Ogre::CompositorInstance::mAlive
bool mAlive
Is this instance allocating resources?
Definition: OgreCompositorInstance.h:317
OgreHeaderPrefix.h
Ogre::CompositorInstance::TargetOperation::visibilityMask
uint32 visibilityMask
Scene visibility mask If this is 0, the scene is not rendered at all.
Definition: OgreCompositorInstance.h:136
Ogre::CompositorInstance::getScheme
const String & getScheme() const
Returns the name of the scheme this compositor is using.
Definition: OgreCompositorInstance.h:271
Ogre::map
Definition: OgrePrerequisites.h:533
Ogre::CompositorInstance::mTechnique
CompositionTechnique * mTechnique
Composition technique used by this instance.
Definition: OgreCompositorInstance.h:311
Ogre::SceneManager
Manages the organisation and rendering of a &#39;scene&#39; i.e.
Definition: OgreSceneManager.h:143
Ogre::CompositorInstance::TargetOperation::lodBias
float lodBias
LOD offset.
Definition: OgreCompositorInstance.h:140
Ogre::CompositorInstance::mEnabled
bool mEnabled
Is this instance enabled?
Definition: OgreCompositorInstance.h:315
Ogre::StringUtil::BLANK
static const String BLANK
Constant blank string, useful for returning by ref where local does not exist.
Definition: OgreString.h:196
Ogre::CompositorInstance::mListeners
Listeners mListeners
Definition: OgreCompositorInstance.h:333
Ogre::CompositorInstance::RenderSystemOpPairs
vector< RenderSystemOpPair >::type RenderSystemOpPairs
Definition: OgreCompositorInstance.h:108
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre::CompositorInstance::TargetOperation::findVisibleObjects
bool findVisibleObjects
Whether this op needs to find visible scene objects or not.
Definition: OgreCompositorInstance.h:158
Ogre::CompositorInstance::ReserveTextureMap
map< CompositionTechnique::TextureDefinition *, TexturePtr >::type ReserveTextureMap
Definition: OgreCompositorInstance.h:324

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.