Merge pull request #34760 from fire/gltf2-scissors
Support GLTF2 alpha scissors.
This commit is contained in:
commit
da625654e5
1 changed files with 8 additions and 1 deletions
|
@ -1479,9 +1479,16 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
|
||||||
|
|
||||||
if (d.has("alphaMode")) {
|
if (d.has("alphaMode")) {
|
||||||
const String &am = d["alphaMode"];
|
const String &am = d["alphaMode"];
|
||||||
if (am != "OPAQUE") {
|
if (am == "BLEND") {
|
||||||
material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||||
material->set_depth_draw_mode(SpatialMaterial::DEPTH_DRAW_ALPHA_OPAQUE_PREPASS);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue