浏览代码

Scene graph update is fast enough that on my system there is no change of FPS when removing the matrixAutoUpdate = false stuff.
Also compared with r48 and FPS went from 12fps to 20fps :D

Mr.doob 13 年之前
父节点
当前提交
08a37d34c1
共有 1 个文件被更改,包括 16 次插入7 次删除
  1. 16 7
      examples/webgl_performance.html

+ 16 - 7
examples/webgl_performance.html

@@ -26,7 +26,7 @@
 
 			var camera, scene, renderer;
 
-			var mesh, zmesh, lightMesh, geometry;
+			var objects;
 
 			var mouseX = 0, mouseY = 0;
 
@@ -51,6 +51,8 @@
 				camera.position.z = 3200;
 				scene.add( camera );
 
+				objects = [];
+
 				var material = new THREE.MeshNormalMaterial( { shading: THREE.SmoothShading } );
 
 				var loader = new THREE.JSONLoader();
@@ -62,14 +64,14 @@
 
 						var mesh = new THREE.Mesh( geometry, material );
 
-						mesh.position.x = Math.random() * 10000 - 5000;
-						mesh.position.y = Math.random() * 10000 - 5000;
-						mesh.position.z = Math.random() * 10000 - 5000;
+						mesh.position.x = Math.random() * 8000 - 4000;
+						mesh.position.y = Math.random() * 8000 - 4000;
+						mesh.position.z = Math.random() * 8000 - 4000;
 						mesh.rotation.x = Math.random() * 360 * ( Math.PI / 180 );
 						mesh.rotation.y = Math.random() * 360 * ( Math.PI / 180 );
 						mesh.scale.x = mesh.scale.y = mesh.scale.z = Math.random() * 50 + 100;
-						mesh.matrixAutoUpdate = false;
-						mesh.updateMatrix();
+
+						objects.push( mesh );
 
 						scene.add( mesh );
 
@@ -111,9 +113,16 @@
 
 				camera.position.x += ( mouseX - camera.position.x ) * .05;
 				camera.position.y += ( - mouseY - camera.position.y ) * .05;
-
 				camera.lookAt( scene.position );
 
+				for ( var i = 0; i < 5000; i ++ ) {
+
+					objects[ i ].rotation.x += 0.01;
+					objects[ i ].rotation.y += 0.02;
+
+				}
+
+
 				renderer.render( scene, camera );
 
 			}