我正在尝试操纵相机远平面以隐藏THREE.Line对象的一部分。但是,我一定是做错了。
我使用以下方法设置近平面和远平面:
camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 2, 0);
接下来,我创建几何体:
geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3(-1, 0, 0));
geometry.vertices.push(new THREE.Vector3(1, 0, 0));
geometry.vertices.push(new THREE.Vector3(1, 0, -2)); // outside far plane
geometry.vertices.push(new THREE.Vector3(0, 0, -3)); // outside far plane
geometry.vertices.push(new THREE.Vector3(-1, 0, -2)); // outside far plane
geometry.vertices.push(new THREE.Vector3(-1, 0, 0));
最后,我创建了一行并将其添加到场景中:
lines = new THREE.Line(geometry, material);
lines.frustumCulled = true; // default?
scene.add(lines);
整个对象以平截头体显示。
看小提琴答案 0 :(得分:0)
near
和far
平面参数是距离(距离相机)。他们应该是积极的,far
大于near
。
例如,将far
平面设置为5。
小提琴:http://jsfiddle.net/gpT5K/
three.js r.65