Merge pull request #5170 from vulcanozz/vulcano/export_gltf2_with_roughness_texture
Add DIFFUSE_ROUGHNESS_TEXTURE for gltf2 exporterpull/5216/head^2
commit
f623870dd1
|
@ -836,7 +836,17 @@ void glTF2Exporter::ExportMaterials() {
|
||||||
GetMatTex(mat, m->pbrMetallicRoughness.baseColorTexture, aiTextureType_DIFFUSE);
|
GetMatTex(mat, m->pbrMetallicRoughness.baseColorTexture, aiTextureType_DIFFUSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetMatTex(mat, m->pbrMetallicRoughness.metallicRoughnessTexture, aiTextureType_DIFFUSE_ROUGHNESS);
|
||||||
|
|
||||||
|
if (!m->pbrMetallicRoughness.metallicRoughnessTexture.texture) {
|
||||||
|
// if there wasn't a aiTextureType_DIFFUSE_ROUGHNESS defined in the source, fallback to aiTextureType_METALNESS
|
||||||
|
GetMatTex(mat, m->pbrMetallicRoughness.metallicRoughnessTexture, aiTextureType_METALNESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m->pbrMetallicRoughness.metallicRoughnessTexture.texture) {
|
||||||
|
// if there still wasn't a aiTextureType_METALNESS defined in the source, fallback to AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE
|
||||||
GetMatTex(mat, m->pbrMetallicRoughness.metallicRoughnessTexture, AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE);
|
GetMatTex(mat, m->pbrMetallicRoughness.metallicRoughnessTexture, AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE);
|
||||||
|
}
|
||||||
|
|
||||||
if (GetMatColor(mat, m->pbrMetallicRoughness.baseColorFactor, AI_MATKEY_BASE_COLOR) != AI_SUCCESS) {
|
if (GetMatColor(mat, m->pbrMetallicRoughness.baseColorFactor, AI_MATKEY_BASE_COLOR) != AI_SUCCESS) {
|
||||||
// if baseColorFactor wasn't defined, then the source is likely not a metallic roughness material.
|
// if baseColorFactor wasn't defined, then the source is likely not a metallic roughness material.
|
||||||
|
|
Loading…
Reference in New Issue