-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
186 lines (172 loc) · 5.05 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Demo: Cesium Threejs 3DGS</title>
<script src="https://cesium.com/downloads/cesiumjs/releases/1.121/Build/Cesium/Cesium.js" crossorigin></script>
<link href="https://cesium.com/downloads/cesiumjs/releases/1.121/Build/Cesium/Widgets/widgets.css" rel="stylesheet"
crossorigin>
<script src="https://sandcastle.cesium.com/Sandcastle-header.js"></script>
<style>
#cesiumContainer {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
padding: 0;
font-family: sans-serif;
}
#toolbar {
margin: 5px;
padding: 2px 5px;
position: absolute;
}
#threeContainer {
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
position: absolute;
pointer-events: none;
}
.cesium-viewer-bottom,
.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-fullscreenContainer
{
z-index: 100
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<div id="toolbar"></div>
<script type="module">
// Your access token can be found at: https://ion.cesium.com/tokens.
// Replace `your_access_token` with your Cesium ion access token.
// Cesium.Ion.defaultAccessToken = "%VITE_CESIUM_ACCESS_TOKEN%"
const viewer = new Cesium.Viewer('cesiumContainer', {
terrain: Cesium.Terrain.fromWorldTerrain(),
})
import CesiumThreejs3DGS from '/src/cesium-threejs-3dgs.ts'
const cesiumThreejs3DGS = new CesiumThreejs3DGS(viewer)
const options = [
{
text: "Naka Island",
onselect: async () => {
await cesiumThreejs3DGS.remove3dgsAll()
cesiumThreejs3DGS.load3dgs(
{
splatUrl: "./demo/nakajima.ksplat",
lat: 33.973,
lon: 132.63026,
height: 40,
headingPitchRoll: { heading: 37, pitch: 180, roll: 0 },
scale: 45,
camera: {
offset: { x: 150, y: -70, z: 30 },
headingPitchRoll: { heading: -20, pitch: -10, roll: 0 }
}
}
)
},
},
{
text: "F-4 Phantom",
onselect: async () => {
await cesiumThreejs3DGS.remove3dgsAll()
cesiumThreejs3DGS.load3dgs(
{
splatUrl: "./demo/phantom.ksplat",
lat: 36.17664577334638,
lon: 140.40685215446348,
height: 74.0,
headingPitchRoll: { heading: 65, pitch: 180, roll: 0 },
scale: 5,
camera: {
offset: { x: -5, y: 18, z: 0 },
headingPitchRoll: { heading: 240, pitch: 5, roll: 0 }
}
}
)
},
},
{
text: "Former Nara Prison",
onselect: async () => {
await cesiumThreejs3DGS.remove3dgsAll()
cesiumThreejs3DGS.load3dgs(
{
splatUrl: "./demo/former-nara-prison.ksplat",
lat: 34.69849,
lon: 135.83445,
height: 155.4,
headingPitchRoll: { heading: 175, pitch: 180, roll: 0 },
scale: 15,
camera: {
offset: { x: 30, y: 2, z: 3 },
headingPitchRoll: { heading: 80, pitch: -8, roll: 2 }
}
}
)
},
},
{
text: "Miyake Island",
onselect: async () => {
await cesiumThreejs3DGS.remove3dgsAll()
cesiumThreejs3DGS.load3dgs(
{
splatUrl: "./demo/miyake-island.ksplat",
lat: 34.07969,
lon: 139.48138,
height: 63,
headingPitchRoll: { heading: 334, pitch: 180, roll: 0 },
scale: 2,
camera: {
offset: { x: -20, y: 14, z: 3 },
headingPitchRoll: { heading: 95, pitch: 15, roll: 0 }
}
}
)
},
},
{
text: "Triangular point",
onselect: async () => {
await cesiumThreejs3DGS.remove3dgsAll()
cesiumThreejs3DGS.load3dgs(
{
splatUrl: "./demo/triangular-point.ksplat",
lat: 36.02505642,
lon: 140.17925239,
height: 63.3761,
headingPitchRoll: { heading: 190, pitch: 180, roll: 0 },
scale: 1,
camera: {
offset: { x: 0, y: 0, z: 15 },
headingPitchRoll: { heading: -180, pitch: -90, roll: 0 }
}
}
)
},
},
]
viewer.scene.postRender.addEventListener(() => {
cesiumThreejs3DGS.renderThreeObj()
})
Sandcastle.addToolbarMenu(options)
// TODO: Timing
Sandcastle.finishedLoading();
</script>
</body>
</html>