فهرست منبع

Fixed ColladaLoader to create appropriate materials. Updated monster DAE to look better with phong shading.

Erik Kitson 14 سال پیش
والد
کامیت
4848c11f2b
2فایلهای تغییر یافته به همراه14 افزوده شده و 22 حذف شده
  1. 2 2
      examples/models/monster.dae
  2. 12 20
      src/extras/loaders/ColladaLoader.js

+ 2 - 2
examples/models/monster.dae

@@ -1380,10 +1380,10 @@
               </texture>
             </diffuse>
             <specular>
-              <color>0.9 0.9 0.9 1</color>
+              <color>0.1 0.1 0.1 1</color>
             </specular>
             <shininess>
-              <float>0.415939</float>
+              <float>20</float>
             </shininess>
             <reflective>
               <color>0 0 0 1</color>

+ 12 - 20
src/extras/loaders/ColladaLoader.js

@@ -2935,17 +2935,9 @@ THREE.ColladaLoader = function () {
 
 							}
 
-						} else {
-
-							if ( prop == 'diffuse' ) {
-
-								props[ 'color' ] = cot.color.getHex();
-
-							} else if ( !transparent ) {
+						} else if ( prop == 'diffuse' || !transparent ) {
 
-								props[ prop ] = cot.color.getHex();
-
-							}
+							props[ prop ] = cot.color.getHex();
 
 						}
 
@@ -2979,27 +2971,27 @@ THREE.ColladaLoader = function () {
 		}
 
 		props[ 'shading' ] = preferredShading;
-		this.material = new THREE.MeshLambertMaterial( props );
 
 		switch ( this.type ) {
 
 			case 'constant':
-			case 'lambert':
+
+				props.color = props.emission;
+				this.material = new THREE.MeshBasicMaterial( props );
 				break;
 
 			case 'phong':
 			case 'blinn':
 
-			default:
-
-				/*
-				if ( !transparent ) {
-
-				//	this.material = new THREE.MeshPhongMaterial(props);
+				props.color = props.diffuse;
+				this.material = new THREE.MeshPhongMaterial( props );
+				break;
 
-				}
-				*/
+			case 'lambert':
+			default:
 
+				props.color = props.diffuse;
+				this.material = new THREE.MeshLambertMaterial( props );
 				break;
 
 		}