OGRE  2.2.4
Object-Oriented Graphics Rendering Engine
Ogre::ParallaxCorrectedCubemapAuto Class Reference

Per-Pixel reflection probes. More...

#include <OgreParallaxCorrectedCubemapAuto.h>

+ Inheritance diagram for Ogre::ParallaxCorrectedCubemapAuto:

Public Member Functions

 ParallaxCorrectedCubemapAuto (IdType id, Root *root, SceneManager *sceneManager, const CompositorWorkspaceDef *probeWorkspaceDef)
 
 ~ParallaxCorrectedCubemapAuto ()
 
virtual TextureGpu_acquireTextureSlot (uint16 &outTexSlot)
 Acquires a texture with a given slot. More...
 
virtual void _addManuallyActiveProbe (CubemapProbe *probe)
 
virtual void _copyRenderTargetToCubemap (uint32 cubemapArrayIdx)
 
virtual void _notifyPreparePassHash (const Matrix4 &viewMatrix)
 
virtual void _releaseTextureSlot (TextureGpu *texture, uint32 texSlot)
 
virtual void _removeManuallyActiveProbe (CubemapProbe *probe)
 
void _setIsRendering (bool bIsRendering)
 
void _setProbeRenderInProgress (CubemapProbe *probe)
 
virtual void allWorkspacesBeforeBeginUpdate (void)
 Called from CompositorManager2 (not CompositorWorkspace) when we're about to begin updating all the workspaces. More...
 
virtual void allWorkspacesBeginUpdate (void)
 Called from CompositorManager2 (not CompositorWorkspace) when we're about to update all the workspaces (it's safe to update your own workspaces without calling _beginUpdate and _endUpdate) Warning: Don't add/remove listeners to CompositorManager2 inside this function. More...
 
CubemapProbecreateProbe (void)
 Adds a cubemap probe. More...
 
virtual void destroyAllProbes (void)
 
virtual void destroyProbe (CubemapProbe *probe)
 
virtual void fillConstBufferData (const Matrix4 &viewMatrix, float *RESTRICT_ALIAS passBufferPtr) const
 
virtual TextureGpufindIbl (const TextureGpu *baseParams)
 
virtual TextureGpufindTmpRtt (const TextureGpu *baseParams)
 See mTmpRtt. More...
 
virtual bool frameEnded (const FrameEvent &evt)
 Called just after a frame has been rendered. More...
 
virtual bool frameRenderingQueued (const FrameEvent &evt)
 Called after all render targets have had their rendering commands issued, but before render windows have been asked to flip their buffers over. More...
 
virtual bool frameStarted (const FrameEvent &evt)
 Called when a frame is about to begin rendering. More...
 
bool getAutomaticMode (void) const
 
TextureGpugetBindTexture (void) const
 
const HlmsSamplerblockgetBindTrilinearSamplerblock (void)
 
virtual size_t getConstBufferSize (void)
 
const CompositorWorkspaceDefgetDefaultWorkspaceDef (void) const
 
bool getEnabled (void) const
 
uint32 getIblTargetTextureFlags (PixelFormatGpu pixelFormat) const
 
IdType getId () const
 Get the unique id of this object. More...
 
ParallaxCorrectedCubemapAutoListenergetListener (void) const
 
const CubemapProbeVecgetProbes (void) const
 
SceneManagergetSceneManager (void) const
 
bool getUseDpm2DArray (void) const
 
bool isRendering (void) const
 Inform whether we're currently updating a probe. More...
 
bool operator() (const IdObject *left, const IdObject *right)
 
bool operator() (const IdObject &left, const IdObject &right)
 
virtual void passEarlyPreExecute (CompositorPass *pass)
 Called early on in pass' execution. More...
 
virtual void passPosExecute (CompositorPass *pass)
 Called after a pass has been executed. More...
 
virtual void passPreExecute (CompositorPass *pass)
 Called when each pass is about to be executed. More...
 
virtual void passSceneAfterFrustumCulling (CompositorPassScene *pass)
 Called after a pass scene has performed frustum caulling but has yet to prepare and execute rendering commands. More...
 
virtual void passSceneAfterShadowMaps (CompositorPassScene *pass)
 Called after a pass scene has rendered shadow casting (it gets called even if there is no shadow node). More...
 
virtual void prepareForClearScene (void)
 Destroys the Proxy Items. More...
 
virtual void releaseIbl (const TextureGpu *tmpRtt)
 
virtual void releaseTmpRtt (const TextureGpu *tmpRtt)
 
virtual void restoreFromClearScene (void)
 
void setEnabled (bool bEnabled, uint32 width, uint32 height, uint32 maxNumProbes, PixelFormatGpu pixelFormat)
 Enables/disables this ParallaxCorrectedCubemapAuto system. More...
 
void setListener (ParallaxCorrectedCubemapAutoListener *listener)
 
void setUpdatedTrackedDataFromCamera (Camera *trackedCamera)
 Will update both mTrackedPosition with appropiate settings every time it's called. More...
 
void setUseDpm2DArray (bool useDpm2DArray)
 Whether we should use Dual Paraboloid Mapping with 2D Array instead of Cubemap Arrays. More...
 
void updateAllDirtyProbes (void)
 By default the probes will be constructed when the user enters the vecinity of non-static probes, and whenever a static probe is dirty. More...
 
virtual void workspacePosUpdate (CompositorWorkspace *workspace)
 Called after all nodes has been updated. More...
 
virtual void workspacePreUpdate (CompositorWorkspace *workspace)
 Called before all nodes are going to be updated. More...
 

Static Public Member Functions

static void fillConstBufferData (const CubemapProbe &probe, const Matrix4 &viewMatrix, const Matrix3 &invViewMat3, float *RESTRICT_ALIAS passBufferPtr)
 
static uint8 getIblNumMipmaps (uint32 width, uint32 height)
 

Public Attributes

uint32 mMask
 
bool mPaused
 
Vector3 mTrackedPosition
 This variable should be updated every frame and often represents the camera position, but it can also be used set to other things like the player's character position. More...
 

Detailed Description

Per-Pixel reflection probes.

Per-Pixel reflection probes are much easier to handle, they're more flexible and powerful. However they require a modern GPU with Cubemap Arrays. Forward Clustered also must be active.

ParallaxCorrectedCubemapAuto supports having more CubemapProbes than the maximum number of probes you pass to ParallaxCorrectedCubemapAuto::setEnabled. However only 'maxNumProbes' probes can be active at the same time. This is all done thanks to _acquireTextureSlot & _releaseTextureSlot.

To activate a probe, call CubemapProbe::initWorkspace. To deactivate it, call CubemapProbe::destroyWorkspace.

Constructor & Destructor Documentation

◆ ParallaxCorrectedCubemapAuto()

Ogre::ParallaxCorrectedCubemapAuto::ParallaxCorrectedCubemapAuto ( IdType  id,
Root root,
SceneManager sceneManager,
const CompositorWorkspaceDef probeWorkspaceDef 
)

◆ ~ParallaxCorrectedCubemapAuto()

Ogre::ParallaxCorrectedCubemapAuto::~ParallaxCorrectedCubemapAuto ( )

Member Function Documentation

◆ _acquireTextureSlot()

virtual TextureGpu* Ogre::ParallaxCorrectedCubemapAuto::_acquireTextureSlot ( uint16 outTexSlot)
virtual

Acquires a texture with a given slot.

Parameters
outTexSlot[out] Texture slot. Value is left untouched if return value is nullptr
Returns
Texture. Can be nullptr if ran out of slots.

Reimplemented from Ogre::ParallaxCorrectedCubemapBase.

◆ _addManuallyActiveProbe()

virtual void Ogre::ParallaxCorrectedCubemapBase::_addManuallyActiveProbe ( CubemapProbe probe)
virtualinherited

Reimplemented in Ogre::ParallaxCorrectedCubemap.

◆ _copyRenderTargetToCubemap()

virtual void Ogre::ParallaxCorrectedCubemapAuto::_copyRenderTargetToCubemap ( uint32  cubemapArrayIdx)
virtual

◆ _notifyPreparePassHash()

virtual void Ogre::ParallaxCorrectedCubemapBase::_notifyPreparePassHash ( const Matrix4 viewMatrix)
virtualinherited

Reimplemented in Ogre::ParallaxCorrectedCubemap.

◆ _releaseTextureSlot()

virtual void Ogre::ParallaxCorrectedCubemapAuto::_releaseTextureSlot ( TextureGpu texture,
uint32  texSlot 
)
virtual

◆ _removeManuallyActiveProbe()

virtual void Ogre::ParallaxCorrectedCubemapBase::_removeManuallyActiveProbe ( CubemapProbe probe)
virtualinherited

Reimplemented in Ogre::ParallaxCorrectedCubemap.

◆ _setIsRendering()

void Ogre::ParallaxCorrectedCubemapBase::_setIsRendering ( bool  bIsRendering)
inlineinherited

◆ _setProbeRenderInProgress()

void Ogre::ParallaxCorrectedCubemapBase::_setProbeRenderInProgress ( CubemapProbe probe)
inlineinherited

◆ allWorkspacesBeforeBeginUpdate()

virtual void Ogre::ParallaxCorrectedCubemapAuto::allWorkspacesBeforeBeginUpdate ( void  )
virtual

Called from CompositorManager2 (not CompositorWorkspace) when we're about to begin updating all the workspaces.

You'll have to manage the RenderSystem and SceneManager to call the adequate begin/end calls Warning: Don't add/remove listeners to CompositorManager2 inside this function.

Reimplemented from Ogre::CompositorWorkspaceListener.

◆ allWorkspacesBeginUpdate()

virtual void Ogre::ParallaxCorrectedCubemapAuto::allWorkspacesBeginUpdate ( void  )
virtual

Called from CompositorManager2 (not CompositorWorkspace) when we're about to update all the workspaces (it's safe to update your own workspaces without calling _beginUpdate and _endUpdate) Warning: Don't add/remove listeners to CompositorManager2 inside this function.

Reimplemented from Ogre::CompositorWorkspaceListener.

◆ createProbe()

CubemapProbe* Ogre::ParallaxCorrectedCubemapBase::createProbe ( void  )
inherited

Adds a cubemap probe.

◆ destroyAllProbes()

virtual void Ogre::ParallaxCorrectedCubemapBase::destroyAllProbes ( void  )
virtualinherited

Reimplemented in Ogre::ParallaxCorrectedCubemap.

◆ destroyProbe()

virtual void Ogre::ParallaxCorrectedCubemapAuto::destroyProbe ( CubemapProbe probe)
virtual

◆ fillConstBufferData() [1/2]

virtual void Ogre::ParallaxCorrectedCubemapBase::fillConstBufferData ( const Matrix4 viewMatrix,
float *RESTRICT_ALIAS  passBufferPtr 
) const
virtualinherited

Reimplemented in Ogre::ParallaxCorrectedCubemap.

◆ fillConstBufferData() [2/2]

static void Ogre::ParallaxCorrectedCubemapBase::fillConstBufferData ( const CubemapProbe probe,
const Matrix4 viewMatrix,
const Matrix3 invViewMat3,
float *RESTRICT_ALIAS  passBufferPtr 
)
staticinherited

◆ findIbl()

virtual TextureGpu* Ogre::ParallaxCorrectedCubemapAuto::findIbl ( const TextureGpu baseParams)
virtual

◆ findTmpRtt()

virtual TextureGpu* Ogre::ParallaxCorrectedCubemapAuto::findTmpRtt ( const TextureGpu baseParams)
virtual

See mTmpRtt.

Finds an RTT that is compatible to copy to baseParams. Creates one if none found.

Reimplemented from Ogre::ParallaxCorrectedCubemapBase.

◆ frameEnded()

virtual bool Ogre::FrameListener::frameEnded ( const FrameEvent evt)
inlinevirtualinherited

Called just after a frame has been rendered.

Remarks
This event happens after all render targets have been fully updated and the buffers switched.
Returns
True to continue with the next frame, false to drop out of the rendering loop.

Reimplemented in Ogre::FrameTimeControllerValue.

◆ frameRenderingQueued()

virtual bool Ogre::FrameListener::frameRenderingQueued ( const FrameEvent evt)
inlinevirtualinherited

Called after all render targets have had their rendering commands issued, but before render windows have been asked to flip their buffers over.

Remarks
The usefulness of this event comes from the fact that rendering commands are queued for the GPU to process. These can take a little while to finish, and so while that is happening the CPU can be doing useful things. Once the request to 'flip buffers' happens, the thread requesting it will block until the GPU is ready, which can waste CPU cycles. Therefore, it is often a good idea to use this callback to perform per-frame processing. Of course because the frame's rendering commands have already been issued, any changes you make will only take effect from the next frame, but in most cases that's not noticeable.
Returns
True to continue rendering, false to drop out of the rendering loop.

◆ frameStarted()

virtual bool Ogre::ParallaxCorrectedCubemapAuto::frameStarted ( const FrameEvent evt)
virtual

Called when a frame is about to begin rendering.

Remarks
This event happens before any render targets have begun updating.
Returns
True to go ahead, false to abort rendering and drop out of the rendering loop.

Reimplemented from Ogre::FrameListener.

◆ getAutomaticMode()

bool Ogre::ParallaxCorrectedCubemapBase::getAutomaticMode ( void  ) const
inlineinherited

◆ getBindTexture()

TextureGpu* Ogre::ParallaxCorrectedCubemapBase::getBindTexture ( void  ) const
inlineinherited

◆ getBindTrilinearSamplerblock()

const HlmsSamplerblock* Ogre::ParallaxCorrectedCubemapBase::getBindTrilinearSamplerblock ( void  )
inlineinherited

References RESTRICT_ALIAS.

◆ getConstBufferSize()

virtual size_t Ogre::ParallaxCorrectedCubemapBase::getConstBufferSize ( void  )
virtualinherited

Reimplemented in Ogre::ParallaxCorrectedCubemap.

◆ getDefaultWorkspaceDef()

const CompositorWorkspaceDef* Ogre::ParallaxCorrectedCubemapBase::getDefaultWorkspaceDef ( void  ) const
inherited

◆ getEnabled()

bool Ogre::ParallaxCorrectedCubemapAuto::getEnabled ( void  ) const

◆ getIblNumMipmaps()

static uint8 Ogre::ParallaxCorrectedCubemapBase::getIblNumMipmaps ( uint32  width,
uint32  height 
)
staticinherited

◆ getIblTargetTextureFlags()

uint32 Ogre::ParallaxCorrectedCubemapBase::getIblTargetTextureFlags ( PixelFormatGpu  pixelFormat) const
inherited

◆ getId()

IdType Ogre::IdObject::getId ( ) const
inlineinherited

Get the unique id of this object.

◆ getListener()

ParallaxCorrectedCubemapAutoListener* Ogre::ParallaxCorrectedCubemapAuto::getListener ( void  ) const
inline

◆ getProbes()

const CubemapProbeVec& Ogre::ParallaxCorrectedCubemapBase::getProbes ( void  ) const
inlineinherited

◆ getSceneManager()

SceneManager* Ogre::ParallaxCorrectedCubemapBase::getSceneManager ( void  ) const
inherited

◆ getUseDpm2DArray()

bool Ogre::ParallaxCorrectedCubemapBase::getUseDpm2DArray ( void  ) const
inlineinherited

◆ isRendering()

bool Ogre::ParallaxCorrectedCubemapBase::isRendering ( void  ) const
inlineinherited

Inform whether we're currently updating a probe.

Some Hlms / PCC combinations should not perform PCC while rendering, either because the RenderTarget is the same as the cubemap texture, or because other glitches may occur

◆ operator()() [1/2]

bool Ogre::IdObject::operator() ( const IdObject left,
const IdObject right 
)
inlineinherited

◆ operator()() [2/2]

bool Ogre::IdObject::operator() ( const IdObject left,
const IdObject right 
)
inlineinherited

◆ passEarlyPreExecute()

virtual void Ogre::CompositorWorkspaceListener::passEarlyPreExecute ( CompositorPass pass)
inlinevirtualinherited

Called early on in pass' execution.

Happens before passPreExecute, before the pass has set anything. Warning: calling pass->execute can result in recursive calls.

◆ passPosExecute()

virtual void Ogre::CompositorWorkspaceListener::passPosExecute ( CompositorPass pass)
inlinevirtualinherited

Called after a pass has been executed.

Warning: calling pass->execute can result in recursive calls.

◆ passPreExecute()

virtual void Ogre::ParallaxCorrectedCubemapAuto::passPreExecute ( CompositorPass pass)
virtual

Called when each pass is about to be executed.

Warning: calling pass->execute can result in recursive calls.

Reimplemented from Ogre::ParallaxCorrectedCubemapBase.

◆ passSceneAfterFrustumCulling()

virtual void Ogre::CompositorWorkspaceListener::passSceneAfterFrustumCulling ( CompositorPassScene pass)
inlinevirtualinherited

Called after a pass scene has performed frustum caulling but has yet to prepare and execute rendering commands.

Gets called after passSceneAfterFrustumCulling and before passPosExecute

Warning: calling pass->execute can result in recursive calls.

◆ passSceneAfterShadowMaps()

virtual void Ogre::CompositorWorkspaceListener::passSceneAfterShadowMaps ( CompositorPassScene pass)
inlinevirtualinherited

Called after a pass scene has rendered shadow casting (it gets called even if there is no shadow node).

Gets called after passPreExecute and before passSceneAfterFrustumCulling

Warning: calling pass->execute can result in recursive calls.

◆ prepareForClearScene()

virtual void Ogre::ParallaxCorrectedCubemapBase::prepareForClearScene ( void  )
virtualinherited

Destroys the Proxy Items.

Useful if you need to call sceneManager->clearScene(); The you MUST call this function before. i.e. pcc->prepareForClearScene(); sceneManager->clearScene(); pcc->restoreFromClearScene(); Updating ParallaxCorrectedCubemap without calling prepareForClearScene/restoreFromClearScene will result in a crash.

Reimplemented in Ogre::ParallaxCorrectedCubemap.

◆ releaseIbl()

virtual void Ogre::ParallaxCorrectedCubemapAuto::releaseIbl ( const TextureGpu tmpRtt)
virtual

◆ releaseTmpRtt()

virtual void Ogre::ParallaxCorrectedCubemapAuto::releaseTmpRtt ( const TextureGpu tmpRtt)
virtual

◆ restoreFromClearScene()

virtual void Ogre::ParallaxCorrectedCubemapBase::restoreFromClearScene ( void  )
virtualinherited

Reimplemented in Ogre::ParallaxCorrectedCubemap.

◆ setEnabled()

void Ogre::ParallaxCorrectedCubemapAuto::setEnabled ( bool  bEnabled,
uint32  width,
uint32  height,
uint32  maxNumProbes,
PixelFormatGpu  pixelFormat 
)

Enables/disables this ParallaxCorrectedCubemapAuto system.

It will (de)allocate some resources, thus it may cause stalls. If you need to temporarily pause the system (or toggle at high frequency) use mPaused instead (it's a public variable).

Parameters
bEnabledTrue to enable. False to disable. When false, the rest of the arguments are ignored.
widthUnlike the manual system, in PCC Auto all probes must use the same resolution
heightUnlike the manual system, in PCC Auto all probes must use the same resolution
maxNumProbesMax number of probes. Necessary. On AMD GCN cards, this should be a power of 2 otherwise the driver will internally round it up (and waste memory)
pixelFormatPixelFormatGpu for the cubemap

◆ setListener()

void Ogre::ParallaxCorrectedCubemapAuto::setListener ( ParallaxCorrectedCubemapAutoListener listener)
inline

◆ setUpdatedTrackedDataFromCamera()

void Ogre::ParallaxCorrectedCubemapAuto::setUpdatedTrackedDataFromCamera ( Camera trackedCamera)

Will update both mTrackedPosition with appropiate settings every time it's called.

Must be called every time the camera changes.

This information is used to know which nearby non-static probes need to be updated every frame.

Remarks
You don't have to use a camera, which is why mTrackedPosition is a public variables. Sometimes you want something else to be used as reference for probe update (e.g. character's position instead of the camera). This is up to you.
Parameters
trackedCameraCamera whose settings to use as reference. We will not keep a reference to this pointer.

◆ setUseDpm2DArray()

void Ogre::ParallaxCorrectedCubemapAuto::setUseDpm2DArray ( bool  useDpm2DArray)

Whether we should use Dual Paraboloid Mapping with 2D Array instead of Cubemap Arrays.

Remarks
DPM is lower quality than cubemap arrays. However not all GPUs support cubemap arrays, most notably iOS GPUs before A11 chips and DX10 level HW.

When cubemap arrays are not supported, this setting is always forced on.
When cubemap arrays are supported, it's up to you. The most likely reason you want to use DPM overy cubemap arrays is to see how it looks like on unsupported platforms.

You cannot toggle this setting after enabling the system. You must call ParallaxCorrectedCubemapAuto::setEnabled( false, ... ); to switch this.

Parameters
useDpm2DArrayTrue to use DPM, cubemap arrays otherwise. Default: False unless GPU does not support cubemap arrays

◆ updateAllDirtyProbes()

void Ogre::ParallaxCorrectedCubemapAuto::updateAllDirtyProbes ( void  )

By default the probes will be constructed when the user enters the vecinity of non-static probes, and whenever a static probe is dirty.

This can cause noticeable stalls. Use this function to regenerate them all at once (i.e. at loading time) This function also uses a memory-friendly way of updating the probes.

◆ workspacePosUpdate()

virtual void Ogre::CompositorWorkspaceListener::workspacePosUpdate ( CompositorWorkspace workspace)
inlinevirtualinherited

Called after all nodes has been updated.

◆ workspacePreUpdate()

virtual void Ogre::CompositorWorkspaceListener::workspacePreUpdate ( CompositorWorkspace workspace)
inlinevirtualinherited

Called before all nodes are going to be updated.

Use this place to update your own, manually updated Workspaces without having to call ::_beginUpdate( forceBeginFrame=true )

Member Data Documentation

◆ mMask

uint32 Ogre::ParallaxCorrectedCubemapBase::mMask
inherited

◆ mPaused

bool Ogre::ParallaxCorrectedCubemapBase::mPaused
inherited

◆ mTrackedPosition

Vector3 Ogre::ParallaxCorrectedCubemapAuto::mTrackedPosition

This variable should be updated every frame and often represents the camera position, but it can also be used set to other things like the player's character position.


The documentation for this class was generated from the following file: