使用ThreeJs搭建BIM模型瀏覽器 第四步 剖切

技術方案:threejs的剖切,是由renderer.clippingPlanes實現的。

   

this.clipHelpers = new THREE.Group();
        this.clipHelpers.add(new THREE.AxesHelper(20));
        this.globalPlanes = new THREE.Plane(new THREE.Vector3(1, 0, 0), 0);
        this.clipHelpers.add(new THREE.PlaneHelper( this.globalPlanes, 20, 0xff0000));
        this.clipHelpers.visible = false;
        this.scene.add(this.clipHelpers);
//創建一個剖切面

        this.renderer.clippingPlanes = this.globalPlanes; // 顯示剖面
        this.renderer.localClippingEnabled = true;


        this.globalPlanes.constant = 5;//這個數值的變化將引起剖面的移動

效果如下:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章