我想在三个j上实现剪裁平面 我对全球剪裁平面不感兴趣,而是对当地剪裁平面感兴趣 这是我正在使用的代码:
switch(this.data.Axis){
case 'X' :
this.clippingplane = new THREE.Plane(new THREE.Vector3(-1 , 0 , 0) , this.data.Slide) ;
break ;
case 'Y' :
this.clippingplane = new THREE.Plane(new THREE.Vector3(0 , -1 , 0) , this.data.Slide) ;
break ;
case 'Z' :
this.clippingplane = new THREE.Plane(new THREE.Vector3(0 , 0 , -1) , this.data.Slide) ;
break ; }
obj.traverseBreadthFirst(function(node){
if(node instanceof THREE.Mesh){
node.material.clipShadows = true ;
node.material.clippingPlanes = [] ;
node.material.clippingPlanes .push( this.clippingplane );
node.material.needsUpdate = true ;
}
});
这里的问题是javascript返回错误:
t未定义
在渲染器中设置的全局剪裁平面使用相同的代码,工作正常......这里的问题是什么?
答案 0 :(得分:0)
尝试这种通用方法并将其应用于您的示例
var localPlane = new THREE.Plane( new THREE.Vector3( 0, 0, -1 ), 0.9 );
var material2 = new THREE.PointsMaterial( { size: 0.06, vertexColors: THREE.VertexColors,
clippingPlanes: [ localPlane ],
clipShadows: true
} );
var points2 = new THREE.Points( geometry, material2 );
然后添加场景