diff --git "a/COGNET/R\303\251partition.md" "b/COGNET/R\303\251partition.md" index cd87cfdc117909dd656b1e69dae14a50ecb998e8..697b0f190ab36f3b9376523483bd68c53c375d37 100644 --- "a/COGNET/R\303\251partition.md" +++ "b/COGNET/R\303\251partition.md" @@ -34,6 +34,9 @@ Ce projet est une scène 3D créée avec Three.js, présentant une nature morte ## Fonctionnalités editées par Matthéo Cognet +### Skybox +- Un skybox avec des textures pour le sol, les murs et le plafond. + ### Pièce - Une pièce avec des murs, un sol et un plafond. - Une fenêtre avec un cadre et une porte. diff --git a/COGNET/main.js b/COGNET/main.js index 38226ef0d2db714215853127db0b5f109b1011ec..05e738eaa5a54f8815fc08b2a60ed6fe1e144b14 100644 --- a/COGNET/main.js +++ b/COGNET/main.js @@ -1,6 +1,6 @@ import * as THREE from 'three'; -import { OrbitControls } from 'three/addons/controls/OrbitControls.js'; -import { OBJLoader } from 'three/addons/loaders/OBJLoader.js'; +import {OrbitControls} from 'three/addons/controls/OrbitControls.js'; +import {OBJLoader} from 'three/addons/loaders/OBJLoader.js'; // Initialisation de la scène, de la caméra et du rendu const scene = new THREE.Scene(); @@ -66,6 +66,9 @@ function init() { // Call the function to load the skull loadSkull(); + + // Add the skybox + addSkybox(); } function createRoom() { @@ -258,6 +261,17 @@ function loadSkull() { }); } +function addSkybox() { + const loader = new THREE.CubeTextureLoader(); + scene.background = loader.load([ + 'textures/skybox/bkg1_right.png', // Right + 'textures/skybox/bkg1_left.png', // Left + 'textures/skybox/bkg1_top.png', // Top + 'textures/skybox/bkg1_bot.png', // Bottom + 'textures/skybox/bkg1_front.png', // Front + 'textures/skybox/bkg1_back.png' // Back + ]); +} function loadBookStack() { const textureLoader = new THREE.TextureLoader();