123 lines
3.7 KiB
HTML
123 lines
3.7 KiB
HTML
<!--
|
|
* @Descripttion:
|
|
* @version: 1.0.0
|
|
* @Author: zhangti
|
|
* @Date: 2020-03-05 03:58:30
|
|
* @LastEditors: zhangti
|
|
* @LastEditTime: 2020-07-23 21:55:06
|
|
-->
|
|
<div id="viewer-container"></div>
|
|
<script>
|
|
|
|
let viewer = new Cesium.Viewer("viewer-container", {
|
|
shouldAnimate: true,
|
|
useDefaultRenderLoop: true,
|
|
infoBox: false,
|
|
contextOptions: {
|
|
webgl: {
|
|
alpha: false,
|
|
antialias: true,
|
|
preserveDrawingBuffer: true,
|
|
failIfMajorPerformanceCaveat: false,
|
|
depth: true,
|
|
stencil: false,
|
|
anialias: false
|
|
},
|
|
}
|
|
});
|
|
|
|
let d3kit = new Cesium.D3Kit(viewer)
|
|
|
|
let layer = viewer.imageryLayers.addImageryProvider(new Cesium.BaiduImageryProvider({
|
|
style: 'dark'
|
|
}));
|
|
|
|
viewer.scene.skyBox = d3kit.setOneSkyBox()
|
|
|
|
//设置环境光
|
|
viewer.scene.lightSource.ambientLightColor = new Cesium.Color(0.08, 0.08, 0.08, 1);
|
|
|
|
//深度检测
|
|
// this._scene.globe.depthTestAgainstTerrain = false;
|
|
|
|
//地面调节
|
|
//this._scene.globe.baseColor = Cesium.Color.BLACK;
|
|
//this._scene.globe.globeAlpha = 0.1;
|
|
viewer.scene.undergroundMode = true;
|
|
viewer.scene.terrainProvider.isCreateSkirt = false;
|
|
|
|
//调节场景环境
|
|
viewer.scene.sun.show = false;
|
|
viewer.scene.moon.show = false;
|
|
// this._scene.skyBox.show = false;
|
|
viewer.scene.skyAtmosphere.show = false;
|
|
viewer.scene.fxaa = true;
|
|
|
|
//开启颜色校正
|
|
viewer.scene.colorCorrection.show = false;
|
|
viewer.scene.colorCorrection.saturation = 3.1;
|
|
viewer.scene.colorCorrection.brightness = 1.8;
|
|
viewer.scene.colorCorrection.contrast = 1.2;
|
|
viewer.scene.colorCorrection.hue = 0;
|
|
|
|
//开启泛光和HDR
|
|
viewer.scene.bloomEffect.show = false;
|
|
viewer.scene.hdrEnabled = true;
|
|
viewer.scene.bloomEffect.threshold = 1;
|
|
viewer.scene.bloomEffect.bloomIntensity = 2;
|
|
|
|
//最大距离
|
|
viewer.scene.screenSpaceCameraController.maximumZoomDistance = 5000.0
|
|
|
|
var promise = viewer.scene.open('http://www.supermapol.com/realspace/services/3D-CQmodel_wireframe_2000/rest/realspace')
|
|
|
|
Cesium.when.all(promise, (layer) => {
|
|
|
|
d3kit.setView({
|
|
position: Cesium.Cartesian3.fromDegrees(106.6269866033348, 29.53232673901685, 2000),
|
|
orientation: {
|
|
heading: Cesium.Math.toRadians(350.37060),
|
|
pitch: Cesium.Math.toRadians(-12.75012),
|
|
roll: Cesium.Math.toRadians(0.00306)
|
|
}
|
|
})
|
|
layer[0].style3D.emissionColor = new Cesium.Color(2, 5, 10, 1); //自发光颜色
|
|
d3kit.setHypsometric(layer[0])
|
|
// d3kit.setFlyCircle(true) //给鼠标绑定旋转操作
|
|
|
|
var paths = [
|
|
{ lon: 106.53723590282631, lat: 29.549647357633564, alt: 300, height: 10000, time: 0 },
|
|
{ lon: 106.54729432614089, lat: 29.525784806338617, alt: 300, height: 10000, time: 120 },
|
|
{ lon: 106.5710138566176, lat: 29.516772520652342, alt: 300, height: 10000, time: 240 },
|
|
{ lon: 106.5788276019971, lat: 29.53780626182699, alt: 300, height: 10000, time: 360 },
|
|
{ lon: 106.54982114025249, lat: 29.543572027310912, alt: 300, height: 10000, time: 480 }
|
|
]
|
|
var flyEntity = d3kit.buildPathRoaming({
|
|
paths: paths,
|
|
model: true,
|
|
m_url: 'data/model/CesiumDrone.gltf',
|
|
label: true,
|
|
l_text: '无人机侦察',
|
|
l_outlineWidth: 3,
|
|
l_fillColor: Cesium.Color.CYAN
|
|
})
|
|
|
|
var pointLight = d3kit.setPointLight(
|
|
flyEntity.position.getValue(viewer.clock.currentTime),
|
|
{
|
|
color: new Cesium.Color(9, 160, 15, 0.8),
|
|
cutoffDistance: 500,
|
|
decay: 2,
|
|
intensity: 5
|
|
})
|
|
|
|
viewer.trackedEntity = flyEntity
|
|
viewer.clock.onTick.addEventListener((clock) => {
|
|
|
|
var position = flyEntity.position.getValue(viewer.clock.currentTime)
|
|
|
|
pointLight.position = position
|
|
});
|
|
|
|
});
|
|
</script> |