diff options
author | jfons <joan.fonssanchez@gmail.com> | 2021-11-12 12:11:57 +0100 |
---|---|---|
committer | jfons <joan.fonssanchez@gmail.com> | 2021-11-12 12:11:57 +0100 |
commit | dbf20f58a0b16535361a0e57e814746c68ffe190 (patch) | |
tree | 03699f43e65911096865004f21152f58e6fba685 /servers | |
parent | 55b49dc71b687b9edf640ae2264879852f0b0503 (diff) |
Fix transparency state initialization
Diffstat (limited to 'servers')
-rw-r--r-- | servers/rendering/renderer_scene_cull.cpp | 3 | ||||
-rw-r--r-- | servers/rendering/renderer_scene_cull.h | 15 |
2 files changed, 11 insertions, 7 deletions
diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index e338e526a0..7b4e2d34df 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -644,6 +644,7 @@ void RendererSceneCull::instance_set_base(RID p_instance, RID p_base) { scene_render->geometry_instance_set_use_dynamic_gi(geom->geometry_instance, instance->dynamic_gi); scene_render->geometry_instance_set_cast_double_sided_shadows(geom->geometry_instance, instance->cast_shadows == RS::SHADOW_CASTING_SETTING_DOUBLE_SIDED); scene_render->geometry_instance_set_use_lightmap(geom->geometry_instance, RID(), instance->lightmap_uv_scale, instance->lightmap_slice_index); + scene_render->geometry_instance_set_transparency(geom->geometry_instance, instance->transparency); if (instance->lightmap_sh.size() == 9) { scene_render->geometry_instance_set_lightmap_capture(geom->geometry_instance, instance->lightmap_sh.ptr()); } @@ -839,6 +840,8 @@ void RendererSceneCull::instance_geometry_set_transparency(RID p_instance, float Instance *instance = instance_owner.get_or_null(p_instance); ERR_FAIL_COND(!instance); + instance->transparency = p_transparency; + if ((1 << instance->base_type) & RS::INSTANCE_GEOMETRY_MASK && instance->base_data) { InstanceGeometryData *geom = static_cast<InstanceGeometryData *>(instance->base_data); scene_render->geometry_instance_set_transparency(geom->geometry_instance, p_transparency); diff --git a/servers/rendering/renderer_scene_cull.h b/servers/rendering/renderer_scene_cull.h index de22bc1328..2bfcfd462c 100644 --- a/servers/rendering/renderer_scene_cull.h +++ b/servers/rendering/renderer_scene_cull.h @@ -439,17 +439,18 @@ public: RID self; //scenario stuff DynamicBVH::ID indexer_id; - int32_t array_index; + int32_t array_index = -1; int32_t visibility_index = -1; - float visibility_range_begin; - float visibility_range_end; - float visibility_range_begin_margin; - float visibility_range_end_margin; + float visibility_range_begin = 0.0f; + float visibility_range_end = 0.0f; + float visibility_range_begin_margin = 0.0f; + float visibility_range_end_margin = 0.0f; RS::VisibilityRangeFadeMode visibility_range_fade_mode = RS::VISIBILITY_RANGE_FADE_DISABLED; Instance *visibility_parent = nullptr; Set<Instance *> visibility_dependencies; - uint32_t visibility_dependencies_depth; - Scenario *scenario; + uint32_t visibility_dependencies_depth = 0; + float transparency = 0.0f; + Scenario *scenario = nullptr; SelfList<Instance> scenario_item; //aabb stuff |