SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SLAccelStruct.h
Go to the documentation of this file.
1 /**
2  * \file SLAccelStruct.h
3  * \authors Marcus Hudritsch
4  * \date July 2014
5  * \authors Marcus Hudritsch
6  * \copyright http://opensource.org/licenses/GPL-3.0
7 */
8 
9 #ifndef SLACCELSTRUCT_H
10 #define SLACCELSTRUCT_H
11 
12 #include <SLMesh.h>
13 
14 //-----------------------------------------------------------------------------
15 //! SLAccelStruct is an abstract base class for acceleration structures
16 /*! The SLAccelStruct class serves as common class for the SLUniformGrid,
17 SLCompactGrid and the SLKDTree class. All derived acceleration structures must
18 be able to build, draw, intersect with a ray and update statistics.
19 All structures work on meshes.
20 */
22 {
23 public:
24  SLAccelStruct(SLMesh* m) { _m = m; }
25  virtual ~SLAccelStruct() { ; }
26 
27  virtual void build(SLVec3f minV, SLVec3f maxV) = 0;
28  virtual void updateStats(SLNodeStats& stats) = 0;
29  virtual void draw(SLSceneView* sv) = 0;
30  virtual SLbool intersect(SLRay* ray, SLNode* node) = 0;
31  virtual void disposeBuffers() = 0;
32 
33 protected:
34  SLMesh* _m; //!< Pointer to the mesh
35  SLVec3f _minV; //!< min. point of AABB
36  SLVec3f _maxV; //!< max. point of AABB
37 
38  SLuint _voxelCnt; //!< NO. of voxels in accelerator
39  SLuint _voxelCntEmpty; //!< NO. of empty voxels
40  SLuint _voxelMaxTria; //!< max. no. of triangles pre voxel
41  SLfloat _voxelAvgTria; //!< avg. no. of triangles per voxel
42 };
43 //-----------------------------------------------------------------------------
44 #endif // SLACCELSTRUCT_H
float SLfloat
Definition: SL.h:173
unsigned int SLuint
Definition: SL.h:171
bool SLbool
Definition: SL.h:175
SLAccelStruct is an abstract base class for acceleration structures.
Definition: SLAccelStruct.h:22
virtual void updateStats(SLNodeStats &stats)=0
SLuint _voxelCntEmpty
NO. of empty voxels.
Definition: SLAccelStruct.h:39
virtual ~SLAccelStruct()
Definition: SLAccelStruct.h:25
SLMesh * _m
Pointer to the mesh.
Definition: SLAccelStruct.h:34
SLAccelStruct(SLMesh *m)
Definition: SLAccelStruct.h:24
SLVec3f _maxV
max. point of AABB
Definition: SLAccelStruct.h:36
SLfloat _voxelAvgTria
avg. no. of triangles per voxel
Definition: SLAccelStruct.h:41
virtual void build(SLVec3f minV, SLVec3f maxV)=0
virtual void draw(SLSceneView *sv)=0
virtual SLbool intersect(SLRay *ray, SLNode *node)=0
SLuint _voxelCnt
NO. of voxels in accelerator.
Definition: SLAccelStruct.h:38
SLuint _voxelMaxTria
max. no. of triangles pre voxel
Definition: SLAccelStruct.h:40
virtual void disposeBuffers()=0
SLVec3f _minV
min. point of AABB
Definition: SLAccelStruct.h:35
An SLMesh object is a triangulated mesh, drawn with one draw call.
Definition: SLMesh.h:134
SLNode represents a node in a hierarchical scene graph.
Definition: SLNode.h:147
Ray class with ray and intersection properties.
Definition: SLRay.h:40
SceneView class represents a dynamic real time 3D view onto the scene.
Definition: SLSceneView.h:69
Struct for scene graph statistics.
Definition: SLNode.h:37