Browse Source

Material/MaterialLoader: Support roughnessMap/metalnessMap.

Mr.doob 9 years ago
parent
commit
b9cdc2db6a
2 changed files with 5 additions and 0 deletions
  1. 3 0
      src/loaders/MaterialLoader.js
  2. 2 0
      src/materials/Material.js

+ 3 - 0
src/loaders/MaterialLoader.js

@@ -119,6 +119,9 @@ THREE.MaterialLoader.prototype = {
 		if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;
 		if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;
 
+		if ( json.roughnessMap !== undefined ) material.roughnessMap = this.getTexture( json.roughnessMap );
+		if ( json.metalnessMap !== undefined ) material.metalnessMap = this.getTexture( json.metalnessMap );
+
 		if ( json.specularMap !== undefined ) material.specularMap = this.getTexture( json.specularMap );
 
 		if ( json.envMap !== undefined ) {

+ 2 - 0
src/materials/Material.js

@@ -170,6 +170,8 @@ THREE.Material.prototype = {
 			data.displacementBias = this.displacementBias;
 
 		}
+		if ( this.roughnessMap instanceof THREE.Texture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;
+		if ( this.metalnessMap instanceof THREE.Texture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;
 		if ( this.specularMap instanceof THREE.Texture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;
 		if ( this.envMap instanceof THREE.Texture ) {