Cesium.Ion.defaultAccessToken ='';
const viewer = new Cesium.Viewer('cesiumContainer',{
baseLayerPicker:false,
terrainProvider: await Cesium.createWorldTerrainAsync({
requestWaterMask: true,
requestVertexNormals: true
}),
});
const tileset = viewer.scene.primitives.add(
await Cesium.Cesium3DTileset.fromIonAssetId(96188)
);
viewer.scene.camera.setView({
destination:Cesium.Cartesian3.fromDegrees(121.49,31.23,3000),
orientation:{
heading:0,
pitch:-90,
roll:0
}
})
//模型数据样式修改
tileset.style = new Cesium.Cesium3DTileStyle({
color:"color('blue',0.5)",
show:true
})
?根据建筑物高度显示颜色
Cesium.Ion.defaultAccessToken = '';
const viewer = new Cesium.Viewer('cesiumContainer', {
baseLayerPicker: false,
terrainProvider: await Cesium.createWorldTerrainAsync({
requestWaterMask: true,
requestVertexNormals: true
}),
});
const tileset = viewer.scene.primitives.add(
await Cesium.Cesium3DTileset.fromIonAssetId(75343)
);
viewer.camera.setView({
destination: new Cesium.Cartesian3(1333597.29, -4667718.24, 4147626.344),
orientation: {
heading: 0.8,
pitch: -1.2,
roll: 0
}
})
tileset.style = new Cesium.Cesium3DTileStyle({
color: {
conditions: [
['${Height} >= 300', 'color("yellow", 0.4)'],
['${Height} >= 100', 'color("purple", 0.5)'],
['${Height} >= 50', 'color("red")'],
['true', 'color("blue")']
]
},
show: '${Height} > 0',
meta: {
description: '"Building id ${id} has height ${Height}."'
}
});