![]() |
SLProject 4.0.000
|
Class for compact uniform grid acceleration structure. More...
#include <SLCompactGrid.h>
Public Types | |
| using | Triangle = std::array< SLVec3f, 3 > |
Public Member Functions | |
| SLCompactGrid (SLMesh *m) | |
| ~SLCompactGrid () | |
| void | build (SLVec3f minV, SLVec3f maxV) |
| void | updateStats (SLNodeStats &stats) |
| Updates the statistics in the parent node. More... | |
| void | draw (SLSceneView *sv) |
| SLCompactGrid::draw draws the non-empty voxels of the uniform grid. More... | |
| SLbool | intersect (SLRay *ray, SLNode *node) |
| void | deleteAll () |
| Deletes the entire uniform grid data. More... | |
| void | disposeBuffers () |
| SLuint | indexAtPos (const SLVec3i &p) const |
| SLVec3f | voxelCenter (const SLVec3i &pos) const |
| Returns the voxel center point for a given voxel by index. More... | |
| SLVec3i | containingVoxel (const SLVec3f &p) const |
| Returns the indices of the voxel around a given point. More... | |
| void | getMinMaxVoxel (const Triangle &triangle, SLVec3i &minCell, SLVec3i &maxCell) |
| Returns the min. and max. voxel of a triangle. More... | |
| void | ifTriangleInVoxelDo (triVoxCallback cb) |
| Loops over triangles gets their voxels and calls the callback function. More... | |
Public Member Functions inherited from SLAccelStruct | |
| SLAccelStruct (SLMesh *m) | |
| virtual | ~SLAccelStruct () |
| virtual void | build (SLVec3f minV, SLVec3f maxV)=0 |
| virtual void | updateStats (SLNodeStats &stats)=0 |
| virtual void | draw (SLSceneView *sv)=0 |
| virtual SLbool | intersect (SLRay *ray, SLNode *node)=0 |
| virtual void | disposeBuffers ()=0 |
Private Attributes | |
| SLVec3ui | _size |
| num. of voxel in grid dir. More... | |
| SLuint | _numTriangles |
| NO. of triangles in the mesh. More... | |
| SLVec3f | _voxelSize |
| size of a voxel More... | |
| SLVec3f | _voxelSizeHalf |
| half size of a voxel More... | |
| SLVuint | _voxelOffsets |
| Offset array (C in the paper) More... | |
| SLVushort | _triangleIndexes16 |
| 16 bit triangle index array (L in the paper) More... | |
| SLVuint | _triangleIndexes32 |
| 32 bit triangle index array (L in the paper) More... | |
| SLGLVertexArrayExt | _vao |
| Vertex array object for rendering. More... | |
Additional Inherited Members | |
Protected Attributes inherited from SLAccelStruct | |
| SLMesh * | _m |
| Pointer to the mesh. More... | |
| SLVec3f | _minV |
| min. point of AABB More... | |
| SLVec3f | _maxV |
| max. point of AABB More... | |
| SLuint | _voxelCnt |
| NO. of voxels in accelerator. More... | |
| SLuint | _voxelCntEmpty |
| NO. of empty voxels. More... | |
| SLuint | _voxelMaxTria |
| max. no. of triangles pre voxel More... | |
| SLfloat | _voxelAvgTria |
| avg. no. of triangles per voxel More... | |
Class for compact uniform grid acceleration structure.
This class implements the data structure proposed by Lagae & Dutre in their paper "Compact, Fast and Robust Grids for Ray Tracing". It reduces the memory footprint to 20% of a regular uniform grid implemented in SLUniformGrid.
| using SLCompactGrid::Triangle = std::array<SLVec3f, 3> |
| SLCompactGrid::SLCompactGrid | ( | SLMesh * | m | ) |
|
inline |
SLCompactGrid::build implements the data structure proposed by Lagae & Dutre in their paper "Compact, Fast and Robust Grids for Ray Tracing".
Implements SLAccelStruct.
Returns the indices of the voxel around a given point.
| void SLCompactGrid::deleteAll | ( | ) |
Deletes the entire uniform grid data.
|
inlinevirtual |
Implements SLAccelStruct.
|
virtual |
SLCompactGrid::draw draws the non-empty voxels of the uniform grid.
Implements SLAccelStruct.
| void SLCompactGrid::getMinMaxVoxel | ( | const Triangle & | triangle, |
| SLVec3i & | minCell, | ||
| SLVec3i & | maxCell | ||
| ) |
Returns the min. and max. voxel of a triangle.
| void SLCompactGrid::ifTriangleInVoxelDo | ( | triVoxCallback | cb | ) |
Loops over triangles gets their voxels and calls the callback function.
Ray Mesh intersection method using the regular grid space subdivision structure and a voxel traversal algorithm described in "A Fast Voxel Traversal Algorithm for Ray Tracing" by John Amanatides and Andrew Woo.
Implements SLAccelStruct.
|
virtual |
Updates the statistics in the parent node.
Implements SLAccelStruct.
Returns the voxel center point for a given voxel by index.
|
private |
NO. of triangles in the mesh.
|
private |
num. of voxel in grid dir.
|
private |
16 bit triangle index array (L in the paper)
|
private |
32 bit triangle index array (L in the paper)
|
private |
Vertex array object for rendering.
|
private |
Offset array (C in the paper)
|
private |
size of a voxel
|
private |
half size of a voxel