diff --git a/MEHIAOUI/checklistProjet.md b/MEHIAOUI/checklistProjet.md index 419e97efb889b26279046e77336cc3f6c6951ad1..44d78cbdc207c967015eca5f7994cb67061b269f 100644 --- a/MEHIAOUI/checklistProjet.md +++ b/MEHIAOUI/checklistProjet.md @@ -5,10 +5,10 @@ - [X] Géométrie - [X] Couleur - [X] Transparence -- [ ] Eclairage +- [X] Eclairage - [ ] Ombres portées - [X] Position de la caméra -- [ ] Brouillard +- [X] Brouillard - [ ] Effet miroir - [X] Texture classique - [ ] Texture avec transparence diff --git a/MEHIAOUI/projet.js b/MEHIAOUI/projet.js index 1e96966382184b951dccaf34759e52e44321dfc9..2d3d07f46f50700c8e177a4e3485703d1f7311dc 100644 --- a/MEHIAOUI/projet.js +++ b/MEHIAOUI/projet.js @@ -37,8 +37,8 @@ function fillScene() { window.scene.add(light2); // SpotLight pour éclairer la table, le bol et le vase - var spotLight = new THREE.SpotLight(0xFFFFFF, 8000); - spotLight.position.set(0, 50, 50); + var spotLight = new THREE.SpotLight(0xFFFFFF, 20000); + spotLight.position.set(-50, 30, 30); spotLight.angle = Math.PI / 6; spotLight.penumbra = 0.5; spotLight.decay = 2; @@ -164,6 +164,51 @@ function fillScene() { lathe.scale.set(0.3, 0.3, 0.3); lathe.position.set(5, 5.25, 1); + + // la tige de fleur sortant du vase et courbée + var curve = new THREE.CatmullRomCurve3([ + new THREE.Vector3(5, 5.25, 1), + new THREE.Vector3(5, 7, 1), + new THREE.Vector3(5, 9, 1.5), + new THREE.Vector3(5, 11, 2), + new THREE.Vector3(5, 13, 2.5), + new THREE.Vector3(5, 15, 3) + ]); + + var stemGeometry = new THREE.TubeGeometry(curve, 64, 0.1, 8, false); + var stemMaterial = new THREE.MeshPhongMaterial({ color: 0x228B22 }); + var stem = new THREE.Mesh(stemGeometry, stemMaterial); + + //centre de la fleur + var centerGeometry = new THREE.SphereGeometry(0.3, 32, 32); + var centerMaterial = new THREE.MeshPhongMaterial({ color: 0xFFFF00 }); + var center = new THREE.Mesh(centerGeometry, centerMaterial); + center.position.set(5, 15, 3); + + // Create the flower petals + var petalTexture = new THREE.TextureLoader().load('textures/texture_flower.png'); // Load your petal texture + var petalGeometry = new THREE.PlaneGeometry(1, 2); + var petalMaterial = new THREE.MeshPhongMaterial({ map: petalTexture, side: THREE.DoubleSide, transparent: true }); + + var petals = []; + for (let i = 0; i < 8; i++) { + var petal = new THREE.Mesh(petalGeometry, petalMaterial); + petal.position.set(5, 15, 3); + petal.rotation.set(0, 0, (i * Math.PI) / 4); + petal.translateY(1); + petals.push(petal); + } + + + // Group the flower parts + var flower = new THREE.Group(); + flower.add(stem); + flower.add(center); + petals.forEach(petal => flower.add(petal)); + + // Add the flower to the scene + window.scene.add(flower); + //Mur derrière la table @@ -193,9 +238,6 @@ function fillScene() { Coordinates.drawGround({size:10000}); // width and height of ground plane - - const cameraHelper = new THREE.CameraHelper(light.shadow.camera); - window.scene.add(cameraHelper); } function init() { diff --git a/MEHIAOUI/textures/texture_flower.png b/MEHIAOUI/textures/texture_flower.png new file mode 100644 index 0000000000000000000000000000000000000000..3ed0e3b43e2f6c054c33943970cf7698a8cb9919 Binary files /dev/null and b/MEHIAOUI/textures/texture_flower.png differ