Cesium的model初识

Posted xiaoguniang0204

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cesium的model初识相关的知识,希望对你有一定的参考价值。

学习Cesium的model的基础知识。

#primitve方式加载模型

// Cesium.Transforms.eastNorthUpToFixedFrame去创建了一个以经纬度为原点的enu(east-north-up )局部坐标系。 
var
modelmatrix=Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(118,31,1000)); var model = viewer.scene.primitives.add( Cesium.Model.fromGltf({ url:"../data/models/CesiumAir/Cesium_Air.glTF", modelMatrix:modelmatrix,
    //模型大小系数 scale:
100,
    //裁剪面 clippingPlanes: clippingplans }));

#模型运动显示

//设置开始时间
var
startTime = new Cesium.JulianDate.now();
//加载后activeAnimations.addAll({}) Cesium.when(model.readyPromise).then(
function(model){ model.activeAnimations.addAll({
//the style of thr model movement,thiS MIRRORED_REPEAT style means "moving clockwise and then moving anti-clockwise" loop:Cesium.ModelAnimationLoop.MIRRORED_REPEAT, startTime:startTime,
    //stopTime: startTime,stoptime(seconds),create new time (new Cesium.JulianDate())     stopTime:Cesium.JulianDate.addSeconds(startTime,
10,new Cesium.JulianDate()) }) });

#clippingPlane

the core  :ax+by+cz=d; a,b,c,d is four parameters

try to understand this by mathmatics

var clippingPlane= new Cesium.ClippingPlane(new Cesium.Cartesian3(0,1,0),0);//(a,b,c),d
var clippingplans = new Cesium.ClippingPlaneCollection({
    planes:[clippingPlane]
    });

 

#pick the model

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function(movement){
    var pick = scene.pick(movement.endPosition);
    if (Cesium.defined(pick) && Cesium.defined(pick.node) ) {
        console.log(‘node: ‘ + pick.node.name + ‘. mesh: ‘ + pick.mesh.name);
    }
},Cesium.ScreenSpaceEventType.MOUSE_MOVE)

 

以上是关于Cesium的model初识的主要内容,如果未能解决你的问题,请参考以下文章

初识cesium----加载不同JSON格式例子

初识Spring源码 -- doResolveDependency | findAutowireCandidates | @Order@Priority调用排序 | @Autowired注入(代码片段

初识Spring源码 -- doResolveDependency | findAutowireCandidates | @Order@Priority调用排序 | @Autowired注入(代码片段

Cesium(十三)封装路径漫游类

19.初识Pytorch之完整的模型套路-整理后的代码 Complete model routine - compiled code

Django补充及初识Ajax