OGRE-Next
4.0.0unstable
Object-Oriented Graphics Rendering Engine
|
Main system for managing Render Targets through the use of nodes. More...
#include <OgreCompositorManager2.h>
Public Types | |
typedef map< IdString, CompositorNodeDef * >::type | CompositorNodeDefMap |
Public Member Functions | |
CompositorManager2 (RenderSystem *renderSystem) | |
~CompositorManager2 () | |
void | _notifyBarriersDirty () |
void | _releaseManualHardwareResources () |
void | _restoreManualHardwareResources () |
void | _swapAllFinalTargets () |
void | _update () |
Will call the renderSystem which in turns calls _updateImplementation() More... | |
void | _updateImplementation () |
This should be called by the render system to perform the actual compositor manager update. More... | |
void | addListener (CompositorWorkspaceListener *listener) |
CompositorNodeDef * | addNodeDefinition (const String &name) |
Returns a new node definition. The name must be unique, throws otherwise. More... | |
CompositorShadowNodeDef * | addShadowNodeDefinition (const String &name) |
Returns a new node definition. The name must be unique, throws otherwise. More... | |
CompositorWorkspace * | addWorkspace (SceneManager *sceneManager, const CompositorChannelVec &externalRenderTargets, Camera *defaultCam, IdString definitionName, bool bEnabled, int position=-1, const UavBufferPackedVec *uavBuffers=0, const ResourceStatusMap *initialLayouts=0, const Vector4 &vpOffsetScale=Vector4::ZERO, uint8 vpModifierMask=0x00, uint8 executionMask=0xFF) |
Overload that allows having multiple external input/outputs. More... | |
CompositorWorkspace * | addWorkspace (SceneManager *sceneManager, TextureGpu *finalRenderTarget, Camera *defaultCam, IdString definitionName, bool bEnabled, int position=-1, const UavBufferPackedVec *uavBuffers=0, const ResourceStatusMap *initialLayouts=0, const Vector4 &vpOffsetScale=Vector4::ZERO, uint8 vpModifierMask=0x00, uint8 executionMask=0xFF) |
Main function to start rendering. More... | |
CompositorWorkspaceDef * | addWorkspaceDefinition (const String &name) |
Returns a new workspace definition. More... | |
void | createBasicWorkspaceDef (const String &workspaceDefName, const ColourValue &backgroundColour, IdString shadowNodeName=IdString()) |
Utility helper to create a basic workspace to get you out of the rush. More... | |
BarrierSolver & | getBarrierSolver () |
CompositorPassProvider * | getCompositorPassProvider () const |
size_t | getFrameCount () const |
Returns how many times _update has been called. More... | |
const CompositorNodeDef * | getNodeDefinition (IdString nodeDefName) const |
Returns the node definition with the given name. Throws if not found. More... | |
CompositorNodeDef * | getNodeDefinitionNonConst (IdString nodeDefName) const |
See getNodeDefinition(). More... | |
const CompositorNodeDefMap & | getNodeDefinitions () const |
Returns a const iterator to all existing definitions. More... | |
TextureGpu * | getNullShadowTexture (PixelFormatGpu format) |
Get an appropriately defined 'null' texture, i.e., one which will always result in no shadows. More... | |
size_t | getNumWorkspaces () const |
RenderSystem * | getRenderSystem () const |
const CompositorShadowNodeDef * | getShadowNodeDefinition (IdString nodeDefName) const |
Returns the node definition with the given name. Throws if not found. More... | |
CompositorShadowNodeDef * | getShadowNodeDefinitionNonConst (IdString nodeDefName) const |
See getShadowNodeDefinition(). More... | |
v1::Rectangle2D * | getSharedFullscreenQuad () const |
Returns a shared fullscreen rectangle/triangle useful for PASS_QUAD passes. More... | |
v1::Rectangle2D * | getSharedFullscreenTriangle () const |
Returns a shared fullscreen rectangle/triangle useful for PASS_QUAD passes. More... | |
CompositorWorkspaceDef * | getWorkspaceDefinition (IdString name) const |
Returns the workspace definition with the given name. Throws if not found. More... | |
CompositorWorkspaceDef * | getWorkspaceDefinitionNoThrow (IdString name) const |
bool | hasNodeDefinition (IdString nodeDefName) const |
Returns true if a node definition with the given name exists. More... | |
bool | hasShadowNodeDefinition (IdString nodeDefName) const |
Returns true if a shadow node definition with the given name exists. More... | |
bool | hasWorkspaceDefinition (IdString name) const |
Returns true if a workspace definition with the given name exists. More... | |
void | removeAllNodeDefinitions () |
Removes all node defs. More... | |
void | removeAllShadowNodeDefinitions () |
Removes all shadow nodes defs. More... | |
void | removeAllWorkspaceDefinitions () |
void | removeAllWorkspaces () |
Removes all workspaces. Make sure you don't hold any reference to a CompositorWorkspace ! More... | |
void | removeListener (CompositorWorkspaceListener *listener) |
void | removeNodeDefinition (IdString nodeDefName) |
Removes the node definition with the given name. Throws if not found. More... | |
void | removeShadowNodeDefinition (IdString nodeDefName) |
Removes the node definition with the given name. Throws if not found. More... | |
void | removeWorkspace (CompositorWorkspace *workspace) |
Removes the given workspace. Pointer is no longer valid after this call. More... | |
void | removeWorkspaceDefinition (IdString name) |
Removes the workspace definition with the given name. Throws if not found. More... | |
void | setCompositorPassProvider (CompositorPassProvider *passProvider) |
Sets a custom pass provider in order to implement custom passes in your nodes. More... | |
void | validateAllNodes () |
Calls CompositorShadowNodeDef::_validateAndFinish on all objects who aren't yet validated. More... | |
Main system for managing Render Targets through the use of nodes.
All applications must at least define a workspace definition and create a workspace instance in order to start rendering.
A Node definition must be created first. Inside the Node Def. different passes can be defined including which targets they should render to. Once the definitions are set, a workspace instance must be created using addWorkspace and rendering will start automatically. Each definition is shared by all instances, and is assumed to be immutable (read only) for the life time of those objects.
typedef map<IdString, CompositorNodeDef *>::type Ogre::CompositorManager2::CompositorNodeDefMap |
Ogre::CompositorManager2::CompositorManager2 | ( | RenderSystem * | renderSystem | ) |
Ogre::CompositorManager2::~CompositorManager2 | ( | ) |
void Ogre::CompositorManager2::_notifyBarriersDirty | ( | ) |
void Ogre::CompositorManager2::_releaseManualHardwareResources | ( | ) |
void Ogre::CompositorManager2::_restoreManualHardwareResources | ( | ) |
void Ogre::CompositorManager2::_swapAllFinalTargets | ( | ) |
void Ogre::CompositorManager2::_update | ( | ) |
Will call the renderSystem which in turns calls _updateImplementation()
void Ogre::CompositorManager2::_updateImplementation | ( | ) |
This should be called by the render system to perform the actual compositor manager update.
DO NOT CALL THIS DIRECTLY.
void Ogre::CompositorManager2::addListener | ( | CompositorWorkspaceListener * | listener | ) |
CompositorNodeDef* Ogre::CompositorManager2::addNodeDefinition | ( | const String & | name | ) |
Returns a new node definition. The name must be unique, throws otherwise.
CompositorShadowNodeDef* Ogre::CompositorManager2::addShadowNodeDefinition | ( | const String & | name | ) |
Returns a new node definition. The name must be unique, throws otherwise.
CompositorWorkspace* Ogre::CompositorManager2::addWorkspace | ( | SceneManager * | sceneManager, |
const CompositorChannelVec & | externalRenderTargets, | ||
Camera * | defaultCam, | ||
IdString | definitionName, | ||
bool | bEnabled, | ||
int | position = -1 , |
||
const UavBufferPackedVec * | uavBuffers = 0 , |
||
const ResourceStatusMap * | initialLayouts = 0 , |
||
const Vector4 & | vpOffsetScale = Vector4::ZERO , |
||
uint8 | vpModifierMask = 0x00 , |
||
uint8 | executionMask = 0xFF |
||
) |
Overload that allows having multiple external input/outputs.
CompositorWorkspace* Ogre::CompositorManager2::addWorkspace | ( | SceneManager * | sceneManager, |
TextureGpu * | finalRenderTarget, | ||
Camera * | defaultCam, | ||
IdString | definitionName, | ||
bool | bEnabled, | ||
int | position = -1 , |
||
const UavBufferPackedVec * | uavBuffers = 0 , |
||
const ResourceStatusMap * | initialLayouts = 0 , |
||
const Vector4 & | vpOffsetScale = Vector4::ZERO , |
||
uint8 | vpModifierMask = 0x00 , |
||
uint8 | executionMask = 0xFF |
||
) |
Main function to start rendering.
Creates a workspace instance based on a workspace definition.
sceneManager | The SceneManager this workspace will be associated with. You can have multiple scene managers, each with multiple workspaces. Those workspaces can be set to render to the same final render target, regardless of scene manager (or not). |
finalRenderTarget | The final RT where the workspace will be rendered to. Usually the RenderWindow. We need this pointer in order to correctly create RTTs that depend on the final target's width, height, gamma & fsaa settings. This pointer will be used for "connectExternal" channels (see CompositorWorkspaceDef::connectExternal) In theory if none of your nodes use width & height relative to final RT & you don't use connectExternal, this pointer could be null. Although it's not recommended nor explicitly supported. |
defaultCam | Default camera to use when a camera name wasn't specified explicitly in a pass definition (i.e. PASS_SCENE passes). This pointer can be null if you promise to use all explicit camera names in your passes (and those cameras have already been created) |
definitionName | The unique name of the workspace definition |
bEnabled | True if this workspace should start enabled, false otherwise. |
position | If there are multiple workspaces, specifies the order in which this compositor should be updated. i.e. "0" means this new workspace gets updated first. Note that subsequent calls will place other workspaces to be updated first. Typically you will want to update workspace that renders to the RenderWindow last (depending on what you do with RTs, some OSes, like OS X, may not like it). Defaults to -1; which means update last. |
uavBuffers | Array of UAV Buffers that will be exposed to compositors, via the 'connect_buffer_external' script keyword, or the call CompositorWorkspaceDef::connectExternalBuffer |
vpOffsetScale | The viewport of every pass from every node will be offseted and scaled by the following formula: left += vpOffsetScale.x; top += vpOffsetScale.y; width *= vpOffsetScale.z; height *= vpOffsetScale.w; This affects both the viewport dimensions as well as the scissor rect. |
vpModifierMask | An 8-bit mask that will be AND'ed with the viewport modifier mask of each pass from every node. When the result is zero, the previous parameter "viewportModifier" isn't applied to that pass. This is useful when you want to apply a pass (like Clear) to the whole render target and not just to the scaled region. |
executionMask | An 8-bit mask that will be AND'ed with the execution mask of each pass from every node. When the result is zero, the pass isn't executed. See remarks on how to use this for efficient Stereo or split screen. This is useful when you want to skip a pass (like Clear) when rendering the second eye (or the second split from the second player). |
CompositorWorkspaceDef* Ogre::CompositorManager2::addWorkspaceDefinition | ( | const String & | name | ) |
Returns a new workspace definition.
The name must be unique, throws otherwise.
void Ogre::CompositorManager2::createBasicWorkspaceDef | ( | const String & | workspaceDefName, |
const ColourValue & | backgroundColour, | ||
IdString | shadowNodeName = IdString() |
||
) |
Utility helper to create a basic workspace to get you out of the rush.
Advanced users will probably prefer to create the workspace definition using scripts or manipulating functions directly
workspaceDefName | Name to give to the workspace definition. Must be unique |
backgroundColour | Clear colour |
shadowNodeName | Name of the shadow node. Leave blank if no shadows. Caller is supposed to have set the shadow node correctly |
|
inline |
CompositorPassProvider* Ogre::CompositorManager2::getCompositorPassProvider | ( | ) | const |
|
inline |
Returns how many times _update has been called.
const CompositorNodeDef* Ogre::CompositorManager2::getNodeDefinition | ( | IdString | nodeDefName | ) | const |
Returns the node definition with the given name. Throws if not found.
CompositorNodeDef* Ogre::CompositorManager2::getNodeDefinitionNonConst | ( | IdString | nodeDefName | ) | const |
See getNodeDefinition().
Returns a non-const pointer. Use this only if you know what you're doing. Modifying a NodeDef while it's being used by CompositorNode instances is undefined. It's safe if you're sure it's not being used.
|
inline |
Returns a const iterator to all existing definitions.
TextureGpu* Ogre::CompositorManager2::getNullShadowTexture | ( | PixelFormatGpu | format | ) |
Get an appropriately defined 'null' texture, i.e., one which will always result in no shadows.
|
inline |
RenderSystem* Ogre::CompositorManager2::getRenderSystem | ( | ) | const |
const CompositorShadowNodeDef* Ogre::CompositorManager2::getShadowNodeDefinition | ( | IdString | nodeDefName | ) | const |
Returns the node definition with the given name. Throws if not found.
CompositorShadowNodeDef* Ogre::CompositorManager2::getShadowNodeDefinitionNonConst | ( | IdString | nodeDefName | ) | const |
See getShadowNodeDefinition().
Returns a non-const pointer. Use this only if you know what you're doing. Modifying a ShadowNodeDef while it's being used by CompositorShadowNode instances is undefined. It's safe if you're sure it's not being used.
|
inline |
Returns a shared fullscreen rectangle/triangle useful for PASS_QUAD passes.
|
inline |
Returns a shared fullscreen rectangle/triangle useful for PASS_QUAD passes.
CompositorWorkspaceDef* Ogre::CompositorManager2::getWorkspaceDefinition | ( | IdString | name | ) | const |
Returns the workspace definition with the given name. Throws if not found.
CompositorWorkspaceDef* Ogre::CompositorManager2::getWorkspaceDefinitionNoThrow | ( | IdString | name | ) | const |
bool Ogre::CompositorManager2::hasNodeDefinition | ( | IdString | nodeDefName | ) | const |
Returns true if a node definition with the given name exists.
bool Ogre::CompositorManager2::hasShadowNodeDefinition | ( | IdString | nodeDefName | ) | const |
Returns true if a shadow node definition with the given name exists.
bool Ogre::CompositorManager2::hasWorkspaceDefinition | ( | IdString | name | ) | const |
Returns true if a workspace definition with the given name exists.
void Ogre::CompositorManager2::removeAllNodeDefinitions | ( | ) |
Removes all node defs.
Make sure there are no active nodes using the definition!
void Ogre::CompositorManager2::removeAllShadowNodeDefinitions | ( | ) |
Removes all shadow nodes defs.
Make sure there are no active nodes using the definition!
void Ogre::CompositorManager2::removeAllWorkspaceDefinitions | ( | ) |
void Ogre::CompositorManager2::removeAllWorkspaces | ( | ) |
Removes all workspaces. Make sure you don't hold any reference to a CompositorWorkspace !
void Ogre::CompositorManager2::removeListener | ( | CompositorWorkspaceListener * | listener | ) |
void Ogre::CompositorManager2::removeNodeDefinition | ( | IdString | nodeDefName | ) |
Removes the node definition with the given name. Throws if not found.
void Ogre::CompositorManager2::removeShadowNodeDefinition | ( | IdString | nodeDefName | ) |
Removes the node definition with the given name. Throws if not found.
void Ogre::CompositorManager2::removeWorkspace | ( | CompositorWorkspace * | workspace | ) |
Removes the given workspace. Pointer is no longer valid after this call.
void Ogre::CompositorManager2::removeWorkspaceDefinition | ( | IdString | name | ) |
Removes the workspace definition with the given name. Throws if not found.
void Ogre::CompositorManager2::setCompositorPassProvider | ( | CompositorPassProvider * | passProvider | ) |
Sets a custom pass provider in order to implement custom passes in your nodes.
void Ogre::CompositorManager2::validateAllNodes | ( | ) |
Calls CompositorShadowNodeDef::_validateAndFinish on all objects who aren't yet validated.