zoukankan      html  css  js  c++  java
  • 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)
  • 相关阅读:
    JS——变量和函数的预解析、匿名函数、函数传参、return
    JS——函数
    JS——操作元素属性
    JS——变量声明、变量类型、命名规范
    JS——三种嵌入页面的方式
    CSS——弹性盒模型
    CSS——相对定位、绝对定位、固定定位
    CSS3——PC以及移动端页面适配方法(响应布局)
    [20180528]校内模拟赛
    Leetcode Majority Element系列 摩尔投票法
  • 原文地址:https://www.cnblogs.com/xiaoguniang0204/p/11785592.html
Copyright © 2011-2022 走看看