zoukankan      html  css  js  c++  java
  • 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);
    });
  • 相关阅读:
    字节流
    类File
    try...catch语句
    Collections工具类
    类TreeMap
    类HashMap
    类TreeSet
    jquery 选择器加变量
    bootstrap 事件shown.bs.modal用于监听并执行你自己的代码【写hostmanger关联部门遇到的问题及解决方法】
    jquery中append、prepend, before和after方法的区别(一)
  • 原文地址:https://www.cnblogs.com/dongzhiwu/p/9052230.html
Copyright © 2011-2022 走看看