Commit 46bee727 authored by Priyanka's avatar Priyanka
Browse files

Update index.html

parent 27e51534
Pipeline #7615 passed with stage
in 4 seconds
<!DOCTYPE html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="UTF-8">
<meta name="generator" content="GitLab Pages"> <meta name="viewport"
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Cube Demo</title> <title>Cube Demo</title>
<!-- 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>
</head>
<body>
<!-- Starting an immersive WebXR session requires user interaction.
We start this one with a simple button. -->
<button onclick="activateXR()">Start Cube Demo</button>
<script>
async function activateXR() {
// Add a canvas element and initialize a WebGL context that is compatible with WebXR.
const canvas = document.createElement("canvas");
document.body.appendChild(canvas);
const gl = canvas.getContext("webgl", {xrCompatible: true});
</head>
<body>
<!-- Starting an immersive WebXR session requires user interaction.
We start this one with a simple button. -->
<button onclick="activateXR()">Start Cube Demo</button>
<script>
async function activateXR() {
// Add a canvas element and initialize a WebGL context that is compatible with WebXR.
const scene = new THREE.Scene(); const scene = new THREE.Scene();
// The cube will have a different color on each side. // The cube will have a different color on each side.
...@@ -33,8 +34,8 @@ const materials = [ ...@@ -33,8 +34,8 @@ const materials = [
]; ];
// Create the cube and add it to the demo scene. // Create the cube and add it to the demo scene.
const cube = new THREE.Mesh(new THREE.BoxBufferGeometry(0.2, 0.2, 0.2), materials); const cube = new THREE.Mesh(new THREE.BoxBufferGeometry(0.5, 0.5, 0.5), materials);
cube.position.set(1, 1, 1); cube.position.set(0, 0, -1);
scene.add(cube); scene.add(cube);
// Set up the WebGLRenderer, which handles rendering to the session's base layer. // Set up the WebGLRenderer, which handles rendering to the session's base layer.
...@@ -91,8 +92,7 @@ const onXRFrame = (time, frame) => { ...@@ -91,8 +92,7 @@ const onXRFrame = (time, frame) => {
} }
session.requestAnimationFrame(onXRFrame); session.requestAnimationFrame(onXRFrame);
// To be continued in upcoming steps. }
} </script>
</script> </body>
</body> </html>
</html>
Supports Markdown
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