glTF: Read and write transparency values
parent
38cbdcd885
commit
83c0163ec6
|
@ -696,6 +696,7 @@ inline void Material::Read(Value& material, Asset& r)
|
|||
ReadMaterialProperty(r, *values, "diffuse", this->diffuse);
|
||||
ReadMaterialProperty(r, *values, "specular", this->specular);
|
||||
|
||||
ReadMember(*values, "transparency", transparency);
|
||||
ReadMember(*values, "shininess", shininess);
|
||||
}
|
||||
|
||||
|
|
|
@ -171,6 +171,9 @@ namespace glTF {
|
|||
WriteColorOrTex(v, m.specular, "specular", w.mAl);
|
||||
WriteColorOrTex(v, m.emission, "emission", w.mAl);
|
||||
|
||||
if (m.transparent)
|
||||
v.AddMember("transparency", m.transparency, w.mAl);
|
||||
|
||||
v.AddMember("shininess", m.shininess, w.mAl);
|
||||
}
|
||||
obj.AddMember("values", v, w.mAl);
|
||||
|
|
|
@ -274,6 +274,8 @@ void glTFExporter::ExportMaterials()
|
|||
GetMatColorOrTex(mat, m->specular, AI_MATKEY_COLOR_SPECULAR, aiTextureType_SPECULAR);
|
||||
GetMatColorOrTex(mat, m->emission, AI_MATKEY_COLOR_EMISSIVE, aiTextureType_EMISSIVE);
|
||||
|
||||
m->transparent = mat->Get(AI_MATKEY_OPACITY, m->transparency) == aiReturn_SUCCESS && m->transparency != 1.0;
|
||||
|
||||
GetMatScalar(mat, m->shininess, AI_MATKEY_SHININESS);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue