/* Auteur: Nicolas JANEY */ /* nicolas.janey@univ-fcomte.fr */ /* Octobre 2005 */ /* Classe de gestion de rayons lumineux */ #include #include #include #include "ModuleFleche.h" #include "Rayon.h" Rayon::Rayon(void) : Droite() { } Rayon::Rayon(float x,float y,float z, float dx,float dy,float dz) : Droite(x,y,z,dx,dy,dz) { this->d->normalise(); } Rayon::Rayon(Position *p,Direction *d) : Droite(p,d) { this->d->normalise(); } Rayon::~Rayon(void) { } void Rayon::dessine(void) { glPushMatrix(); glTranslatef(p->x,p->y,p->z); glutSolidSphere(0.1,36,36); flecheEnVolume(d->x,d->y,d->z,0.1F,0.4F,0.03F); glBegin(GL_LINES); glVertex3f(d->x*100.0F,d->y*100.0F,d->z*100.0F); glVertex3f(-d->x*100.0F,-d->y*100.0F,-d->z*100.0F); glEnd(); glPopMatrix(); } void Rayon::dessine(float *c) { int l = glIsEnabled(GL_LIGHTING); glPushAttrib(GL_ALL_ATTRIB_BITS); glPushMatrix(); glTranslatef(p->x,p->y,p->z); glEnable(GL_LIGHTING); glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,c); glutSolidSphere(0.1,36,36); flecheEnVolume(d->x,d->y,d->z,0.1F,0.4F,0.03F); glDisable(GL_LIGHTING); glColor3fv(c); glBegin(GL_LINES); glVertex3f(d->x*100.0F,d->y*100.0F,d->z*100.0F); glVertex3f(0.0F,0.0F,0.0F); glEnd(); glPopMatrix(); if ( l ) glEnable(GL_LIGHTING); else glDisable(GL_LIGHTING); glPopAttrib(); }