diff --git a/src/utils/addAssetsOnScene.js b/src/utils/addAssetsOnScene.js index 6879b13..b4c212a 100644 --- a/src/utils/addAssetsOnScene.js +++ b/src/utils/addAssetsOnScene.js @@ -444,6 +444,92 @@ export async function addAssetsOnScene(scene){ } + /* LANGUAGES & TECHNOLOGIES */ + const signCopy = sign.scene.clone(); + signCopy.position.x = -12; + signCopy.position.y = 10.7; + scene.add( signCopy ); + + const signPlaneMaterial = new THREE.MeshBasicMaterial({ map:textureLoader.load("src/objects/textures/known_technologies.png") }); + const signPlane = new THREE.Mesh(SignPlanegeometry, signPlaneMaterial); + signPlane.rotateOnWorldAxis(new THREE.Vector3(1,0,0), MathUtils.degToRad(90)); + signPlane.position.set( signCopy.position.x + 0.06, signCopy.position.y - 0.015, 1.65);// Determined by hand + scene.add(signPlane); + + //Zoom picture plate + addZoomPlate(-12, 9.5, "src/objects/textures/known_technologies.png"); + + /* -------------------- + FLOWERS GARDEN + -------------------- */ + //Loading flowers + const flowerModel = await loadModel('src/objects/models/flower.gltf'); + flowerModel.scene.scale.set(0.75,0.75,0.75); + flowerModel.scene.rotateOnWorldAxis(new THREE.Vector3(1,0,0), MathUtils.degToRad(90));//Must be standing up + alignGround(ground, flowerModel.scene); + + //Flower width : + const flowersHitbox = new THREE.Box3().setFromObject(flowerModel.scene); + const flowerWidth = flowersHitbox.max.y - flowersHitbox.min.y; + + const centralPoint = {x:-12, y:10};// Point used for central symetry with flowers + let flowers = [];// Will contain flowers. Used for the symetry + + const flowersPos = [ /*See below*/ ];//Like trees, a list of coords for flowers. That's only for the upper left corner, as we're using symetry for the other corners. + + /* Placing flowers in flowersPos to create a circle */ + + const radius = 2.5; // Circle radius + const numFlowers = 10; + + for (let i = 1; i < numFlowers; i++) { + const angle = (i / numFlowers) * (Math.PI / 2); // First quart of circle + + //Coords, polar to Cartesian + const x = centralPoint.x + radius * Math.cos(angle); + const y = centralPoint.y + radius * Math.sin(angle); + + flowersPos.push({ x, y }); + } + + /* End of placement */ + + for(let i = 0; i { - //Prepare models before placing them - item.scene.scale.set(0.1, 0.1, 0.1); - item.scene.rotateOnWorldAxis(new THREE.Vector3(1,0,0), MathUtils.degToRad(90)); - alignGround(ground, item.scene); - }); + for (let i = 0; i < grassModels.length; i++) { + + if (grassModels[i] === flowerModel) continue;// Flower model already prepared before + + // Prepare models before placing them + grassModels[i].scene.scale.set(0.1, 0.1, 0.1); + grassModels[i].scene.rotateOnWorldAxis(new THREE.Vector3(1, 0, 0), MathUtils.degToRad(90)); + alignGround(ground, grassModels[i].scene); + } function getRndInteger(min, max) { return Math.floor(Math.random() * (max - min) ) + min;