Fix apha value

- The alpha value in materials using the Tr format must be inverted
- closes https://github.com/assimp/assimp/issues/3645
pull/3652/head
Kim Kulling 2021-02-15 11:51:20 +01:00 committed by GitHub
parent 607d474400
commit 047b45d172
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -122,8 +122,8 @@ void ObjFileMtlImporter::load() {
{
++m_DataIt;
getColorRGBA(&m_pModel->m_pCurrentMaterial->ambient);
} else if (*m_DataIt == 'd') // Diffuse color
{
} else if (*m_DataIt == 'd') {
// Diffuse color
++m_DataIt;
getColorRGBA(&m_pModel->m_pCurrentMaterial->diffuse);
} else if (*m_DataIt == 's') {
@ -144,7 +144,9 @@ void ObjFileMtlImporter::load() {
} else if (*m_DataIt == 'r') {
// Material transmission alpha value
++m_DataIt;
getFloatValue(m_pModel->m_pCurrentMaterial->alpha);
ai_real d;
getFloatValue(d);
m_pModel->m_pCurrentMaterial->alpha = static_cast<ai_real>(1.0) - d;
}
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
} break;