Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Esguerra Montana
Web AR
Commits
15c4933a
Commit
15c4933a
authored
Jun 09, 2024
by
Esguerra Montana
Browse files
Update index.html
parent
70e580db
Pipeline
#9345
passed with stage
in 6 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
public/index.html
View file @
15c4933a
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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