Three.js r70合并平面只能渲染第一架飞机?

时间:2015-01-26 06:54:31

标签: javascript three.js

合并平面只能渲染第一个平面,我正在尝试将平面合并在一起以保存性能,因为我计划一次渲染至少4096个并且我只想为它们进行一次绘制调用。 / p>

我正在使用Three.js r70

mapGeo = new THREE.Geometry();
for (var y = 0; y < 10; y++) {
    for (var x = 0; x < 10; x++) {
        for (var z = 0; z < 1; z++) {
            plane = new THREE.Mesh(new THREE.PlaneGeometry( 1, 1));
            plane.position.y = y;
            plane.position.x = x;
            plane.position.z = z;
            mapGeo.merge(plane.geometry, plane.matrix);
        }

    }

}

map = new THREE.Mesh(mapGeo, new THREE.MeshFaceMaterial(materials))

scene.add(map);

Image of the one plane rendering

1 个答案:

答案 0 :(得分:2)

我明白了!

您必须在合并几何图形

之前更新矩阵
plane.updateMatrix();
mapGeo.merge(plane.geometry, plane.matrix);