21 #include "Geometry/mathlib.h"
63 std::size_t max_size(0);
100 std::list<validRay> result;
106 for (std::list<validRay>::iterator it = result.begin(); it != result.end(); it++)
108 bool currentValid = it->valid;
109 Ray* currentValidRay = it->r;
135 for (
unsigned int i = 0; i <
sources->size(); i++)
137 if (
sources->at(i).getNbRayLeft() > 0)
146 sources->at(i).getDirection(direction);
178 std::list<Intersection> foundPrims;
181 tmin = accelerator->
traverse(r, foundPrims);
189 if (foundPrims.size() == 0)
194 resultRay.
valid =
false;
195 result.push_back(resultRay);
200 for (std::list<
Intersection, std::allocator<Intersection>>::iterator it = foundPrims.begin();
201 it != foundPrims.end(); it++)
206 Ray* current_ray = NULL;
208 if (next(it) != foundPrims.end())
211 current_ray =
new Ray(r);
228 resultRay.
r = current_ray;
229 resultRay.
valid = valide;
230 result.push_back(resultRay);
240 unsigned int nbVec = 1000000;
258 for (
unsigned int i = 0; i < nbVec; i++)
271 std::list<Intersection> foundPrims;
Base class for accelerators.
virtual decimal traverse(Ray *r, std::list< Intersection > &result) const
Run this accelerator.
Definition of a bounding box which is aligned along the axis (BBox AABB).
vec3 pMax
Upper point of the BBox.
vec3 pMin
Lower point of the BBox.
virtual bool process()
If implemented, process and return true if success.
std::stack< Ray *, std::deque< Ray * > > pile_traitement
Treatment stack containing the rays to treat.
void searchForReceptor(const decimal &tmin, Ray *r)
Search if a ray intersects a receptor before traveling a tmin distance (NB: this is the only place in...
void copyRayAndAddToStack(Ray *r)
Copy a ray and use its last event to generate a response to use as the copy's direction (used to hand...
unsigned long long int nbRayonsTraites
Treated rays number.
void initialReceptorTargeting()
Initialize the rays treatment stack by a loop on the receptors.
virtual bool traitementRay(Ray *r, std::list< validRay > &result)
Ray treatment method.
virtual void runStructureBenchmark()
If implemented, run a benchmark for the engine.
Ray * genRay()
Create rays from the sources.
Scene * scene
Pointer to the scene.
Solver * solver
Pointer to the solver.
unsigned long long int rayCounter
Ray counter.
std::vector< Source > * sources
Pointer to all the receptors.
: Describes a ray by a pair of unsigned int. The first one gives the source number (in the range 0-40...
void setDirection(vec3 _direction)
set the direction if the ray
void setPosition(vec3 _position)
set the starting point ray
vec3 getDirection() const
Return direction of the ray.
void setMaxt(decimal _maxt)
set the maxt
void setSource(Source *_source)
set the pointer to the source of the ray
void setMint(decimal _mint)
set the Mint
void setConstructId(unsigned long long int _constructId)
set the ray id
std::vector< boost::shared_ptr< Event > > * getEvents()
Return the events array encountered by the ray.
Accelerator * getAccelerator() const
Get the accelerator.
BBox getGlobalBox()
Return global bounding box.
virtual bool valideIntersection(Ray *r, Intersection *inter)
Validation function for an intersection. If the intersection is validated, an event is created and ad...
virtual bool invalidRayon(Ray *r)
Method to arrange the invalid rays. The invalid rays are put away into a debug_ray array in order to ...
virtual void finish()
End the operations.
base_vec3< decimal > vec3
bool valid
Boolean set to True if the ray is validated, which means an event occurs.
Ray * r
Pointer to a ray. Should not be NULL.