From d75c5ec7baaae61d448c293040f19c8b49b06780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilles=20Roudi=C3=A8re?= Date: Tue, 11 Jun 2024 12:59:55 +0200 Subject: Implement multiple occlusion polygons within each TileSet occlusion layer --- scene/resources/2d/tile_set.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'scene/resources/2d/tile_set.h') diff --git a/scene/resources/2d/tile_set.h b/scene/resources/2d/tile_set.h index 51df972c8d..931495d020 100644 --- a/scene/resources/2d/tile_set.h +++ b/scene/resources/2d/tile_set.h @@ -841,8 +841,11 @@ private: int z_index = 0; int y_sort_origin = 0; struct OcclusionLayerTileData { - Ref occluder; - mutable HashMap> transformed_occluders; + struct PolygonOccluderTileData { + Ref occluder_polygon; + mutable HashMap> transformed_polygon_occluders; + }; + Vector polygons; }; Vector occluders; @@ -941,8 +944,17 @@ public: void set_y_sort_origin(int p_y_sort_origin); int get_y_sort_origin() const; +#ifndef DISABLE_DEPRECATED void set_occluder(int p_layer_id, Ref p_occluder_polygon); Ref get_occluder(int p_layer_id, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false) const; +#endif // DISABLE_DEPRECATED + + void set_occluder_polygons_count(int p_layer_id, int p_polygons_count); + int get_occluder_polygons_count(int p_layer_id) const; + void add_occluder_polygon(int p_layer_id); + void remove_occluder_polygon(int p_layer_id, int p_polygon_index); + void set_occluder_polygon(int p_layer_id, int p_polygon_index, const Ref &p_occluder_polygon); + Ref get_occluder_polygon(int p_layer_id, int p_polygon_index, bool p_flip_h = false, bool p_flip_v = false, bool p_transpose = false) const; // Physics void set_constant_linear_velocity(int p_layer_id, const Vector2 &p_velocity); -- cgit v1.2.3