Commit 15c4933a authored by Esguerra Montana's avatar Esguerra Montana
Browse files

Update index.html

parent 70e580db
Pipeline #9345 passed with stage
in 6 seconds
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
<!-- three.js --> <!-- three.js -->
<script src="https://unpkg.com/three@0.126.0/build/three.js"></script> <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> </head>
<body> <body>
...@@ -23,6 +25,11 @@ async function activateXR() { ...@@ -23,6 +25,11 @@ async function activateXR() {
const scene = new THREE.Scene(); 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. // The cube will have a different color on each side.
const materials = [ const materials = [
new THREE.MeshBasicMaterial({color: 0xff0000}), new THREE.MeshBasicMaterial({color: 0xff0000}),
...@@ -54,10 +61,7 @@ const camera = new THREE.PerspectiveCamera(); ...@@ -54,10 +61,7 @@ const camera = new THREE.PerspectiveCamera();
camera.matrixAutoUpdate = false; camera.matrixAutoUpdate = false;
// Initialize a WebXR session using "immersive-ar". // Initialize a WebXR session using "immersive-ar".
const session = await navigator.xr.requestSession("immersive-ar"); const session = await navigator.xr.requestSession("immersive-ar", {requiredFeatures: ['hit-test']});
session.updateRenderState({
baseLayer: new XRWebGLLayer(session, gl)
});
// A 'local' reference space has a native origin that is located // A 'local' reference space has a native origin that is located
// near the viewer's position at the time the session was created. // near the viewer's position at the time the session was created.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment