|
@@ -1297,9 +1297,11 @@ class GLTFWriter {
|
|
}
|
|
}
|
|
|
|
|
|
// pbrMetallicRoughness.metallicRoughnessTexture
|
|
// pbrMetallicRoughness.metallicRoughnessTexture
|
|
- if ( material.metalnessMap || material.roughnessMap ) {
|
|
|
|
|
|
+ const metalnessMap = material.metalnessMap?.image ? material.metalnessMap : undefined;
|
|
|
|
+ const roughnessMap = material.roughnessMap?.image ? material.roughnessMap : undefined;
|
|
|
|
+ if ( metalnessMap || roughnessMap ) {
|
|
|
|
|
|
- const metalRoughTexture = this.buildMetalRoughTexture( material.metalnessMap, material.roughnessMap );
|
|
|
|
|
|
+ const metalRoughTexture = this.buildMetalRoughTexture( metalnessMap, roughnessMap );
|
|
|
|
|
|
const metalRoughMapDef = { index: this.processTexture( metalRoughTexture ) };
|
|
const metalRoughMapDef = { index: this.processTexture( metalRoughTexture ) };
|
|
this.applyTextureTransform( metalRoughMapDef, metalRoughTexture );
|
|
this.applyTextureTransform( metalRoughMapDef, metalRoughTexture );
|
|
@@ -1308,7 +1310,7 @@ class GLTFWriter {
|
|
}
|
|
}
|
|
|
|
|
|
// pbrMetallicRoughness.baseColorTexture or pbrSpecularGlossiness diffuseTexture
|
|
// pbrMetallicRoughness.baseColorTexture or pbrSpecularGlossiness diffuseTexture
|
|
- if ( material.map ) {
|
|
|
|
|
|
+ if ( material.map?.image ) {
|
|
|
|
|
|
const baseColorMapDef = { index: this.processTexture( material.map ) };
|
|
const baseColorMapDef = { index: this.processTexture( material.map ) };
|
|
this.applyTextureTransform( baseColorMapDef, material.map );
|
|
this.applyTextureTransform( baseColorMapDef, material.map );
|
|
@@ -1337,7 +1339,7 @@ class GLTFWriter {
|
|
}
|
|
}
|
|
|
|
|
|
// emissiveTexture
|
|
// emissiveTexture
|
|
- if ( material.emissiveMap ) {
|
|
|
|
|
|
+ if ( material.emissiveMap?.image ) {
|
|
|
|
|
|
const emissiveMapDef = { index: this.processTexture( material.emissiveMap ) };
|
|
const emissiveMapDef = { index: this.processTexture( material.emissiveMap ) };
|
|
this.applyTextureTransform( emissiveMapDef, material.emissiveMap );
|
|
this.applyTextureTransform( emissiveMapDef, material.emissiveMap );
|
|
@@ -1348,7 +1350,7 @@ class GLTFWriter {
|
|
}
|
|
}
|
|
|
|
|
|
// normalTexture
|
|
// normalTexture
|
|
- if ( material.normalMap ) {
|
|
|
|
|
|
+ if ( material.normalMap?.image ) {
|
|
|
|
|
|
const normalMapDef = { index: this.processTexture( material.normalMap ) };
|
|
const normalMapDef = { index: this.processTexture( material.normalMap ) };
|
|
|
|
|
|
@@ -1366,7 +1368,7 @@ class GLTFWriter {
|
|
}
|
|
}
|
|
|
|
|
|
// occlusionTexture
|
|
// occlusionTexture
|
|
- if ( material.aoMap ) {
|
|
|
|
|
|
+ if ( material.aoMap?.image ) {
|
|
|
|
|
|
const occlusionMapDef = {
|
|
const occlusionMapDef = {
|
|
index: this.processTexture( material.aoMap ),
|
|
index: this.processTexture( material.aoMap ),
|