Commit 33a8ae00 authored by paps's avatar paps

--no commit message

--no commit message
parent dd9fdbec
/**
* @brief OBJET : represente un octree pour la structure acceleratrice
* @file LrOctree.h
* @file LrBinder.h
* @date Lundi 10 Mars 2008
* @note
* @author Josselin Francois
......@@ -19,19 +19,19 @@
#include "LrBinder.h"
LrBinder::LrBinder()
: m_liste_objets(), m_globalOctree(NULL)
: m_liste_objets()
{
}
LrBinder::LrBinder(const LrBinder & source)
: m_liste_objets(source.m_liste_objets), m_globalOctree(source.m_globalOctree)
: m_liste_objets(source.m_liste_objets)
{
}
LrBinder::LrBinder(LISTE_OBJETS l, LrVector pos_init, LrVector &taille)
: m_liste_objets(l), m_globalOctree(new LrOctree(NULL, pos_init, taille.getNorme()))
LrBinder::LrBinder(LISTE_OBJETS l)
: m_liste_objets(l)
{
}
......@@ -43,13 +43,6 @@ LrBinder::LrBinder(LISTE_OBJETS l, LrVector pos_init, LrVector &taille)
void LrBinder::initBinder()
{
}
void LrBinder::createSubdiv(LrOctree &oct, Real taille)
{
for(int i=0; i < 8; i++)
{
oct.addOctree(new LrOctree(*this,
}
}
/**
* @brief OBJET : represente la structure acceleratrice
* @file LrOctree.h
* @file LrBinder.h
* @date Lundi 10 Mars 2008
* @note
* @author Josselin Francois
......@@ -17,7 +17,7 @@
#include "LrOctree.h"
#include "LrVecteur.h"
#include "LrObject.h"
#include "LrEntity.h"
#define MAX_DIV 4
......@@ -25,19 +25,20 @@ class LrBinder
{
private :
LISTE_OBJETS m_liste_objets;//la liste d'objet
LrOctree *m_globalOctree; //un pointer sur la boite englobante principale
ListObject m_liste_objets;//la liste d'objet
public :
typedef list<LrObject *> LISTE_OBJETS;
typedef list<LrEntity *> ListObject;
LrBinder();
LrBinder(const LrBinder & source);
LrBinder(LISTE_OBJETS l, LrVector pos_init, LrVector &taille);
LrBinder(ListObject l);
virtual ~LrBinder();
virtual ~LrBinder() = 0;
void initBinder(int subdivision);//creation de la structure accélatrice type Grille reguliere
void initBinder();//creation de la structure accélatrice type Grille reguliere
virtual bool getIntersection(LrRay &ray, LrHit & hit);
};
#endif
\ No newline at end of file
/**
* @brief OBJET : represente la structure acceleratrice
* @file LrBinderOct.h
* @date Lundi 10 Mars 2008
* @note
* @author Josselin Francois
* @author Michael Nauge
* @author Axel Richard
* @author Hervé Souchaud
* @author Emeric Verschuur
*
* Ce fichier contient la classe qui gère la creation d'une structure acceleratrice pour la gestion des objets 3D
*/
#ifndef LRBINDEROCT_H
#define LRBINDEROCT_H
#include "LrBinder.h"
#include "LrVecteur.h"
class LrBinderOct : public LrBinder
{
private :
LrOctree *m_globalOctree; //un pointer sur la boite englobante principale
public :
LrBinderOct();
LrBinderOct(const LrBinderOct & source);
LrBinderOct(ListObject l, LrVector pos_init, LrVector &taille);
virtual ~LrBinderOct() = 0;
virtual void createSubdiv(LrOctree &oct, Real taille);
virtual bool getIntersection(LrRay &ray, LrHit & hit);
};
#endif
/**
* @brief OBJET : represente la structure acceleratrice type octree grille reguliere
* @file LrBinderOctR.h
* @date Lundi 10 Mars 2008
* @note
* @author Josselin Francois
* @author Michael Nauge
* @author Axel Richard
* @author Hervé Souchaud
* @author Emeric Verschuur
*
* Ce fichier contient la classe qui gère la creation de grille reguliere
*/
#ifndef LRBINDEROCTR_H
#define LRBINDEROCTR_H
#include "LrBinderOct.h"
class LrBinderOctR : public LrBinderOct
{
public :
};
#endif
......@@ -88,12 +88,14 @@ LrOctree::operator = (const LrOctree &source)
bool
operator == (const LrOctree &lhs, const LrOctree &rhs)
{
LrOctree &lhstemp=(LrOctree &)lhs, &rhstemp=(LrOctree &)rhs;
/*
bool res = ((*(lhs.m_parent)) == (*(rhs.m_parent))) && (lhs.m_pos == rhs.m_pos) && (lhs.m_taille == rhs.m_taille);
if((lhs.m_listeObj.size() != rhs.m_listeObj.size()) || (lhs.m_listeOct.size() != rhs.m_listeOct.size())) return false;
list<LrObject *>::iterator itObj_rhs = ((LrOctree &)rhs).m_listeObj.begin();
for(list<LrObject *>::iterator itObj_lhs = ((LrOctree &)lhs).m_listeObj.begin(); itObj_lhs != lhs.m_listeObj.end(); itObj_lhs++)
list<LrEntity *>::iterator itObj_rhs = ((LrOctree &)rhs).m_listeObj.begin();
for(list<LrEntity *>::iterator itObj_lhs = ((LrOctree &)lhs).m_listeObj.begin(); itObj_lhs != lhs.m_listeObj.end(); itObj_lhs++)
{
res = res && (*itObj_lhs == *itObj_rhs);
itObj_rhs++;
......@@ -102,6 +104,24 @@ operator == (const LrOctree &lhs, const LrOctree &rhs)
list<LrOctree *>::iterator itOct_rhs = ((LrOctree &)rhs).m_listeOct.begin();
list<LrOctree *>::iterator itOct_lhs;
for( itOct_lhs = ((LrOctree &)lhs).m_listeOct.begin(); itOct_lhs != lhs.m_listeOct.end(); itOct_lhs++)
{
res = res && (*itOct_lhs == *itOct_rhs);
itOct_rhs++;
}*/
bool res = ((*(lhs.m_parent)) == (*(rhs.m_parent))) && (lhs.m_pos == rhs.m_pos) && (lhs.m_taille == rhs.m_taille);
if((lhs.m_listeObj.size() != rhs.m_listeObj.size()) || (lhs.m_listeOct.size() != rhs.m_listeOct.size())) return false;
EntityList::iterator itObj_rhs = rhstemp.m_listeObj.begin();
for(EntityList::iterator itObj_lhs = lhstemp.m_listeObj.begin(); itObj_lhs != lhstemp.m_listeObj.end(); itObj_lhs++)
{
res = res && (*itObj_lhs == *itObj_rhs);
itObj_rhs++;
}
OctreeSonList::iterator itOct_rhs = rhstemp.m_listeOct.begin();
OctreeSonList::iterator itOct_lhs;
for( itOct_lhs = lhstemp.m_listeOct.begin(); itOct_lhs != lhstemp.m_listeOct.end(); itOct_lhs++)
{
res = res && (*itOct_lhs == *itOct_rhs);
itOct_rhs++;
......@@ -160,7 +180,7 @@ const LrOctree* LrOctree::getOctree(int index) const
{
if(index < 8)
{
list<LrOctree *>::iterator it = ((LrOctree *)this)->m_listeOct.begin();
OctreeSonList::iterator it = ((LrOctree *)this)->m_listeOct.begin();
int i = 0;
while(i !=index) it++;
......@@ -174,16 +194,16 @@ void LrOctree::addOctree(LrOctree *oct)
if(m_listeOct.size() != 8) m_listeOct.push_back(oct);
}
void LrOctree::addObjet (LrObject *obj)
void LrOctree::addObjet (LrEntity *obj)
{
m_listeObj.push_back(obj);
}
LrObject* LrOctree::getObject(int index) const
LrEntity* LrOctree::getObject(int index) const
{
if(index < m_listeObj.size())
{
list<LrObject *>::iterator it = ((LrOctree *)this)->m_listeObj.begin();
EntityList::iterator it = ((LrOctree *)this)->m_listeObj.begin();
int i = 0;
while(i !=index) it++;
return *it;
......
......@@ -17,10 +17,10 @@
#include <list>
#include "LrVector.h"
#include "LrObject.h"
#include "global.h"
#include "LrEntity.h"
using namespace std;
class LrOctree
{
......@@ -31,13 +31,13 @@ class LrOctree
const LrOctree *m_parent;
LrVector m_pos;
Real m_taille;
list<LrObject *> m_listeObj;
list<LrEntity *> m_listeObj;
list<LrOctree *> m_listeOct;
public:
typedef list<LrObject *> LISTE_OBJETS;
typedef list<LrOctree *> LISTE_OCTREES_SONS;
typedef std::list<LrEntity *> EntityList;
typedef std::list<LrOctree *> OctreeSonList;
// constructors and destructor
// ***************************
......@@ -74,8 +74,8 @@ class LrOctree
const LrOctree* getOctree(int index) const;
void addOctree(LrOctree *oct);
void addObjet (LrObject *obj);
LrObject* getObject(int index) const;
void addObjet (LrEntity *obj);
LrEntity* getObject(int index) const;
};
......
......@@ -17,6 +17,11 @@
#endif
#include "LrPoint.h"
const LrPoint LrPoint::ZERO (0.0,0.0,0.0);
const LrPoint LrPoint::I (1.0,0.0,0.0);
const LrPoint LrPoint::J (0.0,1.0,0.0);
const LrPoint LrPoint::K (0.0,0.0,1.0);
/*---------------------------------------------------------------------------*
* constructors and destructor *
*---------------------------------------------------------------------------*/
......
......@@ -11,6 +11,7 @@
*
* Ce fichier contient la classe qui gère la creation d'un vecteur 3D
*/
#include "config.h"
#include "LrVector.h"
......@@ -200,7 +201,7 @@ LrVector LrVector::multScalaire(float scalaire)
}
*/
//normaliser le vecteur ////////////////////////////////////////////////////////////////////////////////////////
void LrVector::normaliser()
void LrVector::normalize()
{
composantes[X] /= norme;
composantes[Y] /= norme;
......
......@@ -39,6 +39,7 @@ class LrVector
static const LrVector K;
>>>>>>> .r88
// CONSTRUCTEURS ///////////////////////////////////////////////////////////////////////////
//Constructeur par defaut
......@@ -82,7 +83,7 @@ class LrVector
LrVector multScalaire(Real scalaire);
//normaliser le vecteur
void normaliser();
void normalize();
LrVector & operator = (const LrVector &);
LrVector & operator += (const LrVector & source);
......
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