使用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;//这个数值的变化将引起剖面的移动

效果如下:

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