Bläddra i källkod

ColladaLoader: Removed default FlatShading.

Mr.doob 10 år sedan
förälder
incheckning
aa76dbc804
2 ändrade filer med 14 tillägg och 7 borttagningar
  1. 1 5
      examples/js/loaders/ColladaLoader.js
  2. 13 2
      examples/webgl_loader_collada_kinematics.html

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

@@ -1165,7 +1165,7 @@ THREE.ColladaLoader = function () {
 				}
 
 				var mesh;
-				var material = first_material || new THREE.MeshLambertMaterial( { color: 0xdddddd, shading: THREE.FlatShading, side: geometry.doubleSided ? THREE.DoubleSide : THREE.FrontSide } );
+				var material = first_material || new THREE.MeshLambertMaterial( { color: 0xdddddd, side: geometry.doubleSided ? THREE.DoubleSide : THREE.FrontSide } );
 				var geom = geometry.mesh.geometry3js;
 
 				if ( num_materials > 1 ) {
@@ -2821,8 +2821,6 @@ THREE.ColladaLoader = function () {
 
 		}
 
-		this.geometry3js.computeFaceNormals();
-
 		if ( this.geometry3js.calcNormals ) {
 
 			this.geometry3js.computeVertexNormals();
@@ -2830,8 +2828,6 @@ THREE.ColladaLoader = function () {
 
 		}
 
-		// this.geometry3js.computeBoundingBox();
-
 		return this;
 
 	};

+ 13 - 2
examples/webgl_loader_collada_kinematics.html

@@ -60,6 +60,17 @@
 
 				dae = collada.scene;
 
+				dae.traverse( function ( child ) {
+
+					if ( child instanceof THREE.Mesh ) {
+
+						child.geometry.computeFaceNormals();
+						child.material.shading = THREE.FlatShading;
+
+					}
+
+				} );
+
 				dae.scale.x = dae.scale.y = dae.scale.z = 10.0;
 				dae.updateMatrix();
 
@@ -111,14 +122,14 @@
 
 				scene.add( new THREE.AmbientLight( 0xcccccc ) );
 
-				var directionalLight = new THREE.DirectionalLight(/*Math.random() * 0xffffff*/0xeeeeee );
+				var directionalLight = new THREE.DirectionalLight( 0xeeeeee );
 				directionalLight.position.x = Math.random() - 0.5;
 				directionalLight.position.y = Math.random() - 0.5;
 				directionalLight.position.z = Math.random() - 0.5;
 				directionalLight.position.normalize();
 				scene.add( directionalLight );
 
-				var pointLight = new THREE.PointLight( 0xffffff, 1 );
+				var pointLight = new THREE.PointLight( 0xffffff, 0.5 );
 				particleLight.add( pointLight );
 
 				renderer = new THREE.WebGLRenderer();