OGRE-Next
4.0.0unstable
Object-Oriented Graphics Rendering Engine
|
Per-Pixel reflection probes. More...
#include <OgreParallaxCorrectedCubemapAuto.h>
Public Member Functions | |
ParallaxCorrectedCubemapAuto (IdType id, Root *root, SceneManager *sceneManager, const CompositorWorkspaceDef *probeWorkspaceDef) | |
~ParallaxCorrectedCubemapAuto () override | |
TextureGpu * | _acquireTextureSlot (uint16 &outTexSlot) override |
Acquires a texture with a given slot. More... | |
void | _copyRenderTargetToCubemap (uint32 cubemapArrayIdx) override |
void | _releaseTextureSlot (TextureGpu *texture, uint32 texSlot) override |
void | allWorkspacesBeforeBeginUpdate () override |
Called from CompositorManager2 (not CompositorWorkspace) when we're about to begin updating all the workspaces. More... | |
void | allWorkspacesBeginUpdate () override |
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... | |
void | destroyProbe (CubemapProbe *probe) override |
TextureGpu * | findIbl (const TextureGpu *baseParams) override |
TextureGpu * | findTmpRtt (const TextureGpu *baseParams) override |
See mTmpRtt. More... | |
bool | frameStarted (const FrameEvent &evt) override |
Called when a frame is about to begin rendering. More... | |
bool | getEnabled () const |
ParallaxCorrectedCubemapAutoListener * | getListener () const |
void | passPreExecute (CompositorPass *pass) override |
Called when each pass is about to be executed. More... | |
void | releaseIbl (const TextureGpu *tmpRtt) override |
void | releaseTmpRtt (const TextureGpu *tmpRtt) override |
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 () override |
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... | |
Public Member Functions inherited from Ogre::ParallaxCorrectedCubemapBase | |
ParallaxCorrectedCubemapBase (IdType id, Root *root, SceneManager *sceneManager, const CompositorWorkspaceDef *probeWorkspaceDef, bool automaticMode) | |
~ParallaxCorrectedCubemapBase () override | |
virtual void | _addManuallyActiveProbe (CubemapProbe *probe) |
virtual void | _notifyPreparePassHash (const Matrix4 &viewMatrix) |
virtual void | _releaseManualHardwareResources () |
virtual void | _removeManuallyActiveProbe (CubemapProbe *probe) |
virtual void | _restoreManualHardwareResources () |
void | _setIsRendering (bool bIsRendering) |
void | _setProbeRenderInProgress (CubemapProbe *probe) |
CubemapProbe * | createProbe () |
Adds a cubemap probe. More... | |
virtual void | destroyAllProbes () |
void | eventOccurred (const String &eventName, const NameValuePairList *parameters) override |
A rendersystem-specific event occurred. More... | |
virtual void | fillConstBufferData (const Matrix4 &viewMatrix, float *RESTRICT_ALIAS passBufferPtr) const |
bool | getAutomaticMode () const |
TextureGpu * | getBindTexture () const |
const HlmsSamplerblock * | getBindTrilinearSamplerblock () |
virtual size_t | getConstBufferSize () |
const CompositorWorkspaceDef * | getDefaultWorkspaceDef () const |
uint32 | getIblTargetTextureFlags (PixelFormatGpu pixelFormat) const |
const CubemapProbeVec & | getProbes () const |
SceneManager * | getSceneManager () const |
bool | getUseDpm2DArray () const |
bool | isRendering () const |
Inform whether we're currently updating a probe. More... | |
void | passPreExecute (CompositorPass *pass) override |
Called when each pass is about to be executed. More... | |
virtual void | prepareForClearScene () |
Destroys the Proxy Items. More... | |
virtual void | restoreFromClearScene () |
Public Member Functions inherited from Ogre::IdObject | |
IdObject (IdType id) | |
We don't call generateNewId() here, to prevent objects in the stack (i.e. More... | |
IdType | getId () const |
Get the unique id of this object. More... | |
bool | operator() (const IdObject &left, const IdObject &right) |
bool | operator() (const IdObject *left, const IdObject *right) |
Public Member Functions inherited from Ogre::RenderSystem::Listener | |
Listener () | |
virtual | ~Listener () |
Public Member Functions inherited from Ogre::CompositorWorkspaceListener | |
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 | 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 | 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... | |
Public Member Functions inherited from Ogre::FrameListener | |
virtual | ~FrameListener () |
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... | |
Public Attributes | |
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... | |
Public Attributes inherited from Ogre::ParallaxCorrectedCubemapBase | |
uint32 | mMask |
bool | mPaused |
Additional Inherited Members | |
Static Public Member Functions inherited from Ogre::ParallaxCorrectedCubemapBase | |
static void | fillConstBufferData (const CubemapProbe &probe, const Matrix4 &viewMatrix, const Matrix3 &invViewMat3, float *RESTRICT_ALIAS passBufferPtr) |
static uint8 | getIblNumMipmaps (uint32 width, uint32 height) |
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.
Ogre::ParallaxCorrectedCubemapAuto::ParallaxCorrectedCubemapAuto | ( | IdType | id, |
Root * | root, | ||
SceneManager * | sceneManager, | ||
const CompositorWorkspaceDef * | probeWorkspaceDef | ||
) |
|
override |
|
overridevirtual |
Acquires a texture with a given slot.
outTexSlot | [out] Texture slot. Value is left untouched if return value is nullptr |
Reimplemented from Ogre::ParallaxCorrectedCubemapBase.
|
overridevirtual |
Reimplemented from Ogre::ParallaxCorrectedCubemapBase.
|
overridevirtual |
Reimplemented from Ogre::ParallaxCorrectedCubemapBase.
|
overridevirtual |
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.
|
overridevirtual |
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.
|
overridevirtual |
Reimplemented from Ogre::ParallaxCorrectedCubemapBase.
|
overridevirtual |
Reimplemented from Ogre::ParallaxCorrectedCubemapBase.
|
overridevirtual |
See mTmpRtt.
Finds an RTT that is compatible to copy to baseParams. Creates one if none found.
Reimplemented from Ogre::ParallaxCorrectedCubemapBase.
|
overridevirtual |
Called when a frame is about to begin rendering.
Reimplemented from Ogre::FrameListener.
bool Ogre::ParallaxCorrectedCubemapAuto::getEnabled | ( | ) | const |
|
inline |
|
overridevirtual |
Called when each pass is about to be executed.
Warning: calling pass->execute can result in recursive calls.
Reimplemented from Ogre::CompositorWorkspaceListener.
|
overridevirtual |
Reimplemented from Ogre::ParallaxCorrectedCubemapBase.
|
overridevirtual |
Reimplemented from Ogre::ParallaxCorrectedCubemapBase.
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).
bEnabled | True to enable. False to disable. When false, the rest of the arguments are ignored. |
width | Unlike the manual system, in PCC Auto all probes must use the same resolution |
height | Unlike the manual system, in PCC Auto all probes must use the same resolution |
maxNumProbes | Max 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) |
pixelFormat | PixelFormatGpu for the cubemap |
|
inline |
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.
trackedCamera | Camera whose settings to use as reference. We will not keep a reference to this pointer. |
void Ogre::ParallaxCorrectedCubemapAuto::setUseDpm2DArray | ( | bool | useDpm2DArray | ) |
Whether we should use Dual Paraboloid Mapping with 2D Array instead of Cubemap Arrays.
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.
useDpm2DArray | True to use DPM, cubemap arrays otherwise. Default: False unless GPU does not support cubemap arrays |
|
overridevirtual |
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.
Implements Ogre::ParallaxCorrectedCubemapBase.
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.