Skip to content

Commit

Permalink
Glossiness support in serialization/deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
takahirox committed Mar 21, 2017
1 parent e158265 commit 27999fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/loaders/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,14 @@ Object.assign( Loader.prototype, {
case 'mapRoughnessWrap':
case 'mapRoughnessAnisotropy':
break;
case 'mapGlossinessRepeat':
case 'mapGlossinessOffset':
case 'mapGlossinessWrap':
case 'mapGlossinessAnisotropy':
break;
case 'mapGlossiness':
json.glossinessMap = loadTexture( value, m.mapGlossinessRepeat, m.mapGlossinessOffset, m.mapGlossinessWrap, m.mapGlossinessAnisotropy );
break;
case 'mapAlpha':
json.alphaMap = loadTexture( value, m.mapAlphaRepeat, m.mapAlphaOffset, m.mapAlphaWrap, m.mapAlphaAnisotropy );
break;
Expand Down
2 changes: 2 additions & 0 deletions src/loaders/MaterialLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Object.assign( MaterialLoader.prototype, {
if ( json.color !== undefined ) material.color.setHex( json.color );
if ( json.roughness !== undefined ) material.roughness = json.roughness;
if ( json.metalness !== undefined ) material.metalness = json.metalness;
if ( json.glossiness !== undefined ) material.glossiness = json.glossiness;
if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive );
if ( json.specular !== undefined ) material.specular.setHex( json.specular );
if ( json.shininess !== undefined ) material.shininess = json.shininess;
Expand Down Expand Up @@ -126,6 +127,7 @@ Object.assign( MaterialLoader.prototype, {

if ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );
if ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );
if ( json.glossinessMap !== undefined ) material.glossinessMap = getTexture( json.glossinessMap );

if ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );
if ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;
Expand Down
2 changes: 2 additions & 0 deletions src/materials/Material.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Object.assign( Material.prototype, EventDispatcher.prototype, {

if ( this.roughness !== undefined ) data.roughness = this.roughness;
if ( this.metalness !== undefined ) data.metalness = this.metalness;
if ( this.glossiness !== undefined ) data.glossiness = this.glossiness;

if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
Expand Down Expand Up @@ -176,6 +177,7 @@ Object.assign( Material.prototype, EventDispatcher.prototype, {
}
if ( this.roughnessMap && this.roughnessMap.isTexture ) data.roughnessMap = this.roughnessMap.toJSON( meta ).uuid;
if ( this.metalnessMap && this.metalnessMap.isTexture ) data.metalnessMap = this.metalnessMap.toJSON( meta ).uuid;
if ( this.glossinessMap && this.glossinessMap.isTexture ) data.glossinessMap = this.glossinessMap.toJSON( meta ).uuid;

if ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;
if ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;
Expand Down

0 comments on commit 27999fb

Please sign in to comment.