From 86ad8f5d0257a44b78a5a59b35512d3bc5d4e488 Mon Sep 17 00:00:00 2001 From: Rafiei <32rafa1mpg@hft-stuttgart.de> Date: Mon, 17 Jun 2024 20:15:23 +0000 Subject: [PATCH] Update index.html --- public/index.html | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/public/index.html b/public/index.html index b5f185f..559cab0 100644 --- a/public/index.html +++ b/public/index.html @@ -23,19 +23,24 @@ async function activateXR() { const scene = new THREE.Scene(); -// The cube will have a different color on each side. -const materials = [ - new THREE.MeshBasicMaterial({color: 0xff0000}), - new THREE.MeshBasicMaterial({color: 0x0000ff}), - new THREE.MeshBasicMaterial({color: 0x00ff00}), - new THREE.MeshBasicMaterial({color: 0xff00ff}), - new THREE.MeshBasicMaterial({color: 0x00ffff}), - new THREE.MeshBasicMaterial({color: 0xffff00}) -]; + + +// Enable shadows in the renderer. +renderer.shadowMap.enabled = true; // Create the cube and add it to the demo scene. -const cube = new THREE.Mesh(new THREE.BoxBufferGeometry(0.5, 0.5, 0.5), materials); +const cubeGeometry = new THREE.BoxBufferGeometry(0.5, 0.5, 0.5); +const cubeMaterials = [ + new THREE.MeshLambertMaterial({ color: 0xff0000 }), // Red + new THREE.MeshLambertMaterial({ color: 0x0000ff }), // Blue + new THREE.MeshLambertMaterial({ color: 0x00ff00 }), // Green + new THREE.MeshLambertMaterial({ color: 0xff00ff }), // Magenta + new THREE.MeshLambertMaterial({ color: 0x00ffff }), // Cyan + new THREE.MeshLambertMaterial({ color: 0xffff00 }) // Yellow +]; +const cube = new THREE.Mesh(cubeGeometry, cubeMaterials); cube.position.set(0, 0, -1); +cube.castShadow = true; // Enable shadow casting scene.add(cube); -- GitLab