From c53dd5042b1e3509b10245b8293d2c112d68990b Mon Sep 17 00:00:00 2001 From: MattheoCo <mattheocognet@gmail.com> Date: Thu, 13 Mar 2025 15:23:56 +0100 Subject: [PATCH] modification du .md de repartition --- "COGNET/R\303\251partition.md" | 3 +++ COGNET/main.js | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git "a/COGNET/R\303\251partition.md" "b/COGNET/R\303\251partition.md" index cd87cfd..697b0f1 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 38226ef..05e738e 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(); -- GitLab