ceisum_加载倾斜摄影模型

  osgb转换为3Dtiles格式(使用工具转换)

  然后加载到cesium中(加载代码见下,可以控制模型高度)

  

var offset = function(height,tileset) {
  console.log(height);
  height = Number(height);
  if (isNaN(height)) {
    return;
  }
  var cartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);
  var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
  var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, height);
  var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
  tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
};
// 加载倾斜摄影模型
var tileset = new Cesium.Cesium3DTileset({ url: '/' });
tileset.readyPromise.then(function(tileset) {
  viewer.scene.primitives.add(tileset);
  offset(100,tileset);
  var boundingSphere = tileset.boundingSphere;
  viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius));
  viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
}).otherwise(function(error) {
  console.log(error);
});
原文地址:https://www.cnblogs.com/dongzhiwu/p/9052230.html