• 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)
  • 相关阅读:
    BPC (9) SAP BI & BPC 安装 : 一个外行眼里的千奇百怪 (1)
    ESB (2) POCSofewareAG
    BPC (7) BPC Netweaver 7 和 microsoft 7 版本的差异
    ESB (3) POCOralce ESB
    厘清了xorg里的一些概念
    Top命令和Kill命令
    ubuntu中文英文环境切换
    /etc/passwd 文件内容详细解释
    [分享] Linux下用Anjuta写个Hello World 的C++程序竟如此简单!
    /proc目录
  • 原文地址:https://www.cnblogs.com/xiaoguniang0204/p/11785592.html
Copyright © 2020-2023  润新知