![]() |
OGRE-Next 4.0.0unstable
Object-Oriented Graphics Rendering Engine
|
A compositor workspace is the main interface to render into an RT, be it a RenderWindow or an RTT (Render Texture Target). More...
#include <OgreCompositorWorkspace.h>
Public Member Functions | |
CompositorWorkspace (IdType id, const CompositorWorkspaceDef *definition, const CompositorChannelVec &externalRenderTargets, SceneManager *sceneManager, Camera *defaultCam, RenderSystem *renderSys, bool bEnabled, uint8 executionMask, uint8 viewportModifierMask, const Vector4 &vpOffsetScale, const UavBufferPackedVec *uavBuffers, const ResourceStatusMap *initialLayouts) | |
virtual | ~CompositorWorkspace () |
void | _beginUpdate (bool forceBeginFrame, const bool bInsideAutoreleasePool=false) |
Call before _update() unless the final render target is not a render window. | |
void | _endUpdate (bool forceEndFrame, const bool bInsideAutoreleasePool=false) |
Call after _update() unless the final render target is not a render window. | |
void | _notifyBarriersDirty () |
void | _swapFinalTarget (vector< TextureGpu * >::type &swappedTargets) |
In the case of RenderWindows, swaps/copies/flips the front with the back buffer. | |
void | _update (const bool bInsideAutoreleasePool=false) |
Updates the workspace's nodes. | |
void | _validateFinalTarget () |
For compatibility with D3D9, forces a device lost check on the RenderWindow, so that BeginScene doesn't fail. | |
void | addListener (CompositorWorkspaceListener *listener) |
void | fillPassesUsingRenderWindows (PassesByRenderWindowMap &passesUsingRenderWindows) |
Fills the input map + vector with all the passes that use a window, classified per window. | |
Camera * | findCamera (IdString cameraName) const |
Finds a camera in the scene manager we have. | |
CompositorNode * | findNode (IdString aliasName, bool includeShadowNodes=false) const |
Finds a node instance with the given aliased name. | |
CompositorNode * | findNodeNoThrow (IdString aliasName, bool includeShadowNodes=false) const |
CompositorShadowNode * | findOrCreateShadowNode (IdString nodeDefName, bool &bCreated) |
Finds a shadow node given its definition name. | |
CompositorShadowNode * | findShadowNode (IdString nodeDefName) const |
Finds a shadow node instance with a given name. | |
bool | getAmalgamatedProfiling () const |
CompositorManager2 * | getCompositorManager () |
Gets the compositor manager (non const) | |
const CompositorManager2 * | getCompositorManager () const |
Gets the compositor manager (const version) | |
Camera * | getDefaultCamera () const |
Gets the default camera passed through mDefaultViewport. | |
const CompositorWorkspaceDef * | getDefinition () |
bool | getEnabled () const |
uint8 | getExecutionMask () const |
const CompositorChannelVec & | getExternalRenderTargets () const |
Usually by convention the RenderTarget[0] is the one we're rendering to. May be empty. | |
TextureGpu * | getFinalTarget () const |
Returns the RenderTarget we're rendering to. | |
size_t | getFrameCount () const |
const CompositorNamedBufferVec & | getGlobalBuffers () const |
const CompositorChannel & | getGlobalTexture (IdString name) const |
CompositorWorkspaceListener * | getListener () const |
const CompositorWorkspaceListenerVec & | getListeners () const |
const CompositorNodeVec & | getNodeSequence () const |
SceneManager * | getSceneManager () const |
const Vector4 & | getViewportModifier () const |
uint8 | getViewportModifierMask () const |
bool | isValid () const |
Only valid workspaces can update without crashing. | |
void | reconnectAllNodes () |
Reconnects all nodes. | |
void | recreateAllNodes () |
Destroys and recreates all nodes. | |
void | removeListener (CompositorWorkspaceListener *listener) |
void | resetAllNumPassesLeft () |
Resets the number of passes left for every pass (see CompositorPassDef::mNumInitialPasses) Useful when you have a few starting 'initialization' passes and you want to reset them. | |
void | setAmalgamatedProfiling (bool bEnabled) |
When building with OGRE_PROFILING enabled, setting this option to true will cause the profiler to collapse all per-pass profiling information into one group. | |
void | setEnabled (bool bEnabled) |
void | setExecutionMask (uint8 executionMask) |
void | setListener (CompositorWorkspaceListener *listener) |
void | setViewportModifier (const Vector4 &modifier) |
void | setViewportModifierMask (uint8 mask) |
![]() | |
IdObject (IdType id) | |
We don't call generateNewId() here, to prevent objects in the stack (i.e. | |
IdType | getId () const |
Get the unique id of this object. | |
bool | operator() (const IdObject &left, const IdObject &right) |
bool | operator() (const IdObject *left, const IdObject *right) |
A compositor workspace is the main interface to render into an RT, be it a RenderWindow or an RTT (Render Texture Target).
Whereas Ogre 1.x needed you to set a Viewport in order to render to an RTT or RW and then call renderTarget->update, now you need to set a workspace definition instead and call workspace->_update().
Ogre::CompositorWorkspace::CompositorWorkspace | ( | IdType | id, |
const CompositorWorkspaceDef * | definition, | ||
const CompositorChannelVec & | externalRenderTargets, | ||
SceneManager * | sceneManager, | ||
Camera * | defaultCam, | ||
RenderSystem * | renderSys, | ||
bool | bEnabled, | ||
uint8 | executionMask, | ||
uint8 | viewportModifierMask, | ||
const Vector4 & | vpOffsetScale, | ||
const UavBufferPackedVec * | uavBuffers, | ||
const ResourceStatusMap * | initialLayouts | ||
) |
|
virtual |
void Ogre::CompositorWorkspace::_beginUpdate | ( | bool | forceBeginFrame, |
const bool | bInsideAutoreleasePool = false |
||
) |
Call before _update() unless the final render target is not a render window.
forceBeginFrame | Forces a beginFrame call to the D3D9 API, even if the final render target is not a RenderWindow (not recommended). To avoid forcing extra begin/end frame pairs, update your manual workspaces inside CompositorWorkspaceListener::workspacePreUpdate (performance optimization) |
bInsideAutoreleasePool | If manually updating the workspace, leave this to default. Relevant only in Metal: If we're not inside an autorelease pool, we automatically wrap the call into one. Otherwise we will leak |
void Ogre::CompositorWorkspace::_endUpdate | ( | bool | forceEndFrame, |
const bool | bInsideAutoreleasePool = false |
||
) |
Call after _update() unless the final render target is not a render window.
forceEndFrame | (See beginUpdate()) !!!WARNING!!! Forcing an end frame can cause API issues w/ D3D9 if Ogre had already issued a begin frame automatically (i.e. if you're calling from inside a RenderTarget or CompositorWorkspace listener). These API issues may not manifest on all HW/Driver combinations, making it hard to detect (if you're on D3D, use the Debug Runtimes) |
bInsideAutoreleasePool | If manually updating the workspace, leave this to default. Relevant only in Metal: If we're not inside an autorelease pool, we automatically wrap the call into one. Otherwise we will leak. |
void Ogre::CompositorWorkspace::_notifyBarriersDirty | ( | ) |
void Ogre::CompositorWorkspace::_swapFinalTarget | ( | vector< TextureGpu * >::type & | swappedTargets | ) |
In the case of RenderWindows, swaps/copies/flips the front with the back buffer.
In the case of RenderTextures, resolves FSAA (unless it's tagged as explicit resolve, or its contents haven't changed since the last resolve)
void Ogre::CompositorWorkspace::_update | ( | const bool | bInsideAutoreleasePool = false | ) |
Updates the workspace's nodes.
bInsideAutoreleasePool | If manually updating the workspace, leave this to default. Relevant only in Metal: If we're not inside an autorelease pool, we automatically wrap the call into one. Otherwise we will leak |
void Ogre::CompositorWorkspace::_validateFinalTarget | ( | ) |
For compatibility with D3D9, forces a device lost check on the RenderWindow, so that BeginScene doesn't fail.
void Ogre::CompositorWorkspace::addListener | ( | CompositorWorkspaceListener * | listener | ) |
void Ogre::CompositorWorkspace::fillPassesUsingRenderWindows | ( | PassesByRenderWindowMap & | passesUsingRenderWindows | ) |
Fills the input map + vector with all the passes that use a window, classified per window.
Finds a camera in the scene manager we have.
CompositorNode * Ogre::CompositorWorkspace::findNode | ( | IdString | aliasName, |
bool | includeShadowNodes = false |
||
) | const |
Finds a node instance with the given aliased name.
aliasName | Name of the node instance (they're unique) |
includeShadowNodes | When true, also looks for ShadowNodes with that name, if the instance doesn't exists, it will not be created (default: false). (See findShadowNode()) When a Node has the same name of a Shadow Node, the Node takes precedence. |
CompositorNode * Ogre::CompositorWorkspace::findNodeNoThrow | ( | IdString | aliasName, |
bool | includeShadowNodes = false |
||
) | const |
CompositorShadowNode * Ogre::CompositorWorkspace::findOrCreateShadowNode | ( | IdString | nodeDefName, |
bool & | bCreated | ||
) |
Finds a shadow node given its definition name.
If it doesn't exist, creates one. Note that unlike nodes, there can only be one ShadowNode instance per definition (in the same workspace)
nodeDefName | Name of the definition. |
bCreated | [out] Set to true if we had to create a new shadow node (it didn't exist) |
CompositorShadowNode * Ogre::CompositorWorkspace::findShadowNode | ( | IdString | nodeDefName | ) | const |
Finds a shadow node instance with a given name.
Note that unlike nodes, there can only be one ShadowNode instance per definition (in the same workspace)
nodeDefName | Name of the definition. |
|
inline |
CompositorManager2 * Ogre::CompositorWorkspace::getCompositorManager | ( | ) |
Gets the compositor manager (non const)
const CompositorManager2 * Ogre::CompositorWorkspace::getCompositorManager | ( | ) | const |
Gets the compositor manager (const version)
|
inline |
Gets the default camera passed through mDefaultViewport.
|
inline |
|
inline |
|
inline |
|
inline |
Usually by convention the RenderTarget[0] is the one we're rendering to. May be empty.
TextureGpu * Ogre::CompositorWorkspace::getFinalTarget | ( | ) | const |
size_t Ogre::CompositorWorkspace::getFrameCount | ( | ) | const |
|
inline |
const CompositorChannel & Ogre::CompositorWorkspace::getGlobalTexture | ( | IdString | name | ) | const |
CompositorWorkspaceListener * Ogre::CompositorWorkspace::getListener | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Only valid workspaces can update without crashing.
void Ogre::CompositorWorkspace::reconnectAllNodes | ( | ) |
Reconnects all nodes.
Use this function if you only altered the channel connections between nodes, but didn't add new ones or removed existing nodes.
void Ogre::CompositorWorkspace::recreateAllNodes | ( | ) |
Destroys and recreates all nodes.
TODO: Only revalidate nodes adjacent to those that were invalidated, to avoid recreating so many D3D/GL resources (local textures) which is important for GUI editors.
void Ogre::CompositorWorkspace::removeListener | ( | CompositorWorkspaceListener * | listener | ) |
void Ogre::CompositorWorkspace::resetAllNumPassesLeft | ( | ) |
Resets the number of passes left for every pass (see CompositorPassDef::mNumInitialPasses) Useful when you have a few starting 'initialization' passes and you want to reset them.
|
inline |
When building with OGRE_PROFILING enabled, setting this option to true will cause the profiler to collapse all per-pass profiling information into one group.
This is useful if you want to know how much (e.g.) frustum culling is taking overall (all passes combined) rather than knowing how much frustum culling is taking for each pass.
bEnabled | True to collapse all per-pass info into a global one. Default is false. |
void Ogre::CompositorWorkspace::setEnabled | ( | bool | bEnabled | ) |
|
inline |
void Ogre::CompositorWorkspace::setListener | ( | CompositorWorkspaceListener * | listener | ) |
|
inline |
|
inline |