From 762ad8e9b7d8749c17dedd3e0b9a32b933949e8f Mon Sep 17 00:00:00 2001 From: Alexey Medvedev Date: Sat, 25 Nov 2023 16:30:55 -0800 Subject: [PATCH] glTF KHR_materials_specular fixes --- code/AssetLib/glTF2/glTF2AssetWriter.inl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.inl b/code/AssetLib/glTF2/glTF2AssetWriter.inl index 30f2580a2..bfd9135d3 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.inl +++ b/code/AssetLib/glTF2/glTF2AssetWriter.inl @@ -426,13 +426,14 @@ namespace glTF2 { if (specular.specularFactor != 0.0f) { WriteFloat(materialSpecular, specular.specularFactor, "specularFactor", w.mAl); - WriteTex(materialSpecular, specular.specularTexture, "specularTexture", w.mAl); } if (specular.specularColorFactor[0] != defaultSpecularColorFactor[0] && specular.specularColorFactor[1] != defaultSpecularColorFactor[1] && specular.specularColorFactor[2] != defaultSpecularColorFactor[2]) { WriteVec(materialSpecular, specular.specularColorFactor, "specularColorFactor", w.mAl); - WriteTex(materialSpecular, specular.specularColorTexture, "specularColorTexture", w.mAl); } + WriteTex(materialSpecular, specular.specularTexture, "specularTexture", w.mAl); + WriteTex(materialSpecular, specular.specularColorTexture, "specularColorTexture", w.mAl); + if (!materialSpecular.ObjectEmpty()) { exts.AddMember("KHR_materials_specular", materialSpecular, w.mAl); }