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
GeoVistoogsi
AR
Commits
6043bb6e
Commit
6043bb6e
authored
6 months ago
by
Percen
Browse files
Options
Download
Email Patches
Plain Diff
Update public/index.html
parent
a455a0e8
master
21caog1bif-master-patch-76399
21caog1bif-master-patch-83779
21caog1bif-master-patch-96693
1 merge request
!6
Update public/index.html
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/index.html
+5
-2
public/index.html
with
5 additions
and
2 deletions
+5
-2
public/index.html
+
5
-
2
View file @
6043bb6e
...
@@ -34,9 +34,10 @@ const materials = [
...
@@ -34,9 +34,10 @@ 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.
const
renderer
=
new
THREE
.
WebGLRenderer
({
const
renderer
=
new
THREE
.
WebGLRenderer
({
alpha
:
true
,
alpha
:
true
,
...
@@ -51,6 +52,7 @@ renderer.autoClear = false;
...
@@ -51,6 +52,7 @@ renderer.autoClear = false;
// to handle the matrices independently.
// to handle the matrices independently.
const
camera
=
new
THREE
.
PerspectiveCamera
();
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
"
);
session
.
updateRenderState
({
session
.
updateRenderState
({
...
@@ -60,6 +62,7 @@ session.updateRenderState({
...
@@ -60,6 +62,7 @@ session.updateRenderState({
// 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.
const
referenceSpace
=
await
session
.
requestReferenceSpace
(
'
local
'
);
const
referenceSpace
=
await
session
.
requestReferenceSpace
(
'
local
'
);
// Create a render loop that allows us to draw on the AR view.
// Create a render loop that allows us to draw on the AR view.
const
onXRFrame
=
(
time
,
frame
)
=>
{
const
onXRFrame
=
(
time
,
frame
)
=>
{
// Queue up the next draw request.
// Queue up the next draw request.
...
...
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