boolean isPerspective;
void setup(){
size(500, 500, P3D);
isPerspective = true;
fill(0, 255, 157);
stroke(128);
}
void draw(){
lights();
background(255, 228, 225);
if(isPerspective){
perspective();
} else {
ortho(-width / 2, width / 2, -height / 2, height / 2, 0, 1000);
}
for(int x = 0; x <= 10; x++){
for(int y = 0; y <= 10; y++){
for(int z = 0; z < 3; z++){
pushMatrix();
translate(width / 2 + (x - 5) * 40, height / 2 + (y - 5) * 40, -z * 200);
rotateX(-PI / 6);
rotateY(PI / 3);
box(20);
popMatrix();
}
}
}
}
void mousePressed(){
isPerspective = !isPerspective;
}