diff --git a/ALVARIZA-BILLAR_DESERT_KANY/projet.js b/ALVARIZA-BILLAR_DESERT_KANY/projet.js index d62a6a97a4df29b6eac4b67cb01ea4ab20c8ac61..230fe6890bf10928ec7e207e86ed08e838dff3fb 100644 --- a/ALVARIZA-BILLAR_DESERT_KANY/projet.js +++ b/ALVARIZA-BILLAR_DESERT_KANY/projet.js @@ -41,8 +41,12 @@ function fillScene() { capsuleBeton(); dalleBeton(); poleAndFlag(); - house(); // TODO : à compléter + //house(); // TODO : à compléter + pompe(); forest(); + man(); + scene.fog = new THREE.Fog(0x999999, 10000, 20000); // Couleur grise, densité du brouillard + } /** @@ -255,6 +259,61 @@ function house() { scene.add(finalCubeMesh); } +/** + * Fonction qui gère les pompes a essences + */ +function pompe() { + const pompePositions = [ + { x: -2500, y: 0, z: 2000 }, + { x: -2800, y: 0, z: 650 }, + { x: -3000, y: 0, z: -700 } + ]; + + pompePositions.forEach(position => { + // Base de la pompe (rectangle rouge) + const baseGeometry = new THREE.BoxGeometry(300, 1000, 300); + const baseMaterial = new THREE.MeshLambertMaterial({ color: 0xff0000 }); + const base = new THREE.Mesh(baseGeometry, baseMaterial); + base.position.set(position.x, 500, position.z); + scene.add(base); + + // Partie métallique supérieure (détail en acier) + const metalGeometry = new THREE.BoxGeometry(320, 50, 320); + const metalMaterial = new THREE.MeshStandardMaterial({ color: 0xaaaaaa, metalness: 1, roughness: 0.3 }); + const metalTop = new THREE.Mesh(metalGeometry, metalMaterial); + metalTop.position.set(position.x, 1000, position.z); + scene.add(metalTop); + + // Sprite pour le logo + const textureLoader = new THREE.TextureLoader(); + const logoTexture = textureLoader.load('textures/logo.png'); + const spriteMaterial = new THREE.SpriteMaterial({ map: logoTexture }); + const sprite = new THREE.Sprite(spriteMaterial); + sprite.scale.set(300, 300, 0); + sprite.position.set(position.x, 1150, position.z + 20); + scene.add(sprite); + }); + man(); +} +/** + * Fonction qui affiche le chef au mileu des pompes a essences + */ +function man() { + const textureLoader = new THREE.TextureLoader(); + const manTexture = textureLoader.load('textures/man.png'); + const spriteMaterial = new THREE.SpriteMaterial({ map: manTexture }); + const sprite = new THREE.Sprite(spriteMaterial); + sprite.scale.set(600, 900, 0); + + + + sprite.position.set(-2600, 600, -200); // Position entre les pompes et légèrement devant + + scene.add(sprite); +} + + + /** * Fonction qui gère la forêt */ @@ -355,7 +414,7 @@ try { fillScene(); animate(); } catch (e) { - var errorReport = "Your program encountered an unrecoverable error, can not draw on canvas. Error was:<br/><br/>"; + var errorReport = "Error :<br/><br/>"; $('#webGL').append(errorReport + e); } diff --git a/ALVARIZA-BILLAR_DESERT_KANY/source.txt b/ALVARIZA-BILLAR_DESERT_KANY/source.txt index 7703df76b1a3ea84cd4790d5f163d1ed03607b1c..a822dad25455af75cb2b9d6a49dadf185756cd15 100644 --- a/ALVARIZA-BILLAR_DESERT_KANY/source.txt +++ b/ALVARIZA-BILLAR_DESERT_KANY/source.txt @@ -1 +1,3 @@ -Arbre poly : https://www.turbosquid.com/3d-models/3d-low-poly-trees-1431822 \ No newline at end of file +Arbre poly : https://www.turbosquid.com/3d-models/3d-low-poly-trees-1431822 +Formule 1 : https://free3d.com/3d-model/formula-1-lowpoly-87257.html +sign: https://www.pngegg.com/fr/png-ctuzm \ No newline at end of file diff --git a/ALVARIZA-BILLAR_DESERT_KANY/textures/logo.png b/ALVARIZA-BILLAR_DESERT_KANY/textures/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..1ccf16c1141e17c6b92f6661e1067d3872d62b52 Binary files /dev/null and b/ALVARIZA-BILLAR_DESERT_KANY/textures/logo.png differ diff --git a/ALVARIZA-BILLAR_DESERT_KANY/textures/man.png b/ALVARIZA-BILLAR_DESERT_KANY/textures/man.png new file mode 100644 index 0000000000000000000000000000000000000000..c962080e4e327335c6225ea53dd4cbd3b210a75e Binary files /dev/null and b/ALVARIZA-BILLAR_DESERT_KANY/textures/man.png differ diff --git a/ALVARIZA-BILLAR_DESERT_KANY/textures/sign.png b/ALVARIZA-BILLAR_DESERT_KANY/textures/sign.png new file mode 100644 index 0000000000000000000000000000000000000000..a843083b7cb651760ca33d5619c1872e9136b474 Binary files /dev/null and b/ALVARIZA-BILLAR_DESERT_KANY/textures/sign.png differ