3. Processing


 BEFORE:

void setup() 
{
  size(640, 360, P3D);
  noStroke();
  fill(204);
}

void draw() 
{
  background(0);
  lights();
  if(mousePressed) {
    float fov = PI/3.0; 
    float cameraZ = (height/2.0) / tan(PI * fov / 360.0); 
    perspective(fov, float(width)/float(height), 
                cameraZ/2.0, cameraZ*2.0); 
  } else {
    ortho(-width/2, width/2, -height/2, height/2, -10, 10); 
  }
  
  translate(width/2, height/2, 0);
  rotateX(-PI/6); 
  rotateY(PI/3); 
  box(160); 
}



 AFTER:

void setup() 
{
  size(640, 360, P3D);
  noStroke ();
}

void draw() 

{
  background(124);
  lights();
   rect(17, 17, 66, 66);
   fill(244, 45, 226);
  if(mousePressed) {
    float fov = -PI/3.0; 
    float cameraZ = (height/2.0) / tan(PI * fov / 360.0); 
    perspective(fov, float(width)/float(height), 
                cameraZ/2.0, cameraZ*2.0); 
  } else {
    ortho(-width/6, width/2, -height/8, height/4, -10, 10); 
  }
  
  translate(width/2, height/3, 2);
  rotateX(PI/6); 
  rotateY(PI/3); 
  box(200); 
}

No hay comentarios:

Publicar un comentario