Merge branch 'master' into issue_4042

pull/4045/head
Kim Kulling 2021-08-24 19:24:16 +02:00 committed by GitHub
commit fe31ac295c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -233,12 +233,12 @@ void M3DImporter::importMaterials(const M3DWrapper &m3d) {
ASSIMP_LOG_DEBUG("M3D: importMaterials ", mScene->mNumMaterials); ASSIMP_LOG_DEBUG("M3D: importMaterials ", mScene->mNumMaterials);
// add a default material as first // add a default material as first
aiMaterial *mat = new aiMaterial; aiMaterial *defaultMat = new aiMaterial;
mat->AddProperty(&name, AI_MATKEY_NAME); defaultMat->AddProperty(&name, AI_MATKEY_NAME);
c.a = 1.0f; c.a = 1.0f;
c.b = c.g = c.r = 0.6f; c.b = c.g = c.r = 0.6f;
mat->AddProperty(&c, 1, AI_MATKEY_COLOR_DIFFUSE); defaultMat->AddProperty(&c, 1, AI_MATKEY_COLOR_DIFFUSE);
mScene->mMaterials[0] = mat; mScene->mMaterials[0] = defaultMat;
if (!m3d->nummaterial || !m3d->material) { if (!m3d->nummaterial || !m3d->material) {
return; return;
@ -300,12 +300,12 @@ void M3DImporter::importMaterials(const M3DWrapper &m3d) {
m->prop[j].value.textureid < m3d->numtexture && m->prop[j].value.textureid < m3d->numtexture &&
m3d->texture[m->prop[j].value.textureid].name) { m3d->texture[m->prop[j].value.textureid].name) {
name.Set(std::string(std::string(m3d->texture[m->prop[j].value.textureid].name) + ".png")); name.Set(std::string(std::string(m3d->texture[m->prop[j].value.textureid].name) + ".png"));
mat->AddProperty(&name, aiTxProps[k].pKey, aiTxProps[k].type, aiTxProps[k].index); newMat->AddProperty(&name, aiTxProps[k].pKey, aiTxProps[k].type, aiTxProps[k].index);
n = 0; n = 0;
mat->AddProperty(&n, 1, _AI_MATKEY_UVWSRC_BASE, aiProps[k].type, aiProps[k].index); newMat->AddProperty(&n, 1, _AI_MATKEY_UVWSRC_BASE, aiProps[k].type, aiProps[k].index);
} }
} }
mScene->mMaterials[i + 1] = mat; mScene->mMaterials[i + 1] = newMat;
} }
} }