3dtiles的加载
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: Cesium.createWorldTerrain()
});
var tileset = new Cesium.Cesium3DTileset({
url: Cesium.IonResource.fromAssetId(40866)
});
viewer.scene.primitives.add(tileset);
viewer.zoomTo(tileset);
3dtiles的拾取
http://localhost:8080/Apps/Sandcastle/index.html?src=3D%20Tiles%20BIM.html&label=3D%20Tiles
var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
if (!picking) {
return;
}
var feature = scene.pick(movement.endPosition);
unselectFeature(selectedFeature);
if (feature instanceof Cesium.Cesium3DTileFeature) {
selectFeature(feature);
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
3dtiles的裁切
Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, 0.0, -1.0), 0.0) 原点在3DTILES模型的中心
好几个3dtiles叠在一起,每个有各自的原点,若用一个Cesium.ClippingPlane去切,三个3dtiles切的都不一样。
3dtiles inspector
http://localhost:8080/Apps/Sandcastle/index.html?src=3D%20Tiles%20Formats.html&label=3D%20Tiles
http://localhost:8080/Apps/Sandcastle/index.html?src=3D%20Tiles%20Inspector.html&label=3D%20Tiles
表示渲染速度,每帧消耗时间
3dtiles的style控制 Cesium.Cesium3DTileStyle
块和属性的关系
ClassificationPrimitive
http://localhost:8080/Apps/Sandcastle/index.html?src=Classification.html&label=3D%20Tiles
关键代码
Cesium.ClassificationPrimitive
classificationType : Cesium.ClassificationType.CESIUM_3D_TILE
var buildingHighlight = scene.primitives.add(new Cesium.ClassificationPrimitive({
geometryInstances : new Cesium.GeometryInstance({
geometry : Cesium.BoxGeometry.fromDimensions({
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
dimensions : new Cesium.Cartesian3(8.0, 5.0, 8.0)
}),
modelMatrix : modelMatrix,
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1.0, 0.0, 0.0, 0.5)),
show : new Cesium.ShowGeometryInstanceAttribute(true)
},
id : 'volume'
}),
classificationType : Cesium.ClassificationType.CESIUM_3D_TILE
}));
立方体盒子
更改立方体盒子的属性,更改盒子里面的3DTILES属性信息
http://localhost:8080/Apps/Sandcastle/index.html?src=3D%20Tiles%20Photogrammetry%20Classification.html&label=All
两个3Dtiles数据:一个是真正的倾斜摄影数据;一个是立方体盒子的数据;设置立方体盒子的样式,分类的样式,遮罩的效果。
大雁塔数据 视频说明
视频课程链接地址
位于06:00左右