Browse Source

Refactored OBJ converter demo not to have separate materials per each sphere.

Also first time I noticed issues with stats widget in latest Chrome canary 10.0.624.0 / Chromium continuous build 10.0.629.0:

 - it doesn't show in demos with mixed canvas / WebGL content (OBJ converter demo, lights test)
 - simply just adding it can significantly decrease performance (OBJ converter demo is choppy when invisible stats element exists)
 - in some demos it has different transparency (Walt cubemap demo)

Looks like with some Chrome update in last few days we hit some new compositing or 2d canvas issue (both OpenGL and ANGLE versions share the same issues).
alteredq 14 years ago
parent
commit
a783870b61
1 changed files with 5 additions and 4 deletions
  1. 5 4
      examples/obj_convert_test.html

+ 5 - 4
examples/obj_convert_test.html

@@ -137,9 +137,10 @@
 
 
 				// SPHERES
 				// SPHERES
 
 
-				sphere = new Sphere( 100, 16, 8, 1 );
+				var material_spheres = new THREE.MeshLambertMaterial( { color: 0xdddddd } ),
+					sphere = new Sphere( 100, 16, 8 );
 				for (var i=0; i<10; i++) {
 				for (var i=0; i<10; i++) {
-					mesh = new THREE.Mesh( sphere, new THREE.MeshLambertMaterial( { color: 0xdddddd } ) );
+					mesh = new THREE.Mesh( sphere, material_spheres );
 					mesh.position.x = 500 * (Math.random() - 0.5);
 					mesh.position.x = 500 * (Math.random() - 0.5);
 					mesh.position.y = 300 * (Math.random() - 0) + FLOOR;
 					mesh.position.y = 300 * (Math.random() - 0) + FLOOR;
 					mesh.position.z = 100 * (Math.random() - 1);
 					mesh.position.z = 100 * (Math.random() - 1);
@@ -206,7 +207,7 @@
 
 
 			function createScene( geometry, x, y, z, b ) {
 			function createScene( geometry, x, y, z, b ) {
 
 
-				zmesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial(), 1 );
+				zmesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() );
 				zmesh.position.x = x;
 				zmesh.position.x = x;
 				zmesh.position.z = y;
 				zmesh.position.z = y;
 				zmesh.position.y = z;
 				zmesh.position.y = z;
@@ -221,7 +222,7 @@
 
 
 			function createMaterialsPalette( materials, size, bottom ) {
 			function createMaterialsPalette( materials, size, bottom ) {
 
 
-				for ( var i=0; i<materials.length; ++i ) {
+				for ( var i = 0; i < materials.length; ++i ) {
 
 
 					// material
 					// material
 					mesh = new THREE.Mesh( new Plane( size, size ), materials[i] );
 					mesh = new THREE.Mesh( new Plane( size, size ), materials[i] );