BImage acc; int nivmax; float xc, yc, zc,buta,angly; Decoupe limage; float tempo; boolean stop; void setup() { size(500, 500); xc= width/2.0f; yc=height/2.0f; zc=-400f; nivmax=5; stop=true;angly=0; background(90,40,65); acc= new BImage(); acc=loadImage("bb.jpg"); limage=new Decoupe(acc); } void loop() { //delay(30); clear(); translate(xc, yc, zc); buta=0.01f * (mouseX - width/2); angly+=0.1f*cos(buta); rotateY(angly); rotateZ(PI); if(!stop)tempo += 0.05; scale(1.2f); limage.dessiner(0,0,0); } void mousePressed(){stop=!stop; } //***************************************************************** class Decoupe{ BImage img; BImage[] quart; float diag; int w; public Decoupe(BImage img){ this.img=img; quart=new BImage[4]; w=img.width/2; diag=w*sqrt(0.5f); } public void dessiner(float x,float y,int niv){ noStroke();//stroke(155,130,50); float wn=w/pow(2,niv); float diagn=diag/pow(2,niv); fill(255,120); beginShape(QUADS); texture(acc); vertex(0,2*diagn,0, x, y ); vertex(2*diagn,0,0, x+2*wn, y ); vertex(0,-2*diagn,0, x+2*wn, y+2*wn ); vertex(-2*diagn,0,0, x, y+2*wn ); endShape(); fill(255); push(); translate(0,2*diagn,0); rotateX(-tempo); //line(-diagn,0,0,diagn,0,0); if(niv