Browse Source

Merge pull request #16181 from Temdog007/feature/SerializeMatcap

Material/MaterialLoader: Added matcap support.
Mr.doob 6 years ago
parent
commit
308204127b
2 changed files with 2 additions and 0 deletions
  1. 1 0
      src/loaders/MaterialLoader.js
  2. 1 0
      src/materials/Material.js

+ 1 - 0
src/loaders/MaterialLoader.js

@@ -172,6 +172,7 @@ Object.assign( MaterialLoader.prototype, {
 		// maps
 
 		if ( json.map !== undefined ) material.map = getTexture( json.map );
+		if ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );
 
 		if ( json.alphaMap !== undefined ) {
 

+ 1 - 0
src/materials/Material.js

@@ -168,6 +168,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		if ( this.clearCoatRoughness !== undefined ) data.clearCoatRoughness = this.clearCoatRoughness;
 
 		if ( this.map && this.map.isTexture ) data.map = this.map.toJSON( meta ).uuid;
+		if ( this.matcap && this.matcap.isTexture ) data.matcap = this.matcap.toJSON( meta ).uuid;
 		if ( this.alphaMap && this.alphaMap.isTexture ) data.alphaMap = this.alphaMap.toJSON( meta ).uuid;
 		if ( this.lightMap && this.lightMap.isTexture ) data.lightMap = this.lightMap.toJSON( meta ).uuid;