16 #ifndef DEFAULT_ENGINE_H
17 #define DEFAULT_ENGINE_H
27 #ifdef TEST_ACCELERATION_RECEPTORS
36 :
Engine(_scene, _sources, _solver, _recepteurs)
68 std::list<Intersection> foundPrims;
71 accelerator->
traverse(r, foundPrims);
72 std::list<Intersection>::iterator iter;
75 for (iter = foundPrims.begin(); iter != foundPrims.end(); iter++)
88 Ray* valide_ray =
new Ray(r);
111 for (vector<Source>::iterator itsource =
sources->begin(); itsource !=
sources->end(); itsource++)
114 for (std::vector<Shape*>::iterator itrecp = tabReceptors->begin(); itrecp != tabReceptors->end();
122 vec3 psource = itsource->getPosition();
123 vec3 precp =
dynamic_cast<Sphere*
>((*itrecp))->getPosition();
124 vec3 direction = precp - psource;
125 direction.normalize();
129 if (itsource->getSampler()->isAcceptableSample(direction))
142 std::vector<Recepteur>* _recepteurs)
143 :
Engine(_scene, _sources, _solver, _recepteurs)
166 for (
unsigned int i = 0; i <
recepteurs->size(); i++)
174 Ray* valide_ray =
new Ray(r);
195 for (vector<Source>::iterator itsource =
sources->begin(); itsource !=
sources->end(); itsource++)
203 new_ray->
source = (&(*itsource));
204 new_ray->
position = itsource->getPosition();
205 vec3 psource = itsource->getPosition();
206 vec3 precp = itrecp->getPosition();
210 new_ray->
maxt = 10000.;
211 if (itsource->getSampler()->isAcceptableSample(direction))
232 r->
getEvents()->back()->getResponse(response);
Base class for accelerators.
virtual decimal traverse(Ray *r, std::list< Intersection > &result) const
Run this accelerator.
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...
virtual ~DefaultEngine()
Destructor.
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.
DefaultEngine(Scene *_scene, std::vector< Source > *_sources, Solver *_solver, Scene *_recepteurs)
virtual bool traitementRay(Ray *r, std::list< validRay > &result)
Ray treatment method.
DefaultEngine(const DefaultEngine &other)
Copy constructor.
virtual void runStructureBenchmark()
If implemented, run a benchmark for the engine.
Ray * genRay()
Create rays from the sources.
DefaultEngine()
Constructors.
Base class for engines (DefaultEngine, ParallelDefaultEngine,...)
Scene * recepteurs
Pointer to all 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 direction
Direction vector for the ray at the source.
void setFinalPosition(vec3 _finalPosition)
set the ending point of the ray
void setRecepteur(void *_recepteur)
set the pointer to the receptor of the ray
Source * source
Pointer to the source of the ray.
vec3 getPosition() const
Return 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
unsigned long long int constructId
Ray id.
void setMint(decimal _mint)
set the Mint
vec3 position
Starting point ray.
void setConstructId(unsigned long long int _constructId)
set the ray id
void computeLongueur()
Compute the distance traveled (length) by the ray and the result is set into the longueur attribute.
std::vector< boost::shared_ptr< Event > > * getEvents()
Return the events array encountered by the ray.
Receptor inherits from a Sphere Shape.
bool intersectionRecepteur(vec3 &origine, vec3 &directeur, float tmax, Intersection &result)
Get the Intersection between a ray and this shape.
This class mainly define a mesh (list of Shape) used by the Simulation object.
std::vector< Shape * > * getShapes()
Return all the shapes.
Accelerator * getAccelerator() const
Get the accelerator.
The Solver class gives an interface to the developer to add easily a new acoustic method using ray tr...
virtual bool valideRayon(Ray *r)
Ray validation. The developer may, for instance, choose a filtering on the rays and only validate sin...
base_vec3< decimal > vec3