PImage limage=new PImage(); int w,h; float dEcranEye,dEcranCentre,distance; GrandCylindre grandCylindre; Vecteur X0= new Vecteur(1,0,0); Vecteur Y0= new Vecteur(0,1,0); Vecteur Z0= new Vecteur(0,0,1); Vecteur centre, eye; Trajectoire letrajet; boolean mreleased, mpressed; float tempo; //------------------------------------------------ //------------------------------------------------ //------------------------------------------------ void setup(){ size(1132,570, P3D); letrajet=new Trajectoire(); limage=loadImage("2face3.jpg"); w=limage.width; h= limage.height; dEcranEye=0.5*height/tan(PI/6); dEcranCentre=0; centre=new Vecteur(width/2.0,height/2.0,dEcranCentre); eye=new Vecteur(width/2.0,height/2.0,dEcranEye); distance=dEcranCentre+dEcranEye; grandCylindre=new GrandCylindre(); } //------------------------------------------------ void draw(){ tempo+=0.01; background(limage); lights(); directionalLight(150,200,255,10,1,1); directionalLight(255,255,255,0,0,-1); grandCylindre.dessiner(); } //++++++++++++++++++++++++++++++++++++++++++++++++++ // //++++++++++++++++++++++++++++++++++++++++++++++++++ void mousePressed(){ mpressed=true; grandCylindre.debutSelection(); } //++++++++++++++++++++++++++++++++++++++++++++++++++ // //++++++++++++++++++++++++++++++++++++++++++++++++++ void mouseReleased() { mreleased=true; mpressed=false; grandCylindre.finselection(); } //++++++++++++++++++++++++++++++++++++++++++++++++++ // //+++++++++++++++++++++++++++++++++++++++++ void mouseDragged(){ if(mreleased==true){ mreleased=false; } else{ if(mouseButton==RIGHT){ grandCylindre.bouger(); } if(mouseButton==LEFT){ grandCylindre.selectionner(); } } } //++++++++++++++++++++++++++++++++++++++++++++++++++ // //+++++++++++++++++++++++++++++++++++++++++ void repere(int lo,float e){ strokeWeight(e); stroke(255,0,0);line(0,0,0,lo,0,0); stroke(0,255,0);line(0,0,0,0,lo,0); stroke(0,0,255);line(0,0,0,0,0,lo); } //++++++++++++++++++++++++++++++++++++++++++++++++++ // //++++++++++++++++++++++++++++++++++++++++++++++++++ void imageReperee(){ float texx=grandCylindre.imageX; float texy=grandCylindre.imageY; beginShape(); fill(0); texture(limage); vertex(434,0,0,texx, texy); vertex(1000,0,0,texx+19, texy); vertex(1000, 755,0,texx+19, texy+28.5 ); vertex(434,755,0,texx, texy+28.5); endShape(); }