Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GeoVistoogsi
AR
Commits
e7e9e2c9
Commit
e7e9e2c9
authored
Dec 09, 2024
by
Percen
Browse files
Update public/index.html
parent
e750e982
Changes
1
Hide whitespace changes
Inline
Side-by-side
public/index.html
View file @
e7e9e2c9
...
...
@@ -14,8 +14,6 @@
<button
id=
"startButton"
onclick=
"activateXR()"
>
Start city planning
</button>
<script>
let
minimapRenderer
,
minimapCamera
,
minimapTexture
,
minimapMesh
;
async
function
activateXR
()
{
document
.
getElementById
(
"
startButton
"
).
style
.
display
=
"
none
"
;
// Start-Button verstecken
...
...
@@ -70,10 +68,6 @@ async function activateXR() {
}
});
// Minimap-Integration
setupMinimap
(
scene
);
// Renderloop
const
onXRFrame
=
(
time
,
frame
)
=>
{
session
.
requestAnimationFrame
(
onXRFrame
);
...
...
@@ -97,43 +91,11 @@ async function activateXR() {
reticle
.
updateMatrixWorld
(
true
);
}
updateMinimap
(
scene
);
renderer
.
render
(
scene
,
camera
);
}
};
session
.
requestAnimationFrame
(
onXRFrame
);
}
function
setupMinimap
(
scene
)
{
const
minimapSize
=
5
;
// Minimap-Kamera (orthographische Kamera für Draufsicht)
minimapCamera
=
new
THREE
.
OrthographicCamera
(
-
minimapSize
,
minimapSize
,
minimapSize
,
-
minimapSize
,
0.1
,
100
);
minimapCamera
.
position
.
set
(
0
,
10
,
0
);
minimapCamera
.
lookAt
(
0
,
0
,
0
);
// Minimap-Renderer und Textur
minimapRenderer
=
new
THREE
.
WebGLRenderer
({
alpha
:
true
});
minimapRenderer
.
setSize
(
256
,
256
);
// Kleine Auflösung für die Minimap
minimapTexture
=
new
THREE
.
CanvasTexture
(
minimapRenderer
.
domElement
);
// Erstelle eine Ebene für die Minimap
const
geometry
=
new
THREE
.
PlaneGeometry
(
0.3
,
0.3
);
// Größe der Minimap in der AR-Welt
const
material
=
new
THREE
.
MeshBasicMaterial
({
map
:
minimapTexture
,
transparent
:
true
});
minimapMesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
minimapMesh
.
position
.
set
(
0
,
-
0.5
,
-
1
);
// Unterhalb des Sichtfeldes
scene
.
add
(
minimapMesh
);
}
function
updateMinimap
(
scene
)
{
// Render die Minimap-Ansicht
minimapRenderer
.
render
(
scene
,
minimapCamera
);
// Aktualisiere die Textur der Minimap in der AR-Welt
minimapTexture
.
needsUpdate
=
true
;
}
</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