提交 68f8fb51 编写于 作者: M Mr.doob

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

上级 246e3482
......@@ -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 ] );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册