OGRE-Next
4.0.0unstable
Object-Oriented Graphics Rendering Engine
|
The image voxelizer aims to be faster than VctImageVoxelizer for the whole scene by following a different approach: More...
#include <OgreVctImageVoxelizer.h>
Public Member Functions | |
VctImageVoxelizer (IdType id, RenderSystem *renderSystem, HlmsManager *hlmsManager, VoxelizedMeshCache *meshCache, bool correctAreaLightShadows) | |
~VctImageVoxelizer () override | |
void | addItem (Item *item) |
Adds an item to voxelize. More... | |
void | autoCalculateRegion () |
Does nothing if VctImageVoxelizer::setRegionToVoxelize( false, ... ) was called. More... | |
void | build (SceneManager *sceneManager) |
void | buildRelative (SceneManager *sceneManager, const int32 diffX, const int32 diffY, const int32 diffZ, const uint32 numOctantsX, const uint32 numOctantsY, const uint32 numOctantsZ) |
If the camera has moved by 1 voxel to the right (i.e. More... | |
void | dividideOctants (uint32 numOctantsX, uint32 numOctantsY, uint32 numOctantsZ) |
void | forceFullBuild () |
void | removeAllItems () |
Removes all items added via VctImageVoxelizer::addItem. More... | |
void | removeItem (Item *item) |
Removes an item added via VctImageVoxelizer::addItem. More... | |
void | restoreSwappedVoxelTextures () |
Swaps mAlbedoVox & mAlbedoVoxAlt (and co.) if needed back to their originals. More... | |
void | setRegionToVoxelize (bool autoRegion, const Aabb ®ionToVoxelize, const Aabb &maxRegion=Aabb::BOX_INFINITE) |
Call this function before VctImageVoxelizer::autoCalculateRegion. More... | |
void | setSceneResolution (uint32 width, uint32 height, uint32 depth) |
Changes resolution. More... | |
Public Member Functions inherited from Ogre::VctVoxelizerSourceBase | |
VctVoxelizerSourceBase (IdType id, RenderSystem *renderSystem, HlmsManager *hlmsManager) | |
virtual | ~VctVoxelizerSourceBase () |
TextureGpu * | getAlbedoVox () |
VctVoxelizerSourceBase::DebugVisualizationMode | getDebugVisualizationMode () const |
TextureGpu * | getEmissiveVox () |
HlmsManager * | getHlmsManager () |
TextureGpu * | getNormalVox () |
RenderSystem * | getRenderSystem () |
TextureGpuManager * | getTextureGpuManager () |
Vector3 | getVoxelCellSize () const |
Vector3 | getVoxelOrigin () const |
Vector3 | getVoxelResolution () const |
Vector3 | getVoxelSize () const |
void | setDebugVisualization (VctVoxelizerSourceBase::DebugVisualizationMode mode, SceneManager *sceneManager) |
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) |
Additional Inherited Members | |
Public Types inherited from Ogre::VctVoxelizerSourceBase | |
enum | DebugVisualizationMode { DebugVisualizationAlbedo , DebugVisualizationNormal , DebugVisualizationEmissive , DebugVisualizationNone } |
The image voxelizer aims to be faster than VctImageVoxelizer for the whole scene by following a different approach:
1. For each single mesh, use VctImageVoxelizer to keep a voxelized texture version and save it to disk 2. At build time, VctImageVoxelizer builds the voxel of the whole scene by iterating each mesh using those cached texture versions like a collage.
Ogre::VctImageVoxelizer::VctImageVoxelizer | ( | IdType | id, |
RenderSystem * | renderSystem, | ||
HlmsManager * | hlmsManager, | ||
VoxelizedMeshCache * | meshCache, | ||
bool | correctAreaLightShadows | ||
) |
|
override |
void Ogre::VctImageVoxelizer::addItem | ( | Item * | item | ) |
Adds an item to voxelize.
item |
void Ogre::VctImageVoxelizer::autoCalculateRegion | ( | ) |
Does nothing if VctImageVoxelizer::setRegionToVoxelize( false, ... ) was called.
void Ogre::VctImageVoxelizer::build | ( | SceneManager * | sceneManager | ) |
void Ogre::VctImageVoxelizer::buildRelative | ( | SceneManager * | sceneManager, |
const int32 | diffX, | ||
const int32 | diffY, | ||
const int32 | diffZ, | ||
const uint32 | numOctantsX, | ||
const uint32 | numOctantsY, | ||
const uint32 | numOctantsZ | ||
) |
If the camera has moved by 1 voxel to the right (i.e.
diffX = 1) we will "translate" the voxels by 1 and then partially rebuild those sections
sceneManager | |
diffX | How many voxels to translate to the left/right |
diffY | How many voxels to translate up/down |
diffZ | How many voxels to translate to the forward/backwards |
numOctantsX | If we must perform a full rebuild, then the parameter passed to dividideOctants |
numOctantsY | See numOctantsX |
numOctantsZ | See numOctantsX |
void Ogre::VctImageVoxelizer::dividideOctants | ( | uint32 | numOctantsX, |
uint32 | numOctantsY, | ||
uint32 | numOctantsZ | ||
) |
|
inline |
void Ogre::VctImageVoxelizer::removeAllItems | ( | ) |
Removes all items added via VctImageVoxelizer::addItem.
void Ogre::VctImageVoxelizer::removeItem | ( | Item * | item | ) |
Removes an item added via VctImageVoxelizer::addItem.
item | Item to remove |
void Ogre::VctImageVoxelizer::restoreSwappedVoxelTextures | ( | ) |
Swaps mAlbedoVox & mAlbedoVoxAlt (and co.) if needed back to their originals.
This is needed during shutdown since VctLighting otherwise will try to remove itself as a listener from mAlbedoVoxAlt
void Ogre::VctImageVoxelizer::setRegionToVoxelize | ( | bool | autoRegion, |
const Aabb & | regionToVoxelize, | ||
const Aabb & | maxRegion = Aabb::BOX_INFINITE |
||
) |
Call this function before VctImageVoxelizer::autoCalculateRegion.
autoRegion | True to autocalculate region to cover all the added items False to use 'regionToVoxelize' instead |
regionToVoxelize | When autoRegion = false, use this to manually provide the region When autoRegion = true, it is ignored as it will be overwritten by autoCalculateRegion |
maxRegion | Maximum size of the regions are allowed to cover (mostly useful when autoRegion = true) |
Changes resolution.
Note that after calling this, you will need to call VctImageVoxelizer::build again, and VctLighting::build again.
width | |
height | |
depth |