1. 程式人生 > 其它 >cesium建模&載入3dsmax模型

cesium建模&載入3dsmax模型

cesium可以建模嗎?當然可以,但是。。。

建的模型比較單調乏味,比如建一個正方體,建一個圓球,如果是複雜一些的模型,例如一個tube(管道),一個圓環。。。。那該怎麼辦?cesium有沒有提供這樣的函式供我們使用呢?例如我們常見的。。。飛機模型

var viewer = new Cesium.Viewer("cesiumContainer", {
  infoBox: false,
  selectionIndicator: false,
  shadows: true,
  shouldAnimate: true,
});

function createModel(url, height) {
  viewer.entities.removeAll();

  
var position = Cesium.Cartesian3.fromDegrees( -123.0744619, 44.0503706, height ); var heading = Cesium.Math.toRadians(135); var pitch = 0; var roll = 0; var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll); var orientation = Cesium.Transforms.headingPitchRollQuaternion( position, hpr );
var entity = viewer.entities.add({ name: url, position: position, orientation: orientation, model: { uri: url, minimumPixelSize: 128, maximumScale: 20000, }, }); viewer.trackedEntity = entity; } var options = [ { text: "Aircraft", onselect: function () { createModel(
"../SampleData/models/CesiumAir/Cesium_Air.glb", 5000.0 ); }, }, { text: "Drone", onselect: function () { createModel( "../SampleData/models/CesiumDrone/CesiumDrone.glb", 150.0 ); }, }, { text: "Ground Vehicle", onselect: function () { createModel( "../SampleData/models/GroundVehicle/GroundVehicle.glb", 0 ); }, }, { text: "Hot Air Balloon", onselect: function () { createModel( "../SampleData/models/CesiumBalloon/CesiumBalloon.glb", 1000.0 ); }, }, { text: "Milk Truck", onselect: function () { createModel( "../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.glb", 0 ); }, }, { text: "Skinned Character", onselect: function () { createModel( "../SampleData/models/CesiumMan/Cesium_Man.glb", 0 ); }, }, { text: "Draco Compressed Model", onselect: function () { createModel( "../SampleData/models/DracoCompressed/CesiumMilkTruck.gltf", 0 ); }, }, ]; Sandcastle.addToolbarMenu(options);