Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alfakhori
ar
Commits
3674c50e
Commit
3674c50e
authored
1 year ago
by
Alfakhori
Browse files
Options
Download
Email Patches
Plain Diff
Update public/webXR.html
parent
1c1a7e78
Pipeline
#7391
passed with stage
in 8 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/webXR.html
+8
-19
public/webXR.html
with
8 additions
and
19 deletions
+8
-19
public/webXR.html
+
8
-
19
View file @
3674c50e
...
...
@@ -4,7 +4,7 @@
<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>
Hello WebXR
!
</title>
<title>
Hello WebXR
2.0
</title>
<!-- three.js -->
<script
src=
"https://unpkg.com/three@0.126.0/build/three.js"
></script>
...
...
@@ -21,7 +21,11 @@ async function activateXR() {
document
.
body
.
appendChild
(
canvas
);
const
gl
=
canvas
.
getContext
(
"
webgl
"
,
{
xrCompatible
:
true
});
const
scene
=
new
THREE
.
Scene
();
// To be continued in upcoming steps.
}
</script>
const scene = new THREE.Scene();
// The cube will have a different color on each side.
const materials = [
...
...
@@ -53,21 +57,6 @@ renderer.autoClear = false;
const camera = new THREE.PerspectiveCamera();
camera.matrixAutoUpdate = false;
// Set up the WebGLRenderer, which handles rendering to the session's base layer.
const
renderer
=
new
THREE
.
WebGLRenderer
({
alpha
:
true
,
preserveDrawingBuffer
:
true
,
canvas
:
canvas
,
context
:
gl
});
renderer
.
autoClear
=
false
;
// The API directly updates the camera matrices.
// Disable matrix auto updates so three.js doesn't attempt
// to handle the matrices independently.
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({
...
...
@@ -108,7 +97,7 @@ const onXRFrame = (time, frame) => {
session.requestAnimationFrame(onXRFrame);
}
</script>
</body>
</html>
This diff is collapsed.
Click to expand it.
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
Menu
Explore
Projects
Groups
Snippets