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

Merge pull request #13915 from takahirox/TextureToJSON

Add missing properties exportation to Texture.toJSON()
Mr.doob 6 жил өмнө
parent
commit
a42ac0747c

+ 5 - 0
src/loaders/ObjectLoader.js

@@ -663,6 +663,8 @@ Object.assign( ObjectLoader.prototype, {
 				}
 
 				if ( data.format !== undefined ) texture.format = data.format;
+				if ( data.type !== undefined ) texture.type = data.type;
+				if ( data.encoding !== undefined ) texture.encoding = data.encoding;
 
 				if ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );
 				if ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );
@@ -670,6 +672,9 @@ Object.assign( ObjectLoader.prototype, {
 
 				if ( data.flipY !== undefined ) texture.flipY = data.flipY;
 
+				if ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;
+				if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;
+
 				textures[ data.uuid ] = texture;
 
 			}

+ 7 - 1
src/textures/Texture.js

@@ -161,11 +161,17 @@ Texture.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
 			wrap: [ this.wrapS, this.wrapT ],
 
 			format: this.format,
+			type: this.type,
+			encoding: this.encoding,
+
 			minFilter: this.minFilter,
 			magFilter: this.magFilter,
 			anisotropy: this.anisotropy,
 
-			flipY: this.flipY
+			flipY: this.flipY,
+
+			premultiplyAlpha: this.premultiplyAlpha,
+			unpackAlignment: this.unpackAlignment
 
 		};