是否可以隐藏框架实体的某些部分?

时间:2018-08-09 19:24:52

标签: three.js aframe

是否有等同于CSS溢出的内容:隐藏在框架中?例如,我可以约束一个整体在一个边界之内,并且使比盒子几何体大的所有东西都隐藏/不可见吗?

1 个答案:

答案 0 :(得分:2)

有剪切平面:https://threejs.org/examples/webgl_clipping.html

https://github.com/mrdoob/three.js/blob/master/examples/webgl_clipping.html

// ***** Clipping planes: *****
                var localPlane = new THREE.Plane( new THREE.Vector3( 0, - 1, 0 ), 0.8 );
                var globalPlane = new THREE.Plane( new THREE.Vector3( - 1, 0, 0 ), 0.1 );
                // Geometry
                var material = new THREE.MeshPhongMaterial( {
                        color: 0x80ee10,
                        shininess: 100,
                        side: THREE.DoubleSide,
                        // ***** Clipping setup (material): *****
                        clippingPlanes: [ localPlane ],
                        clipShadows: true
                    } );
                var geometry = new THREE.TorusKnotBufferGeometry( 0.4, 0.08, 95, 20 );
                object = new THREE.Mesh( geometry, material );