Three.js - 双面平面一侧反转

时间:2013-12-05 17:30:08

标签: three.js textures

我使用了将面推到几何体的方法来实现双面平面。

for (var i=0, len=geometry.faces.length; i<len; i++) {
    var face = geometry.faces[i].clone();
    face.materialIndex = 1;
    geometry.faces.push(face);
    geometry.faceVertexUvs[0].push(geometry.faceVertexUvs[0][i].slice(0));
}

但是,这方面的一方是颠倒的http://jsfiddle.net/bN8ZH/

1 个答案:

答案 0 :(得分:3)

如果你想把两架飞机背对背,最好的方法就是这样:

var geometry = new THREE.PlaneGeometry(80, 116, 20, 20);

var geometry2 = geometry.clone();
geometry2.applyMatrix( new THREE.Matrix4().makeRotationY( Math.PI ) );

THREE.GeometryUtils.merge( geometry, geometry2, 1 );

执行此操作时,请确保每个平面的材质均为material.side = THREE.FrontSide

更新了小提琴:http://jsfiddle.net/bN8ZH/1/

three.js r.63