Processing/3.ライブラリの利用

import camera3D.Camera3D;

Camera3D camera3D;

float th=0, z = -400;

void setup() {

 size(800, 800, P3D);
 camera3D = new Camera3D(this);
 camera3D.setBackgroundColor(color(192));
 camera3D.renderDefaultAnaglyph().setDivergence(1);

}

void preDraw() {

 z += 3;
 th += 0.1;
 if( z>400 ) z = -400;

}

void draw() {

 strokeWeight(8);
 stroke(0);
 fill(255, 255, 255);
 pushMatrix();
 translate(width/2, height/2, z);
 translate(-50, -50, 0 );
 pushMatrix();
 rotateY(th);
 box(50);
 popMatrix();
 translate(0, 100, 0 );
 pushMatrix();
 rotateY(th);
 box(50);
 popMatrix();
 translate(100, 0, 0 );
 pushMatrix();
 rotateY(th);
 box(50);
 popMatrix();
 translate(0, -100, 0 );
 pushMatrix();
 rotateY(th);
 box(50);
 popMatrix();
 popMatrix();

}


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS