diff --git a/HERRY-M--HERRY-E/TABLO.js b/HERRY-M--HERRY-E/TABLO.js index bc14e90f4fc0928dde2a359d60e825cf46ca2777..cfb9842a422aef6588455c3bcbea52cf3d7cfbae 100644 --- a/HERRY-M--HERRY-E/TABLO.js +++ b/HERRY-M--HERRY-E/TABLO.js @@ -38,8 +38,7 @@ function init() { cameraControls = new OrbitControls(camera, renderer.domElement); cameraControls.target.set(5, 2.6, 0); - fillScene(); - animate(); + } function normalizeAndPosition(object, scaleFactor, position) { @@ -213,7 +212,21 @@ function CreationNappe() { function fillScene() { scene = new THREE.Scene(); - + function addSkybox() { + const loader = new THREE.CubeTextureLoader(); + loader.setPath('textures/'); + + const textureCube = loader.load([ + 'px.png', 'nx.png', + 'py.png', 'ny.png', + 'pz.png', 'nz.png' + ]); + + scene.background = textureCube; // Appliquer la skybox en arrière-plan + } + + // SKYBOX + //Brouillard scene.fog = new THREE.FogExp2(0xAAAAAA, 0.0025); @@ -442,12 +455,11 @@ loader6.load( scene.add(baton1); // Mettre à jour la CubeCamera à chaque frame pour les reflets dynamiques - function animate() { + function animate1() { requestAnimationFrame(animate); camera.update(renderer, scene); // Met à jour la réflexion à chaque frame - renderer.render(scene, camera); // Rendu de la scène } - animate(); + animate1(); // Assurez-vous que tous les objets sont visibles dans la réflexion scene.traverse(function (child) { @@ -521,6 +533,7 @@ loader6.load( CreationTable(); CreationNappe(); + addSkybox(); } @@ -546,6 +559,7 @@ function render() { try { init(); + fillScene(); animate(); } catch (e) { console.error("Your program encountered an unrecoverable error", e); diff --git a/HERRY-M--HERRY-E/textures/nx.png b/HERRY-M--HERRY-E/textures/nx.png new file mode 100644 index 0000000000000000000000000000000000000000..5015d3380431384ba026cafe04882230d0f55d58 Binary files /dev/null and b/HERRY-M--HERRY-E/textures/nx.png differ diff --git a/HERRY-M--HERRY-E/textures/ny.png b/HERRY-M--HERRY-E/textures/ny.png new file mode 100644 index 0000000000000000000000000000000000000000..ea4a58f5c2c7d8c812729ff5dca2736415f91800 Binary files /dev/null and b/HERRY-M--HERRY-E/textures/ny.png differ diff --git a/HERRY-M--HERRY-E/textures/nz.png b/HERRY-M--HERRY-E/textures/nz.png new file mode 100644 index 0000000000000000000000000000000000000000..6c5b9daef930d791dc1ebb9dcf9552bcf58f927e Binary files /dev/null and b/HERRY-M--HERRY-E/textures/nz.png differ diff --git a/HERRY-M--HERRY-E/textures/px.png b/HERRY-M--HERRY-E/textures/px.png new file mode 100644 index 0000000000000000000000000000000000000000..26fe98c939b117ea4715b8eb0bcd7ae0fc7a188f Binary files /dev/null and b/HERRY-M--HERRY-E/textures/px.png differ diff --git a/HERRY-M--HERRY-E/textures/py.png b/HERRY-M--HERRY-E/textures/py.png new file mode 100644 index 0000000000000000000000000000000000000000..8feb13557e5929c3d4360bbecb01b671022d4893 Binary files /dev/null and b/HERRY-M--HERRY-E/textures/py.png differ diff --git a/HERRY-M--HERRY-E/textures/pz.png b/HERRY-M--HERRY-E/textures/pz.png new file mode 100644 index 0000000000000000000000000000000000000000..6c5b9daef930d791dc1ebb9dcf9552bcf58f927e Binary files /dev/null and b/HERRY-M--HERRY-E/textures/pz.png differ