|
@@ -626,7 +626,7 @@ class GLTFMaterialsUnlitExtension {
|
|
|
|
|
|
if ( metallicRoughness.baseColorTexture !== undefined ) {
|
|
if ( metallicRoughness.baseColorTexture !== undefined ) {
|
|
|
|
|
|
- pending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture ) );
|
|
|
|
|
|
+ pending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture, sRGBEncoding ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -780,7 +780,7 @@ class GLTFMaterialsSheenExtension {
|
|
|
|
|
|
if ( extension.sheenColorTexture !== undefined ) {
|
|
if ( extension.sheenColorTexture !== undefined ) {
|
|
|
|
|
|
- pending.push( parser.assignTexture( materialParams, 'sheenColorMap', extension.sheenColorTexture ) );
|
|
|
|
|
|
+ pending.push( parser.assignTexture( materialParams, 'sheenColorMap', extension.sheenColorTexture, sRGBEncoding ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1013,11 +1013,7 @@ class GLTFMaterialsSpecularExtension {
|
|
|
|
|
|
if ( extension.specularColorTexture !== undefined ) {
|
|
if ( extension.specularColorTexture !== undefined ) {
|
|
|
|
|
|
- pending.push( parser.assignTexture( materialParams, 'specularColorMap', extension.specularColorTexture ).then( function ( texture ) {
|
|
|
|
-
|
|
|
|
- texture.encoding = sRGBEncoding;
|
|
|
|
-
|
|
|
|
- } ) );
|
|
|
|
|
|
+ pending.push( parser.assignTexture( materialParams, 'specularColorMap', extension.specularColorTexture, sRGBEncoding ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1696,7 +1692,7 @@ class GLTFMaterialsPbrSpecularGlossinessExtension {
|
|
|
|
|
|
if ( pbrSpecularGlossiness.diffuseTexture !== undefined ) {
|
|
if ( pbrSpecularGlossiness.diffuseTexture !== undefined ) {
|
|
|
|
|
|
- pending.push( parser.assignTexture( materialParams, 'map', pbrSpecularGlossiness.diffuseTexture ) );
|
|
|
|
|
|
+ pending.push( parser.assignTexture( materialParams, 'map', pbrSpecularGlossiness.diffuseTexture, sRGBEncoding ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1714,7 +1710,7 @@ class GLTFMaterialsPbrSpecularGlossinessExtension {
|
|
|
|
|
|
const specGlossMapDef = pbrSpecularGlossiness.specularGlossinessTexture;
|
|
const specGlossMapDef = pbrSpecularGlossiness.specularGlossinessTexture;
|
|
pending.push( parser.assignTexture( materialParams, 'glossinessMap', specGlossMapDef ) );
|
|
pending.push( parser.assignTexture( materialParams, 'glossinessMap', specGlossMapDef ) );
|
|
- pending.push( parser.assignTexture( materialParams, 'specularMap', specGlossMapDef ) );
|
|
|
|
|
|
+ pending.push( parser.assignTexture( materialParams, 'specularMap', specGlossMapDef, sRGBEncoding ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2990,7 +2986,7 @@ class GLTFParser {
|
|
* @param {Object} mapDef
|
|
* @param {Object} mapDef
|
|
* @return {Promise<Texture>}
|
|
* @return {Promise<Texture>}
|
|
*/
|
|
*/
|
|
- assignTexture( materialParams, mapName, mapDef ) {
|
|
|
|
|
|
+ assignTexture( materialParams, mapName, mapDef, encoding ) {
|
|
|
|
|
|
const parser = this;
|
|
const parser = this;
|
|
|
|
|
|
@@ -3018,6 +3014,12 @@ class GLTFParser {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if ( encoding !== undefined ) {
|
|
|
|
+
|
|
|
|
+ texture.encoding = encoding;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
materialParams[ mapName ] = texture;
|
|
materialParams[ mapName ] = texture;
|
|
|
|
|
|
return texture;
|
|
return texture;
|
|
@@ -3189,7 +3191,7 @@ class GLTFParser {
|
|
|
|
|
|
if ( metallicRoughness.baseColorTexture !== undefined ) {
|
|
if ( metallicRoughness.baseColorTexture !== undefined ) {
|
|
|
|
|
|
- pending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture ) );
|
|
|
|
|
|
+ pending.push( parser.assignTexture( materialParams, 'map', metallicRoughness.baseColorTexture, sRGBEncoding ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3280,7 +3282,7 @@ class GLTFParser {
|
|
|
|
|
|
if ( materialDef.emissiveTexture !== undefined && materialType !== MeshBasicMaterial ) {
|
|
if ( materialDef.emissiveTexture !== undefined && materialType !== MeshBasicMaterial ) {
|
|
|
|
|
|
- pending.push( parser.assignTexture( materialParams, 'emissiveMap', materialDef.emissiveTexture ) );
|
|
|
|
|
|
+ pending.push( parser.assignTexture( materialParams, 'emissiveMap', materialDef.emissiveTexture, sRGBEncoding ) );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3300,13 +3302,6 @@ class GLTFParser {
|
|
|
|
|
|
if ( materialDef.name ) material.name = materialDef.name;
|
|
if ( materialDef.name ) material.name = materialDef.name;
|
|
|
|
|
|
- // baseColorTexture, emissiveTexture, sheenColorMap, specularColorMap and specularGlossinessTexture use sRGB encoding.
|
|
|
|
- if ( material.map ) material.map.encoding = sRGBEncoding;
|
|
|
|
- if ( material.emissiveMap ) material.emissiveMap.encoding = sRGBEncoding;
|
|
|
|
- if ( material.sheenColorMap ) material.sheenColorMap.encoding = sRGBEncoding;
|
|
|
|
- if ( material.specularColorMap ) material.specularColorMap.encoding = sRGBEncoding;
|
|
|
|
- if ( material.specularMap ) material.specularMap.encoding = sRGBEncoding;
|
|
|
|
-
|
|
|
|
assignExtrasToUserData( material, materialDef );
|
|
assignExtrasToUserData( material, materialDef );
|
|
|
|
|
|
parser.associations.set( material, { materials: materialIndex } );
|
|
parser.associations.set( material, { materials: materialIndex } );
|