diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-01-03 11:14:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-03 11:14:46 +0100 |
commit | da625654e53bb10dce46204621ccfe0e619a38cc (patch) | |
tree | 98337fd067e59d80785cbd08e6f73b3c0a5cc594 | |
parent | 2ee6f42759f8617781458f46cf64b5d97f63d8a8 (diff) | |
parent | f028b8b0e4d129cdfe621a09cad2e85f2019532d (diff) |
Merge pull request #34760 from fire/gltf2-scissors
Support GLTF2 alpha scissors.
-rw-r--r-- | editor/import/editor_scene_importer_gltf.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 4949d1a4e5..f5128103f3 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1479,9 +1479,16 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) { if (d.has("alphaMode")) { const String &am = d["alphaMode"]; - if (am != "OPAQUE") { + if (am == "BLEND") { material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true); material->set_depth_draw_mode(SpatialMaterial::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS); + } else if (am == "MASK") { + material->set_flag(SpatialMaterial::FLAG_USE_ALPHA_SCISSOR, true); + if (d.has("alphaCutoff")) { + material->set_alpha_scissor_threshold(d["alphaCutoff"]); + } else { + material->set_alpha_scissor_threshold(0.5f); + } } } |