-
Notifications
You must be signed in to change notification settings - Fork 42
/
index.html
91 lines (85 loc) · 2.54 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>视频投射</title>
<link href="src/Cesium1.70/Widgets/widgets.css" rel="stylesheet" />
<script src="src/Cesium1.70/Cesium.js"></script>
<script src="src/cesium-VideoShed3D.js"></script>
<style>
* {
margin: 0;
padding: 0;
}
html,
body,
#viewer-container {
width: 100%;
height: 100%;
overflow: hidden;
}
#btn {
position: absolute;
padding: 5px;
top: 5px;
left: 5px;
}
</style>
</head>
<body>
<div id="viewer-container"></div>
<div id="btn"><button onclick="create()">创建</button><button onclick="destroy()">删除</button></div>
<script>
// init
function initPage() {
// 切换自己的token
Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYTQ2ZjdjNS1jM2E0LTQ1M2EtOWM0My1mODMzNzY3YjYzY2YiLCJpZCI6MjkzMjcsInNjb3BlcyI6WyJhc3IiLCJnYyJdLCJpYXQiOjE1OTE5NDIzNjB9.RzKlVTVDTQ9r7cqCo-PDydgUh8Frgw0Erul_BVxiS9c';
// 初始化
let viewer = new Cesium.Viewer("viewer-container", {
infoBox: false,
shouldAnimate: true,
vrButton: true,
geocoder: false,
homeButton: false,
sceneModePicker: false,
baseLayerPicker: true,
navigationHelpButton: false,
animation: false,
timeline: false,
fullscreenButton: false,
});
// LOAD
let tilesets = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: 'http://earthsdk.com/v/last/Apps/assets/dayanta/tileset.json'
// url: 'datas/SampleData/Cesium3DTiles/Tilesets/Tileset/tileset.json'
}))
viewer.flyTo(tilesets)
// 参数
let viewModel = { verticalAngle: 90, horizontalAngle: 120, distance: 10 };
let videoShed3DArr = [];
// 创建
window.create = function () {
let videoShed3D = new Cesium.VideoShed3D(viewer, {
type: 'Video',
url: "src/cs.mp4",
alpha: 1,
debugFrustum: true,
horizontalAngle: Number(viewModel.horizontalAngle),
verticalAngle: Number(viewModel.verticalAngle),
distance: Number(viewModel.distance),
});
videoShed3DArr.push(videoShed3D)
}
// 销毁
window.destroy = function () {
videoShed3DArr.forEach(video => video.destroy())
}
}
// load
window.onload = function () {
initPage()
}
</script>
</body>
</html>