summaryrefslogtreecommitdiff
path: root/modules/raycast
diff options
context:
space:
mode:
authorjfons <joan.fonssanchez@gmail.com>2022-02-04 16:28:18 +0100
committerjfons <joan.fonssanchez@gmail.com>2022-02-07 13:04:51 +0100
commitdd970482c5961278034fde5fb2961e31c543e9ae (patch)
tree1cc0738558989993553c671f08bb5235d4a32ccd /modules/raycast
parent6f425242dcce95ae9993dca017f91e7bab2060d3 (diff)
Improvements and fixes to occluders
Improvements: * Occluder3D is now an abstract type inherited by: ArrayOccluder3D, QuadOccluder3D, BoxOccluder3D, SphereOccluder3D and PolygonOccluder3D. ArrayOccluder3D serves the same purpose as the old Occluder3D (triangle mesh occluder) while the rest are primitives that can be used to manually place simple occluders. * Occluder baking can now apply simplification. The "bake_simplification_distance" property can be used to set a world-space distance as the desired maximum error, set to 0.1 by default. * Occluders can now be generated on import. Using the "occ" and "occonly" keywords (similar to "col" and "colonly" for colliders) or by enabling on MeshInstance3Ds in the scene's import window. Fixes: * Fixed saving of occluder files after bake. * Fixed a small error where occluders didn't correctly update in the rendering server. Bonus content: * Generalized "CollisionPolygon3DEditor" so it can also be used to edit Resources. Renamed it to "Polygon3DEditor" since it was already being used by other things, not just colliders. * Fixed a small bug in "EditorPropertyArray" where a call to "remove" was left after the "remove_at" rename.
Diffstat (limited to 'modules/raycast')
-rw-r--r--modules/raycast/raycast_occlusion_cull.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/raycast/raycast_occlusion_cull.cpp b/modules/raycast/raycast_occlusion_cull.cpp
index dd5eef8b2b..2e0d17fb28 100644
--- a/modules/raycast/raycast_occlusion_cull.cpp
+++ b/modules/raycast/raycast_occlusion_cull.cpp
@@ -270,13 +270,14 @@ void RaycastOcclusionCull::scenario_set_instance(RID p_scenario, RID p_instance,
OccluderInstance &instance = scenario.instances[p_instance];
+ bool changed = false;
+
if (instance.removed) {
instance.removed = false;
scenario.removed_instances.erase(p_instance);
+ changed = true; // It was removed and re-added, we might have missed some changes
}
- bool changed = false;
-
if (instance.occluder != p_occluder) {
Occluder *old_occluder = occluder_owner.get_or_null(instance.occluder);
if (old_occluder) {