Commit 50407ffb authored by MARTIN Tanguy's avatar MARTIN Tanguy
Browse files

Update picture.js

parent 0eb17c90
Pipeline #5201 passed with stage
in 13 seconds
"use strict";
function initPicture() {
// characters[0] = new Character('characters/ray.png',-65,115,-170);
// characters[1] = new Character('characters/emma.png',0,115,-170);
// characters[2] = new Character('characters/norman.png',72,115,-170);
characters[0] = new MainCharacter('openBook','characters/trio_front_open_book.png','characters/trio_back_open_book.png','characters/trio_front_close_book.png','characters/trio_back_close_book.png',0,115,30);
characters[1] = new InteractiveStringCharacter('littleBernie',littleBerniesSpritesFront,littleBerniesSpritesBack,0,115,-70);
characters[2] = new Character('characters/group2_front.png','characters/group2_back.png',0,115,-70);
......@@ -12,7 +9,6 @@ function initPicture() {
}
function drawGousset() {
//var gousset = new THREE.Object3D();
var main = new THREE.CylinderGeometry(180,180,32,32);
main.rotateX(Math.PI/2);
var materialMain = new THREE.MeshPhongMaterial( { color: 'gold', wireframe: false, flatShading: false, shininess: 30 } );
......@@ -21,15 +17,6 @@ function drawGousset() {
meshMain.position.y = 175;
meshMain.position.z = 100;
return (meshMain);
/*gousset.add(meshMain);
var haut = new THREE.CylinderGeometry(10,10,32,32);
var materialBase = new THREE.MeshLambertMaterial( { color: 0xaaaa99, wireframe: false } );
var meshBase = new THREE.Mesh(base,materialBase);
meshBase.position.x = 0;
meshBase.position.y = 70;
meshBase.position.z = -120;
gousset.add(meshBase);
scene.add(gousset);*/
}
......@@ -48,7 +35,6 @@ function drawLamp() {
});
var lance = new THREE.Mesh(lanceGeometry, lanceMaterial);
// lance.position.x = -1;
lance.position.y = 43;
lance.receiveShadow = true;
lance.castShadow = true;
......@@ -56,18 +42,13 @@ function drawLamp() {
grp.add(lance);
var gltfLoader = new THREE.GLTFLoader();
// Load a glTF resource
gltfLoader.load(
// resource URL
'objs/lamp_bis/scene.gltf',
// called when the resource is loaded
function ( gltf ) {
gltf.scene.traverse(
function(child) {
if(child instanceof THREE.Mesh && child.material.name === 'Fire.001') {
// console.log('Fire found');
// update fire intensity
child.material = fireMaterial;
}
else if(child instanceof THREE.Mesh && child.material.name !== 'Bulb.003') {
......@@ -210,13 +191,6 @@ function drawFourchette() {
0, 0, 2, 0,
0, 0, 0, 1
);
// var translateMatrix = new THREE.Matrix4();
// translateMatrix.set(
// 1, 0, 0, fourchetteX,
// 0, 1, 0, fourchetteY,
// 0, 0, 1, fourchetteZ,
// 0, 0, 0, 1
// );
OBJLoader.load(
'objs/fork.obj',
......@@ -224,23 +198,16 @@ function drawFourchette() {
object.traverse(
function(child) {
if(child instanceof THREE.Mesh) {
// console.log('coucou');
// console.log(child);
child.material = couvertsMaterial;
child.applyMatrix4(scalingMatrix);
child.castShadow = true;
child.receiveShadow = true;
// child.rotateZ(fourchetteAngleY*THREE.MathUtils.DEG2RAD);
// child.rotateY(fourchetteAngleZ*THREE.MathUtils.DEG2RAD);
// child.rotateX(fourchetteAngleX*THREE.MathUtils.DEG2RAD);
ret.add(child.clone());
}
}
);
}
);
// ret.applyMatrix4(translateMatrix);
return ret;
......@@ -263,10 +230,7 @@ function drawCouteau() {
object.traverse(
function(child) {
if(child instanceof THREE.Mesh) {
// console.log('hello');
child.applyMatrix4(transfromMatrix);
// child.rotateY(-Math.PI/4);
// child.rotateX(couteauAngleX*THREE.MathUtils.DEG2RAD);
child.material = couvertsMaterial;
child.castShadow = true;
child.receiveShadow = true;
......@@ -277,20 +241,14 @@ function drawCouteau() {
}
);
// ret.applyMatrix4(transfromMatrix);
// ret.rotateY(-Math.PI/4);
// ret.rotateX(couteauAngleX*THREE.MathUtils.DEG2RAD);
return ret;
}
function drawPicture() {
var ret = new THREE.Group();
var e = drawGround();
ret.add(e);
e = drawGousset();
ret.add(e);
ret.add(drawGround());
ret.add(drawGousset());
assiettes = drawAssiettes();
for(var i = 0; i < assiettes.length; i++) {
ret.add(assiettes[i]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment