1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-30 16:26:50 +00:00

Canvas item hierarchical culling

Adds optional hierarchical culling to the 2D rendering (within VisualServer).

Each canvas item maintains a bound in local space of the item itself and all child / grandchild items. This allows branches to be culled at once when they don't intersect a viewport.
This commit is contained in:
lawnjelly
2022-11-09 15:53:23 +00:00
parent 15c729e1d9
commit b777a9e5f9
19 changed files with 858 additions and 20 deletions

View File

@@ -449,6 +449,7 @@ public:
virtual Transform2D skeleton_bone_get_transform_2d(RID p_skeleton, int p_bone) const = 0;
virtual void skeleton_set_base_transform_2d(RID p_skeleton, const Transform2D &p_base_transform) = 0;
virtual uint32_t skeleton_get_revision(RID p_skeleton) const = 0;
virtual void skeleton_attach_canvas_item(RID p_skeleton, RID p_canvas_item, bool p_attach) = 0;
/* Light API */
@@ -985,6 +986,7 @@ public:
bool light_masked : 1;
mutable bool custom_rect : 1;
mutable bool rect_dirty : 1;
mutable bool bound_dirty : 1;
Vector<Command *> commands;
mutable Rect2 rect;
@@ -1024,6 +1026,10 @@ public:
void precalculate_polygon_bone_bounds(const Item::CommandPolygon &p_polygon) const;
public:
// the rect containing this item and all children,
// in local space.
Rect2 local_bound;
const Rect2 &get_rect() const {
if (custom_rect) {
return rect;
@@ -1201,6 +1207,7 @@ public:
final_modulate = Color(1, 1, 1, 1);
visible = true;
rect_dirty = true;
bound_dirty = true;
custom_rect = false;
behind = false;
material_owner = nullptr;