From 15c4933a4b136785743d83bf688ffa1c6cf5174d Mon Sep 17 00:00:00 2001 From: Esguerra Montana <32esla1mpg@hft-stuttgart.de> Date: Sun, 9 Jun 2024 16:52:26 +0000 Subject: [PATCH] Update index.html --- public/index.html | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/public/index.html b/public/index.html index c3759eb..87f482f 100644 --- a/public/index.html +++ b/public/index.html @@ -8,6 +8,8 @@ <!-- three.js --> <script src="https://unpkg.com/three@0.126.0/build/three.js"></script> + <script src="https://unpkg.com/three@0.126.0/examples/js/loaders/GLTFLoader.js"></script> + </head> <body> @@ -23,6 +25,11 @@ async function activateXR() { const scene = new THREE.Scene(); + const directionalLight = new THREE.DirectionalLight(0xffffff, 0.3); + directionalLight.position.set(10, 15, 10); + scene.add(directionalLight); + + // The cube will have a different color on each side. const materials = [ new THREE.MeshBasicMaterial({color: 0xff0000}), @@ -54,10 +61,7 @@ const camera = new THREE.PerspectiveCamera(); camera.matrixAutoUpdate = false; // Initialize a WebXR session using "immersive-ar". -const session = await navigator.xr.requestSession("immersive-ar"); -session.updateRenderState({ - baseLayer: new XRWebGLLayer(session, gl) -}); +const session = await navigator.xr.requestSession("immersive-ar", {requiredFeatures: ['hit-test']}); // A 'local' reference space has a native origin that is located // near the viewer's position at the time the session was created. -- GitLab