如果我运行下面使用merge的代码,那么在不合并的情况下运行它,代码运行得更快而不合并。这与我阅读有关使用合并的所有内容相反。我做错了吗?
var width = 800
var height = 600
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 75, width / height, 0.1, 1000 );
var renderer = new THREE.WebGLRenderer();
renderer.setClearColor( 0xffffff );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( width, height);
document.getElementById(self.graphId).appendChild(renderer.domElement)
var geometry = new THREE.CubeGeometry(10, 24.5, 12);
var material = new THREE.MeshNormalMaterial();
var merged = new THREE.Geometry();
for ( var i = 0; i < 10000; i ++ ) {
var mesh = new THREE.Mesh( geometry);
mesh.position.x = Math.random() * 2000 - 1000;
mesh.position.y = Math.random() * 2000 - 1000;
mesh.position.z = Math.random() * 2000 - 1000;
mesh.matrixAutoUpdate = false;
mesh.updateMatrix();
//scene.add(mesh);
merged.merge(mesh.geometry, mesh.matrix);
}
var mergedMesh = new THREE.Mesh(merged, material);
scene.add( mergedMesh);
renderer.render( scene, camera );