Manually read alphaMode material property
parent
eca008d5ec
commit
933bbb4f1c
|
@ -424,7 +424,20 @@ void glTF2Exporter::ExportMaterials()
|
|||
mat->Get(AI_MATKEY_TWOSIDED, m->doubleSided);
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
if (hasPbrSpecularGlossiness) {
|
||||
|
|
Loading…
Reference in New Issue