使用的是:icliend 3d for cesium
加载3dtiles的代码:
let tdtiles = new Cesium.Cesium3DTileset({ url: layerInfo.url, shadows: Cesium.ShadowMode.ENABLED, cullWithChildrenBounds: true, dynamicScreenSpaceError: true, maximumScreenSpaceError: 2, //最大的屏幕空间误差 maximumMemoryUsage: 8192, luminanceAtZenith: 0.6 }) var tileset = this.viewer.scene.primitives.add( tdtiles );
日照效果代码:
const that = this that.viewer.shadows = true; that.viewer.shadowMap.darkness = 0.3; that.viewer.terrainShadows = Cesium.ShadowMode.RECEIVE_ONLY // 01设置环境光的强度-新处理CBD场景 that.viewer.scene.lightSource.ambientLightColor = new Cesium.Color(0.65, 0.65, 0.65, 1); var startTime = new Date(date); var shour = Number(startour); var ehour = Number(endour); if(shour > ehour) { return; } var nTimer = 0.0; if(that.nIntervId == null){ that.nIntervId = setInterval(function() { if(shour < ehour) { startTime.setHours(shour); startTime.setMinutes(nTimer); that.viewer.clock.currentTime = Cesium.JulianDate.fromDate(startTime); nTimer += 10.0; if(nTimer > 60.0){ shour += 1.0; nTimer = 0.0; } }else { clearInterval(that.nIntervId); that.nIntervId = null } }, that.playStep); }