OGRE-Next
4.0.0unstable
Object-Oriented Graphics Rendering Engine
|
This class manages multiple cascades of Voxels and each cascade can be composed of VctImageVoxelizer. More...
#include <OgreVctCascadedVoxelizer.h>
Public Member Functions | |
VctCascadedVoxelizer () | |
virtual | ~VctCascadedVoxelizer () |
void | addAllItems (SceneManager *sceneManager, const uint32 visibilityFlags, const bool bStatic) |
Adds all items in SceneManager that match visibilityFlags. More... | |
void | addCascade (const VctCascadeSetting &cascadeSetting) |
Adds a new cascade. More... | |
void | addItem (Item *item) |
Adds the given item to the voxelizer in all cascades. More... | |
void | allWorkspacesBeforeBeginUpdate () override |
CompositorWorkspaceListener override. More... | |
void | autoCalculateStepSizes (const Vector3 stepSize) |
Alters each cascade's step size. More... | |
const Vector3 & | getCameraPosition () const |
VctCascadeSetting & | getCascade (size_t idx) |
bool | getConsistentCascadeSteps () const |
VoxelizedMeshCache * | getMeshCache () |
Returns the mesh cache (shared by all cascades) in case you want to add a mesh manually with custom settings. More... | |
uint32 | getNumBounces () const |
Returns number of bounces for cascade 0. More... | |
size_t | getNumCascades () const |
VctLighting * | getVctLighting (size_t idx) |
void | init (RenderSystem *renderSystem, HlmsManager *hlmsManager, uint32 numBounces, bool bAnisotropic) |
Call this function after adding all cascades. More... | |
bool | isAnisotropic () const |
Returns if we're using anisotropic VCT. More... | |
void | popCascade () |
Destroys the last created cascade. More... | |
void | removeAllItems () |
Removes all items from all cascades. More... | |
void | removeItem (Item *item) |
Removes the given item to the voxelizer in all cascades. More... | |
void | reserveNumCascades (size_t numCascades) |
Tells beforehand how many cascades there will be. More... | |
void | setAutoUpdate (CompositorManager2 *compositorManager, SceneManager *sceneManager) |
Register against the CompositorManager to call VctCascadedVoxelizer::update automatically when the CompositorManager is about to render (recommended) More... | |
void | setCameraPosition (const Vector3 &cameraPosition) |
void | setConsistentCascadeSteps (bool bConsistentCascadeSteps) |
Selects how we determine when we need to (partially) rebuild the voxels based on camera movement. More... | |
void | setNewSettings (uint32 numBounces, bool bAnisotropic) |
Sets new settings after having called init. More... | |
void | update (SceneManager *sceneManager) |
You can call this directly with sceneManager, but we assume all objects are already updated (i.e. More... | |
Public Member Functions inherited from Ogre::CompositorWorkspaceListener | |
virtual void | allWorkspacesBeginUpdate () |
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... | |
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 | 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... | |
This class manages multiple cascades of Voxels and each cascade can be composed of VctImageVoxelizer.
Ogre::VctCascadedVoxelizer::VctCascadedVoxelizer | ( | ) |
|
virtual |
void Ogre::VctCascadedVoxelizer::addAllItems | ( | SceneManager * | sceneManager, |
const uint32 | visibilityFlags, | ||
const bool | bStatic | ||
) |
Adds all items in SceneManager that match visibilityFlags.
sceneManager | SceneManager ptr |
visibilityFlags | Visibility Mask to exclude Items |
bStatic | True to add only static Items False to add only dynamic Items |
void Ogre::VctCascadedVoxelizer::addCascade | ( | const VctCascadeSetting & | cascadeSetting | ) |
Adds a new cascade.
VctCascadeSetting::voxelizer must be nullptr Cannot be called after VctCascadedVoxelizer::init
void Ogre::VctCascadedVoxelizer::addItem | ( | Item * | item | ) |
Adds the given item to the voxelizer in all cascades.
|
overridevirtual |
CompositorWorkspaceListener override.
Reimplemented from Ogre::CompositorWorkspaceListener.
void Ogre::VctCascadedVoxelizer::autoCalculateStepSizes | ( | const Vector3 | stepSize | ) |
Alters each cascade's step size.
The last cascade is set to stepSize.
The rest of the cascades are set to step sizes that are >= stepSize automatically
|
inline |
|
inline |
|
inline |
|
inline |
Returns the mesh cache (shared by all cascades) in case you want to add a mesh manually with custom settings.
|
inline |
Returns number of bounces for cascade 0.
The others are calculated automatically See VctCascadedVoxelizer::init
|
inline |
References Ogre::FastArray< T >::size().
|
inline |
void Ogre::VctCascadedVoxelizer::init | ( | RenderSystem * | renderSystem, |
HlmsManager * | hlmsManager, | ||
uint32 | numBounces, | ||
bool | bAnisotropic | ||
) |
Call this function after adding all cascades.
You can no longer add cascades after this
numBounces | Number of bounces for cascade 0. The rest of the cascades are autocalculated to maintain even brightness levels. |
Range is [0; inf) but a value of 0 is strongly discouraged if you have more than 1 cascade as you can end up with very uneven brightness levels between cascades
bAnisotropic | Whether we should use anisotropic VCT |
|
inline |
Returns if we're using anisotropic VCT.
void Ogre::VctCascadedVoxelizer::popCascade | ( | ) |
Destroys the last created cascade.
VctCascadeSetting::voxelizer must be nullptr Cannot be called after VctCascadedVoxelizer::init
void Ogre::VctCascadedVoxelizer::removeAllItems | ( | ) |
Removes all items from all cascades.
void Ogre::VctCascadedVoxelizer::removeItem | ( | Item * | item | ) |
Removes the given item to the voxelizer in all cascades.
void Ogre::VctCascadedVoxelizer::reserveNumCascades | ( | size_t | numCascades | ) |
Tells beforehand how many cascades there will be.
It's not necessary to call this, but recommended
void Ogre::VctCascadedVoxelizer::setAutoUpdate | ( | CompositorManager2 * | compositorManager, |
SceneManager * | sceneManager | ||
) |
Register against the CompositorManager to call VctCascadedVoxelizer::update automatically when the CompositorManager is about to render (recommended)
You still must call setCameraPosition every frame though (or whenever the camera changes)
Set to nullptr to disable auto update
void Ogre::VctCascadedVoxelizer::setCameraPosition | ( | const Vector3 & | cameraPosition | ) |
void Ogre::VctCascadedVoxelizer::setConsistentCascadeSteps | ( | bool | bConsistentCascadeSteps | ) |
Selects how we determine when we need to (partially) rebuild the voxels based on camera movement.
This value can be changed at any point and switch back and forth
bConsistentCascadeSteps | True: Results can feel very determnistic because it is predictable. |
Camera position is quantized in voxelCellSize * cascade.cameraStepSize. This means the camera position is in a 'cell' or 'grid'.
When the camera position moves onto another grid, we partially revoxelize results.
Advantage: A camera at pos XYZ will always have the same results
Disadvantage: if the camera jumps back and forth between voxels, revoxelizations will trigger frequently causing obvious frequent jumps in brightness
False: Revoxelization happens after the camera has travelled cascade.cameraStepSize cells away from the last point of voxelization.
Advantage: Infrequent revoxelizations. If camera movement is restricted around the last voxelization point, we will never revoxelize.
Disadvantage: Taking a picture at pos XYZ, then going away, and taking another picture at same pos XYZ may not result in the same brightness / image; which can make it feel unpredictable or non-deterministic. This can be workarounded by temporarily setting setConsistentCascadeSteps( true ) then back false after taking the picture
void Ogre::VctCascadedVoxelizer::setNewSettings | ( | uint32 | numBounces, |
bool | bAnisotropic | ||
) |
Sets new settings after having called init.
void Ogre::VctCascadedVoxelizer::update | ( | SceneManager * | sceneManager | ) |
You can call this directly with sceneManager, but we assume all objects are already updated (i.e.
SceneManager::updateSceneGraph already called)