OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::VoxelizedMeshCache Class Reference

Uses a VctVoxelizer to convert a single mesh made up of triangles into a voxel 3D texture representation. More...

#include <OgreVoxelizedMeshCache.h>

+ Inheritance diagram for Ogre::VoxelizedMeshCache:

Classes

struct  VoxelizedMesh
 

Public Member Functions

 VoxelizedMeshCache (IdType id, TextureGpuManager *textureManager)
 
 ~VoxelizedMeshCache ()
 
const VoxelizedMeshaddMeshToCache (const MeshPtr &mesh, SceneManager *sceneManager, RenderSystem *renderSystem, HlmsManager *hlmsManager, const Item *refItem)
 addMeshToCache Checks if the mesh is already cached. More...
 
TextureGpugetBlankEmissive ()
 
void setCacheResolution (uint32 width, uint32 height, uint32 depth, uint32 maxWidth, uint32 maxHeight, uint32 maxDepth, const Ogre::Vector3 &dimension)
 setCacheResolution When building the mesh cache, meshes must be voxelized at some arbitrary resolution This function lets you specify how many voxels per volume in units. More...
 

Public Attributes

FastArray< int32mGlslTexUnits
 The number of texture units GL can handle may exceed the hard limit in ShaderParams::ManualParam::dataBytes so we need to use EX and store the data here. More...
 

Detailed Description

Uses a VctVoxelizer to convert a single mesh made up of triangles into a voxel 3D texture representation.

This cache can be shared by multiple users (e.g. VctImageVoxelizer)

Constructor & Destructor Documentation

◆ VoxelizedMeshCache()

Ogre::VoxelizedMeshCache::VoxelizedMeshCache ( IdType  id,
TextureGpuManager textureManager 
)

◆ ~VoxelizedMeshCache()

Ogre::VoxelizedMeshCache::~VoxelizedMeshCache ( )

Member Function Documentation

◆ addMeshToCache()

const VoxelizedMesh& Ogre::VoxelizedMeshCache::addMeshToCache ( const MeshPtr mesh,
SceneManager sceneManager,
RenderSystem renderSystem,
HlmsManager hlmsManager,
const Item refItem 
)

addMeshToCache Checks if the mesh is already cached.

If it's not, it gets voxelized.

Parameters
meshMesh to voxelize
sceneManagerWe need it to temporarily create an Item
refItemReference Item in case we need to copy its materials. Can be nullptr
Returns
Entry to VoxelizedMesh in cache

◆ getBlankEmissive()

TextureGpu* Ogre::VoxelizedMeshCache::getBlankEmissive ( )
inline

◆ setCacheResolution()

void Ogre::VoxelizedMeshCache::setCacheResolution ( uint32  width,
uint32  height,
uint32  depth,
uint32  maxWidth,
uint32  maxHeight,
uint32  maxDepth,
const Ogre::Vector3 dimension 
)

setCacheResolution When building the mesh cache, meshes must be voxelized at some arbitrary resolution This function lets you specify how many voxels per volume in units.

e.g. if you call

imageVoxelizer->setCacheResolution( 32u, 32u, 32u, maxWidth, maxHeight, maxDepth
Ogre::Vector3( 1.0f, 1.0f, 1.0f ) );
Standard 3-dimensional vector.
Definition: OgreVector3.h:52

And the mesh AABB is 2x2x2 in units, then we will voxelize at 64x64x64 voxels (unless this resolution exceeds maxWidth/maxHeight/maxDepth)

Remarks
This setting can be changed individually for each mesh. Call it as often as you need. e.g. a literal cube mesh only needs 1x1x1 of resolution.
Parameters
widthThe width in pixels per dimension.x in units i.e. the width / dimension.x
heightThe height in pixels per dimension.y in units i.e. the height / dimension.y
depthThe height in pixels per dimension.z in units i.e. the depth / dimension.z
maxWidthWidth can never exceed this value
maxHeightHeight can never exceed this value
maxDepthDepth can never exceed this value
dimensionUnits to cover (see previous parameters)

Member Data Documentation

◆ mGlslTexUnits

FastArray<int32> Ogre::VoxelizedMeshCache::mGlslTexUnits

The number of texture units GL can handle may exceed the hard limit in ShaderParams::ManualParam::dataBytes so we need to use EX and store the data here.


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