glTF小模型只是Primitive 或Entity的其中一种数据类型;
Cesium支持包含关键帧(key-frame)动画,骨骼(skinning)动画的glTF格式的三维模型,且支持模型节点(node)的拾取。glTf是Khronns Group定义的一个基于web的新兴三维模型格式行业标准;
3D Tiles是一个开发的规范,用于传输海量的异构三维地理空间数据集,使用概念类似terrain和imagery的瓦片流技术,3D Tiles使得建筑物数据集、BIM模型、点云和摄影测量模型等大模型比较流畅的在web端进行浏览展示。
3D Tiles代码示例
var tileset= viewert.scene.primitives.add( new Cesium.Cesium3DTileset({
url:'http://localhost/3DTiles/tileset.json', //模型地址
maximumScreenSpaceError:1
}))
tileset.readyPromise.then(function(tileset){
var boundingSphere=tileset.boundingSphere;
var hpr=new Cesium.HeadingPitchRange(0.0,-0.5,boundingSphere.radius*2)
viewer.camera.flyToBoundingSphere(boundingSphere,hpr); //视角定位至模型
tileset.style= new Cesium.Cesium3DTilesStyle({ //设置样式
color:{
conditions:[
["${floor}>=300","rgba(45,0,75,0.5)"],
[" ${floor}>= 100","rgb(170,162,204)"],
[" ${floor}>= 25","rgb(252,230,200)"],
[" ${floor}>= 5","rgb(198,106,11)"],
["true","rgb(127,59,8)"]
]
}
})
}).otherwise(function(error){
throw(error);
})