diff options
author | wojtekpil <wojtek.piliszek@gmail.com> | 2023-07-08 22:56:11 +0200 |
---|---|---|
committer | wojtekpil <wojtek.piliszek@gmail.com> | 2023-07-13 15:30:30 +0200 |
commit | a875baa218460791d3679e5af452fe1e2f7bb48b (patch) | |
tree | 51df17766f5273ddbc8b9a713dfeb2a462941311 /modules/gltf/gltf_document.cpp | |
parent | 60f3b7967cbd00b4e1f52d33d372646f7bec02f6 (diff) | |
download | redot-engine-a875baa218460791d3679e5af452fe1e2f7bb48b.tar.gz |
Add KHR_materials_emissive_strength extension support for exporting gltfs
Diffstat (limited to 'modules/gltf/gltf_document.cpp')
-rw-r--r-- | modules/gltf/gltf_document.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 0bbc2bbf74..368f945f96 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -3769,6 +3769,12 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> p_state) { extensions["KHR_materials_unlit"] = mat_unlit; p_state->add_used_extension("KHR_materials_unlit"); } + if (base_material->get_feature(BaseMaterial3D::FEATURE_EMISSION) && !Math::is_equal_approx(base_material->get_emission_energy_multiplier(), 1.0f)) { + Dictionary mat_emissive_strength; + mat_emissive_strength["emissiveStrength"] = base_material->get_emission_energy_multiplier(); + extensions["KHR_materials_emissive_strength"] = mat_emissive_strength; + p_state->add_used_extension("KHR_materials_emissive_strength"); + } d["extensions"] = extensions; materials.push_back(d); |