2
0
Эх сурвалжийг харах

ObjectLoader: Added warning for constant using symbolic form. See #6538.

Mr.doob 10 жил өмнө
parent
commit
68f8fb51c9
1 өөрчлөгдсөн 15 нэмэгдсэн , 11 устгасан
  1. 15 11
      src/loaders/ObjectLoader.js

+ 15 - 11
src/loaders/ObjectLoader.js

@@ -293,12 +293,6 @@ THREE.ObjectLoader.prototype = {
 
 	},
 
-	parseConstant: function ( json ) {
-
-		return typeof( json ) === 'number' ? json : THREE[ json ];
-
-	},
-
 	parseImages: function ( json, onLoad ) {
 
 		var scope = this;
@@ -338,6 +332,16 @@ THREE.ObjectLoader.prototype = {
 
 	parseTextures: function ( json, images ) {
 
+		function parseConstant( value ) {
+
+			if ( typeof( value ) === 'number' ) return value;
+
+			console.warn( 'THREE.ObjectLoader.parseTexture: Constant should be in numeric form.', value );
+
+			return THREE[ value ];
+
+		}
+
 		var textures = {};
 
 		if ( json !== undefined ) {
@@ -364,15 +368,15 @@ THREE.ObjectLoader.prototype = {
 				texture.uuid = data.uuid;
 
 				if ( data.name !== undefined ) texture.name = data.name;
-				if ( data.mapping !== undefined ) texture.mapping = this.parseConstant( data.mapping );
+				if ( data.mapping !== undefined ) texture.mapping = parseConstant( data.mapping );
 				if ( data.repeat !== undefined ) texture.repeat = new THREE.Vector2( data.repeat[ 0 ], data.repeat[ 1 ] );
-				if ( data.minFilter !== undefined ) texture.minFilter = this.parseConstant( data.minFilter );
-				if ( data.magFilter !== undefined ) texture.magFilter = this.parseConstant( data.magFilter );
+				if ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter );
+				if ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter );
 				if ( data.anisotropy !== undefined ) texture.anisotropy = data.anisotropy;
 				if ( data.wrap instanceof Array ) {
 
-					texture.wrapS = this.parseConstant( data.wrap[ 0 ] );
-					texture.wrapT = this.parseConstant( data.wrap[ 1 ] );
+					texture.wrapS = parseConstant( data.wrap[ 0 ] );
+					texture.wrapT = parseConstant( data.wrap[ 1 ] );
 
 				}