Procházet zdrojové kódy

Unflattened loader optimization - was lost in the shuffle several versions ago. Updated Skinning Example

Tony Parisi před 11 roky
rodič
revize
127309932f

+ 6 - 1
examples/js/loaders/ColladaLoader.js

@@ -1044,7 +1044,12 @@ THREE.ColladaLoader = function () {
 
 				}
 
-				node.geometries.length > 1 ? obj.add( mesh ) : obj = mesh;
+				// N.B.: TP says this is not a great default behavior. It's a nice
+				// optimization to flatten the hierarchy but this should be done
+				// only if requested by the user via a flag. For now I undid it
+				// and fixed the character animation example that uses it
+				// node.geometries.length > 1 ? obj.add( mesh ) : obj = mesh;
+				obj.add(mesh);
 
 			}
 

+ 4 - 2
examples/webgl_loader_collada_skinning.html

@@ -85,9 +85,11 @@
 				
 					scene.add( geometry.scene );
 
-					camera.lookAt(geometry.scene.children[0].children[1].position);
+					// T.P. adapted this to use un-flattened DAE hierarchy; see ColladaLoader.js
+					// for more information
+					var skin = geometry.scene.children[0].children[1].children[0];
+					camera.lookAt(skin.position);
 
-					var skin = geometry.scene.children[0].children[1];
 					
 					if ( skin.geometry.animation ) {