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
352d6d8b
Commit
352d6d8b
authored
1 year ago
by
Alfakhori
Browse files
Options
Download
Email Patches
Plain Diff
Update public/page1.html
parent
a1512cef
No related merge requests found
Pipeline
#7398
passed with stage
in 8 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/page1.html
+9
-9
public/page1.html
with
9 additions
and
9 deletions
+9
-9
public/page1.html
+
9
-
9
View file @
352d6d8b
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<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>
Hit
1
.0
</title>
<title>
Hit
2
.0
</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>
...
@@ -24,8 +24,7 @@ async function activateXR() {
...
@@ -24,8 +24,7 @@ async function activateXR() {
const
scene
=
new
THREE
.
Scene
();
const
scene
=
new
THREE
.
Scene
();
const
scene
=
new
THREE
.
Scene
();
// The cube will have a different color on each side.
const
directionalLight
=
new
THREE
.
DirectionalLight
(
0xffffff
,
0.3
);
const
directionalLight
=
new
THREE
.
DirectionalLight
(
0xffffff
,
0.3
);
directionalLight
.
position
.
set
(
10
,
15
,
10
);
directionalLight
.
position
.
set
(
10
,
15
,
10
);
scene
.
add
(
directionalLight
);
scene
.
add
(
directionalLight
);
...
@@ -100,17 +99,18 @@ const onXRFrame = (time, frame) => {
...
@@ -100,17 +99,18 @@ const onXRFrame = (time, frame) => {
renderer
.
setSize
(
viewport
.
width
,
viewport
.
height
)
renderer
.
setSize
(
viewport
.
width
,
viewport
.
height
)
// Use the view's transform matrix and projection matrix to configure the THREE.camera.
// Use the view's transform matrix and projection matrix to configure the THREE.camera.
camera
.
matrix
.
fromArray
(
view
.
transform
.
matrix
)
camera
.
projectionMatrix
.
fromArray
(
view
.
projectionMatrix
);
camera
.
projectionMatrix
.
fromArray
(
view
.
projectionMatrix
);
camera
.
updateMatrixWorld
(
true
);
camera
.
updateMatrixWorld
(
true
);
const
hitTestResults
=
frame
.
getHitTestResults
(
hitTestSource
);
const
hitTestResults
=
frame
.
getHitTestResults
(
hitTestSource
);
if
(
hitTestResults
.
length
>
0
&&
reticle
)
{
if
(
hitTestResults
.
length
>
0
&&
reticle
)
{
const
hitPose
=
hitTestResults
[
0
].
getPose
(
referenceSpace
);
const
hitPose
=
hitTestResults
[
0
].
getPose
(
referenceSpace
);
reticle
.
visible
=
true
;
reticle
.
visible
=
true
;
reticle
.
position
.
set
(
hitPose
.
transform
.
position
.
x
,
hitPose
.
transform
.
position
.
y
,
hitPose
.
transform
.
position
.
z
)
reticle
.
position
.
set
(
hitPose
.
transform
.
position
.
x
,
hitPose
.
transform
.
position
.
y
,
hitPose
.
transform
.
position
.
z
)
reticle
.
updateMatrixWorld
(
true
);
reticle
.
updateMatrixWorld
(
true
);
}
}
// Render the scene with THREE.WebGLRenderer.
// Render the scene with THREE.WebGLRenderer.
renderer
.
render
(
scene
,
camera
)
renderer
.
render
(
scene
,
camera
)
...
...
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