Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Priyanka
ARNishat
Commits
46bee727
Commit
46bee727
authored
Jun 01, 2023
by
Priyanka
Browse files
Update index.html
parent
27e51534
Pipeline
#7615
passed with stage
in 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
public/index.html
View file @
46bee727
<!
DOCTYPE
html>
<!
doctype
html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"generator"
content=
"GitLab Pages"
>
<meta
name=
"viewport"
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
>
<title>
Cube Demo
</title>
<!-- three.js -->
<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
();
// The cube will have a different color on each side.
...
...
@@ -33,8 +34,8 @@ const materials = [
];
// 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
);
cube
.
position
.
set
(
1
,
1
,
1
);
const
cube
=
new
THREE
.
Mesh
(
new
THREE
.
BoxBufferGeometry
(
0.
5
,
0.
5
,
0.
5
),
materials
);
cube
.
position
.
set
(
0
,
0
,
-
1
);
scene
.
add
(
cube
);
// Set up the WebGLRenderer, which handles rendering to the session's base layer.
...
...
@@ -91,8 +92,7 @@ const onXRFrame = (time, frame) => {
}
session
.
requestAnimationFrame
(
onXRFrame
);
// To be continued in upcoming steps.
}
</script>
</body>
</html>
}
</script>
</body>
</html>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment