![]()  | 
  
    SLProject
    4.2.000
    
   A platform independent 3D computer graphics framework for desktop OS,  Android,  iOS and online in web browsers 
   | 
 
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 () | 
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.
Definition at line 29 of file SLCompactGrid.h.
| using SLCompactGrid::Triangle = std::array<SLVec3f, 3> | 
Definition at line 32 of file SLCompactGrid.h.
| SLCompactGrid::SLCompactGrid | ( | SLMesh * | m | ) | 
Definition at line 16 of file SLCompactGrid.cpp.
      
  | 
  inline | 
Definition at line 35 of file SLCompactGrid.h.
SLCompactGrid::build implements the data structure proposed by Lagae & Dutre in their paper "Compact, Fast and Robust Grids for Ray Tracing".
Implements SLAccelStruct.
Definition at line 121 of file SLCompactGrid.cpp.
Returns the indices of the voxel around a given point.
Definition at line 24 of file SLCompactGrid.cpp.
| void SLCompactGrid::deleteAll | ( | ) | 
Deletes the entire uniform grid data.
Definition at line 66 of file SLCompactGrid.cpp.
      
  | 
  inlinevirtual | 
Implements SLAccelStruct.
Definition at line 43 of file SLCompactGrid.h.
      
  | 
  virtual | 
SLCompactGrid::draw draws the non-empty voxels of the uniform grid.
Implements SLAccelStruct.
Definition at line 211 of file SLCompactGrid.cpp.
| void SLCompactGrid::getMinMaxVoxel | ( | const Triangle & | triangle, | 
| SLVec3i & | minCell, | ||
| SLVec3i & | maxCell | ||
| ) | 
Returns the min. and max. voxel of a triangle.
Definition at line 52 of file SLCompactGrid.cpp.
| void SLCompactGrid::ifTriangleInVoxelDo | ( | triVoxCallback | cb | ) | 
Loops over triangles gets their voxels and calls the callback function.
Definition at line 81 of file SLCompactGrid.cpp.
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.
Definition at line 278 of file SLCompactGrid.cpp.
      
  | 
  virtual | 
Updates the statistics in the parent node.
Implements SLAccelStruct.
Definition at line 196 of file SLCompactGrid.cpp.
Returns the voxel center point for a given voxel by index.
Definition at line 44 of file SLCompactGrid.cpp.
      
  | 
  private | 
NO. of triangles in the mesh.
Definition at line 63 of file SLCompactGrid.h.
      
  | 
  private | 
num. of voxel in grid dir.
Definition at line 62 of file SLCompactGrid.h.
      
  | 
  private | 
16 bit triangle index array (L in the paper)
Definition at line 67 of file SLCompactGrid.h.
      
  | 
  private | 
32 bit triangle index array (L in the paper)
Definition at line 68 of file SLCompactGrid.h.
      
  | 
  private | 
Vertex array object for rendering.
Definition at line 69 of file SLCompactGrid.h.
      
  | 
  private | 
Offset array (C in the paper)
Definition at line 66 of file SLCompactGrid.h.
      
  | 
  private | 
size of a voxel
Definition at line 64 of file SLCompactGrid.h.
      
  | 
  private | 
half size of a voxel
Definition at line 65 of file SLCompactGrid.h.