Browse Source

Merge pull request #11313 from blairmacintyre/dev

fixing parsing of "d"/"tr" in MTLLoader
Mr.doob 8 years ago
parent
commit
6a05bc71c6
1 changed files with 7 additions and 4 deletions
  1. 7 4
      examples/js/loaders/MTLLoader.js

+ 7 - 4
examples/js/loaders/MTLLoader.js

@@ -382,6 +382,7 @@ THREE.MTLLoader.MaterialCreator.prototype = {
 		for ( var prop in mat ) {
 		for ( var prop in mat ) {
 
 
 			var value = mat[ prop ];
 			var value = mat[ prop ];
+			var n;
 
 
 			if ( value === '' ) continue;
 			if ( value === '' ) continue;
 
 
@@ -439,10 +440,11 @@ THREE.MTLLoader.MaterialCreator.prototype = {
 					break;
 					break;
 
 
 				case 'd':
 				case 'd':
+					n = parseFloat(value);
 
 
-					if ( value < 1 ) {
+					if ( n < 1 ) {
 
 
-						params.opacity = value;
+						params.opacity = n;
 						params.transparent = true;
 						params.transparent = true;
 
 
 					}
 					}
@@ -450,10 +452,11 @@ THREE.MTLLoader.MaterialCreator.prototype = {
 					break;
 					break;
 
 
 				case 'tr':
 				case 'tr':
+					n = parseFloat(value);
 
 
-					if ( value > 0 ) {
+					if ( n > 0 ) {
 
 
-						params.opacity = 1 - value;
+						params.opacity = 1 - n;
 						params.transparent = true;
 						params.transparent = true;
 
 
 					}
 					}