Browse Source

update to make it less dependaned

gero3 13 years ago
parent
commit
7695c25398
1 changed files with 12 additions and 28 deletions
  1. 12 28
      src/materials/Material.js

+ 12 - 28
src/materials/Material.js

@@ -45,40 +45,24 @@ THREE.Material.prototype.setValues = function ( values ) {
 
 		var value = values[ key ];
 
-		if ( this[ key ] !== undefined ) {
+		if ( this[ key ] !== undefined && key !== "id") {
 
-			switch ( key ) {
-
-				case "id":
-					break;
-
-				case "color":
-				case "ambient":
-				case "emissive":
-				case "specular":
-
-					if ( value instanceof THREE.Color ) {
-
-						this[ key ].copy( value );
-
-					} else {
-
-						this[ key ].setHex( value );
-
-					}
-
-					break;
-
-				case "wrapRGB":
+			if (this[key] instanceof THREE.Color) {
+				
+				if ( value instanceof THREE.Color ) {
 
 					this[ key ].copy( value );
 
-					break;
-
-				default:
+				} else {
 
-					this[ key ] = value;
+					this[ key ].setHex( value );
 
+				}
+				
+			} else if (this[key] instanceof THREE.Vector3){
+				this[ key ].copy( value );
+			} else {
+				this[ key ] = value;
 			}
 
 		}