//Code by Marex

let fenetre

let font;
fontsize = 90;

let angleRotate = 0.0;

let img;

function preload() {
  font = loadFont('police.ttf');
  fenetre = loadModel('fenetre3.obj', true);
}

function setup() {
  createCanvas(windowWidth,windowHeight,WEBGL);
  background(0);
  
  brique = loadImage('brique.jpg');
  Mug = loadImage('The MUG.jpg');
  bois = loadImage('bois.jpg');
  png = loadImage('png.png');
  jch = loadImage('jch.png');
  
  textFont(font);
  textSize(fontsize);
  
}

function draw() {
  
  //obj 3D
  
  push();
  translate(0,-150,-110);
  scale(2);
  fill(96,96,96)
  noStroke();
  model(fenetre);
  pop();
  
  
  
  //fenetre
  
  push();
  translate(80,-50,-115);
  noStroke();
  fill(0,204,204);
  plane(170);
  pop();
  
   push();
  translate(-80,-50,-115);
  noStroke();
  fill(0,204,204);
  plane(170);
  pop();
  
   push();
  translate(-80,-230,-115);
  noStroke();
  fill(0,204,204);
  plane(170);
  pop();
  
    push();
  translate(80,-230,-115);
  noStroke();
  fill(0,204,204);
  plane(170);
  pop();
  
      push();
  translate(130,-23,-113);
  noStroke();
  texture(jch);
  plane(145);
  pop();
  
  //Table
  
 push();
  noStroke();
  translate(0,425,100);
  texture(bois);
  box(500,0,5000);
 pop();
  
 push();
  noStroke();
  translate(500,425,100);
  texture(bois);
  box(500,0,5000);
 pop();
  
 push();
  noStroke();
  translate(-500,425,100);
  texture(bois);
  box(500,0,5000);
 pop();
  
  //Murs
  
 push();
  noStroke();
  translate(0,-400,-1500);
  texture(brique)
  plane(3000)
 pop();
  
    //Tasse
  
 push();
  translate(0,75,-100);
  noStroke();
  cylinder(100,150);
 pop();

 push();
  translate(100,75,-100);
  noStroke();
  torus(50);
 pop();
  
 push();
  translate(0,120,-100);
  noStroke();
  cylinder(90);
 pop();

 push();
  noStroke();
  translate(-100,-50,1);
  fill(102,51,0)
  ellipse(100,50,140,12);
 pop();
  
 push();
  noStroke();
  translate(-100,-55,0);
  fill(224,224,224)
  ellipse(100,55,170,25);
 pop();
  
 push();
  noStroke();
  translate(0,60,100)
  fill(0);
  texture(Mug);
  plane(100)
 pop();

  push();
  translate(-100,0,250);
  let angle1 = radians(-45);
  rotate(angle1);
  fill(204,204,0);
  text('Flush',-30,-50)
  pop();
  
  push();
  textSize(30);
  fill(0);
  translate(-400,300,0)
  text('Thanks to Vital Motion , Team Delta , Flush and',0,0);
  pop();
  
  push();
  textSize(90);
  fill(0);
  translate(40,300,0);
  text('Shadow Party',0,0);
  pop();
  
  push();
  translate(50,-200,0);
  let angle2 = radians(45);
  rotate(angle2);
  textSize(90);
  fill(204,0,0);
  text('Vital Motion',0,0)
  pop();
  
  push();
  translate(-200,-250,0);
  textSize(170);
  fill(0);
  text('The MUG',0,0);
  pop();
  
}