16 #ifndef GRIDACCELERATOR_H
17 #define GRIDACCELERATOR_H
135 inline int offset(
int x,
int y,
int z)
const
Base class for accelerators.
Definition of a bounding box which is aligned along the axis (BBox AABB).
vec3 pMin
Lower point of the BBox.
Regular grid Accelerator.
int maxProfondeur
Maximal depth.
GridAccelerator(std::vector< Shape * > *_initialMesh=NULL, BBox _globalBox=BBox())
Constructor.
int offset(int x, int y, int z) const
int getMaxPrimPerLeaf()
Get maximal primitives per leaf.
void print()
Print (not implemented)
int realMaxProfondeur
Real maximal depth.
virtual decimal traverse(Ray *r, std::list< Intersection > &result) const
Run this accelerator.
std::vector< Shape * > primitives
Pointer to all the shapes (different from initialMesh) as it is reordered.
void setMaxPrimPerLeaf(int _maxPrimPerLeaf)
Set maximal primitives per leaf.
int posToVoxel(const vec3 &P, int axis) const
int maxPrimPerLeaf
Maximal primitives per leaf.
BBox globalBox
Root bounding box.
virtual bool build()
Build this accelerator.
float voxelToPos(int p, int axis) const
int getMaxProfondeur()
Get maximal depth.
virtual ~GridAccelerator()
Destructor.
void setMaxProfondeur(int _maxProfondeur)
Set maximal depth.
: Describes a ray by a pair of unsigned int. The first one gives the source number (in the range 0-40...
base class for shapes (Cylindre, Mesh, Sphere, Triangle,...)
float Clamp(float val, float low, float high)
base_vec3< decimal > vec3
std::vector< Shape * > primitives
Vector containing the primitives.
Voxel()
Default constructor.
void AddPrimitive(Shape *prim)
Voxel(Shape *op)
Constructor.
bool allCanIntersect
Flag not used.
bool Intersect(Ray *ray, std::list< Intersection > &result, decimal &intermin, leafTreatment::treatment choice)
size_t size() const
Get size.