Potree放大/缩小点击

时间:2018-06-08 14:28:03

标签: three.js

当我点击控制面板上的“+”或“ - ”按钮时,我正在尝试放大/缩小。我让它向左,向右,向上,向下移动“tweenFunction”并且它有效。我试过了

viewer.scene.camera.zoom += 0.1;

这对我不起作用,因为我的代码中没有“camera”变量,只有查看器。这是我的代码

    setup();
    window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));

    viewer.setEDLEnabled(false);
    viewer.setFOV(60);
    viewer.setPointBudget(5*1000*1000);
    document.title = "";

    viewer.setBackground("gradient"); // ["skybox", "gradient", "black", "white"];
    viewer.loadSettingsFromURL();

    viewer.loadGUI(() => {
        viewer.setLanguage('en');
        $("#menu_scene").next().show();
        //viewer.toggleSidebar();
    });

    viewer.setDescription(`

    `);

    let sceneSG = new Potree.Scene();
    let sceneSG2 = new Potree.Scene();

    viewer.setScene(sceneSG);

  Potree.loadPointCloud("model.js", "model", function (e){

        sceneSG.addPointCloud(e.pointcloud);
        sceneSG.view.position.set(37.812, -26.781, 51.178);
        sceneSG.view.lookAt(new THREE.Vector3(-53.587, 33.834, 28.864));


        let material = e.pointcloud.material;
        material.size = 1;
        material.pointSizeType = Potree.PointSizeType.ADAPTIVE;

    });

1 个答案:

答案 0 :(得分:1)

您不能“直接”访问viewer.scene.camera,因为potree有两个摄像机(一个透视图和一个正交图)。但是您可以使用此功能访问活动摄像机:

class User extends Authenticatable
{
    use Notifiable;

    ...

    public function instagramPages()
    {
        return $this->hasMany(InstagramAccount::class);
    }
}

因此,如果您要放大,可能看起来像这样:

viewer.scene.getActiveCamera()