diff --git a/code/glTFAsset.inl b/code/glTFAsset.inl index b9f3fccd8..64966fb28 100644 --- a/code/glTFAsset.inl +++ b/code/glTFAsset.inl @@ -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); } diff --git a/code/glTFAssetWriter.inl b/code/glTFAssetWriter.inl index 119ebc937..af27604f2 100644 --- a/code/glTFAssetWriter.inl +++ b/code/glTFAssetWriter.inl @@ -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); diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index 708570577..8f37452b1 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -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); } }