Commit 52f7b36d authored by Emeric Verschuur's avatar Emeric Verschuur

YEAAAAAAAAAAHHHHHHHH ça compile :-)

parent 59b49075
......@@ -30,13 +30,13 @@ LrBinder::LrBinder(const LrBinder & source)
}
LrBinder::LrBinder(LISTE_OBJETS l)
: m_liste_objets(l)
LrBinder::LrBinder(const LrEntityList &entities)
: m_liste_objets(entities)
{
}
~LrBinder()
LrBinder::~LrBinder()
{
}
......
......@@ -32,11 +32,11 @@ class LrBinder
public :
LrBinder();
LrBinder(const LrBinder & source);
LrBinder(LrEntityList l);
LrBinder(const LrEntityList &entities);
virtual ~LrBinder() = 0;
virtual ~LrBinder();
void initBinder();//creation de la structure accélatrice type Grille reguliere
virtual bool getIntersection(LrRay &ray, LrHit & hit);
virtual bool getIntersection(LrRay &ray, LrHit & hit)=0;
};
#endif
......@@ -34,14 +34,14 @@ public:
/**
* @brief Destructeur.
*/
virtual ~LrEntity()=0;
virtual ~LrEntity();
/**
* @brief Donne d'intersection entre un rayon et l'objet.
* @param ray Référence d'un objet LrRay.
* @param hit Adresse de l'objet LrHit dans lequel sera stocké le résultat.
* @return vrai si il y a une intersection, sinon faux.
*/
virtual bool getIntersection(const LrRay &ray, LrHit *hit) const;
virtual bool getIntersection(const LrRay &ray, LrHit *hit) const=0;
private:
/// @brief Matrice de position.
LrMatrix m_mat;
......
......@@ -36,9 +36,9 @@ bool LrGeometrySphere::getIntersection(const LrRay &ray, LrHit *hit) const
Real vx=ray.getDirection().x;
Real vy=ray.getDirection().y;
Real vz=ray.getDirection().z;
Real ox=ray.getOrigin().getX();
Real oy=ray.getOrigin().getY();
Real oz=ray.getOrigin().getZ();
Real ox=ray.getOrigin().x;
Real oy=ray.getOrigin().y;
Real oz=ray.getOrigin().z;
a=pow(vx,2)+pow(vy,2)+pow(vz,2);
b=2*(ox*vx+oy*vy+oz*vz);
c=(pow(ox,2)+pow(oy,2)+pow(oz,2))-pow(m_r.getNorme(),2);
......
......@@ -212,8 +212,8 @@ void LrImage::savePPM(FILE* file) const {
for(int l=0;l<m_nbLine;l++) {
for(int c=0;c<m_nbColumn;c++) {
fprintf(file, "%d %d %d ", m_screen[l][c].getRedRGB(),
m_screen[l][c].getGreenRGB(), m_screen[l][c].getBlueRGB());
/* fprintf(file, "%d %d %d ", m_screen[l][c].getRedRGB(),
m_screen[l][c].getGreenRGB(), m_screen[l][c].getBlueRGB()); */
}
}
......
......@@ -176,17 +176,20 @@ LrOctree::setTaille(const Real &taille)
m_taille = taille;
}
const LrOctree* LrOctree::getOctree(int index) const
const LrOctree* LrOctree::getOctree(unsigned int index) const
{
if(index < 8)
{
LrOctreeList::iterator it = ((LrOctree *)this)->m_listeOct.begin();
int i = 0;
unsigned int i = 0;
while(i !=index) it++;
return *it;
}
else
{
return NULL;
}
}
void LrOctree::addOctree(LrOctree *oct)
......@@ -199,13 +202,17 @@ void LrOctree::addObjet (LrEntity *obj)
m_listeObj.push_back(obj);
}
LrEntity* LrOctree::getObject(int index) const
LrEntity* LrOctree::getObject(unsigned int index) const
{
if(index < m_listeObj.size())
{
LrEntityList::iterator it = ((LrOctree *)this)->m_listeObj.begin();
int i = 0;
unsigned int i = 0;
while(i !=index) it++;
return *it;
}
else
{
return NULL;
}
}
......@@ -32,7 +32,7 @@ class LrOctree
LrVector m_pos;
Real m_taille;
LrEntityList m_listeObj;
LrEntityList m_listeOct;
LrOctreeList m_listeOct;
public:
// constructors and destructor
......@@ -68,11 +68,11 @@ class LrOctree
Real getTaille() const;
void setTaille(const Real &taille);
const LrOctree* getOctree(int index) const;
const LrOctree* getOctree(unsigned int index) const;
void addOctree(LrOctree *oct);
void addObjet (LrEntity *obj);
LrEntity* getObject(int index) const;
LrEntity* getObject(unsigned int index) const;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment