diff options
author | K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com> | 2020-01-02 11:52:08 -0800 |
---|---|---|
committer | K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com> | 2020-01-02 11:52:08 -0800 |
commit | f028b8b0e4d129cdfe621a09cad2e85f2019532d (patch) | |
tree | fe386aabfe2c91f02641298b90599d45170e332e | |
parent | dc2e4cc804ecf0566d98f8ca54f110df65682c12 (diff) |
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); + } } } |