Manually read alphaMode material property

pull/1423/head
John Senneker 2017-09-12 11:55:52 -04:00
parent eca008d5ec
commit 933bbb4f1c
1 changed files with 15 additions and 2 deletions

View File

@ -424,7 +424,20 @@ void glTF2Exporter::ExportMaterials()
mat->Get(AI_MATKEY_TWOSIDED, m->doubleSided); mat->Get(AI_MATKEY_TWOSIDED, m->doubleSided);
mat->Get(AI_MATKEY_GLTF_ALPHACUTOFF, m->alphaCutoff); mat->Get(AI_MATKEY_GLTF_ALPHACUTOFF, m->alphaCutoff);
if (mat->Get(AI_MATKEY_GLTF_ALPHAMODE, m->alphaMode) != AI_SUCCESS) { bool foundAlphaMode = false;
for (size_t i = 0; i < mat->mNumProperties; ++i) {
aiMaterialProperty *prop = mat->mProperties[i];
if (prop->mKey != aiString("$mat.gltf.alphaMode"))
continue;
std::string alphaMode;
for (size_t c = 0; c < prop->mDataLength; ++c)
alphaMode += prop->mData[c];
m->alphaMode = alphaMode;
foundAlphaMode = true;
}
if (!foundAlphaMode) {
float opacity; float opacity;
if (mat->Get(AI_MATKEY_OPACITY, opacity) == AI_SUCCESS) { if (mat->Get(AI_MATKEY_OPACITY, opacity) == AI_SUCCESS) {
@ -435,7 +448,7 @@ void glTF2Exporter::ExportMaterials()
} }
} }
bool hasPbrSpecularGlossiness; bool hasPbrSpecularGlossiness = false;
mat->Get(AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS, hasPbrSpecularGlossiness); mat->Get(AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS, hasPbrSpecularGlossiness);
if (hasPbrSpecularGlossiness) { if (hasPbrSpecularGlossiness) {