xxxxxxxxxx
76
var cam;
let centralX = 0;
let centralY = 0;
let centralZ = 0;
let unit = 50;
let lightsOn = false;
let showAxis = false;
let takeCapture = false;
function setup(){
createCanvas(900, 900, WEBGL);
easycam = new Dw.EasyCam(this._renderer, {distance:1500, center:[centralX,centralY,centralZ]});
}
function draw(){
background(0);
if(showAxis){
fill(255,0,0);
box(1000,10,10);
fill(0,255,0);
box(10,1000,10);
fill(0,0,255);
box(10,10,1000);
}
if(lightsOn){
directionalLight(255,255,255,1,1,-1);
directionalLight(255,255,255,-1,1,-1);
directionalLight(255,255,255,-1,1,1);
}
let newNigiri;
newNigiri = new Nigiri();
for(let i =0; i<1; i++){
for(let j =0; j<1; j++){
push();
translate(j*500,0,i*300);
newNigiri.makeSalmonNigiri();
plate();
pop();
push();
translate(j*500,0,i*300+300);
newNigiri.makeEggNigiri();
plate();
pop();
push();
translate(j*500,0,i*300-300);
newNigiri.makeTunaNigiri();
plate();
pop();
}
}
if(takeCapture){
saveFrame("outputCapture/frame####.jpg"); // will save each frame\
takeCapture = false;
}
}
function plate(){
fill(255,0,0,200);
stroke(255);
box(600,50,500);
}
function keyPressed(){
if(key == 't'){
takeCapture = true;
}
}