mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Ported: Add debug_canvas_item_get_local_bound() function to VisualServer
Useful for debugging hierarchical culling.
- lawnjelly
61e41cc9a1
This commit is contained in:
parent
d977ed360e
commit
17fa82ac02
@ -796,6 +796,14 @@
|
|||||||
Modulates all colors in the given canvas.
|
Modulates all colors in the given canvas.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="debug_canvas_item_get_local_bound">
|
||||||
|
<return type="Rect2" />
|
||||||
|
<argument index="0" name="item" type="RID" />
|
||||||
|
<description>
|
||||||
|
Returns the bounding rectangle for a canvas item and its descendants in local space, as calculated by the renderer. This bound is used internally for culling.
|
||||||
|
[b]Warning:[/b] This function is intended for debugging in the editor, and will pass through and return a zero [Rect2] in exported projects.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="debug_canvas_item_get_rect">
|
<method name="debug_canvas_item_get_rect">
|
||||||
<return type="Rect2" />
|
<return type="Rect2" />
|
||||||
<argument index="0" name="item" type="RID" />
|
<argument index="0" name="item" type="RID" />
|
||||||
|
@ -1466,6 +1466,12 @@ Rect2 RenderingServerCanvas::_debug_canvas_item_get_rect(RID p_item) {
|
|||||||
return canvas_item->get_rect();
|
return canvas_item->get_rect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect2 RenderingServerCanvas::_debug_canvas_item_get_local_bound(RID p_item) {
|
||||||
|
Item *canvas_item = canvas_item_owner.getornull(p_item);
|
||||||
|
ERR_FAIL_COND_V(!canvas_item, Rect2());
|
||||||
|
return canvas_item->local_bound;
|
||||||
|
}
|
||||||
|
|
||||||
void RenderingServerCanvas::canvas_item_set_skeleton_relative_xform(RID p_item, Transform2D p_relative_xform) {
|
void RenderingServerCanvas::canvas_item_set_skeleton_relative_xform(RID p_item, Transform2D p_relative_xform) {
|
||||||
Item *canvas_item = canvas_item_owner.getornull(p_item);
|
Item *canvas_item = canvas_item_owner.getornull(p_item);
|
||||||
ERR_FAIL_COND(!canvas_item);
|
ERR_FAIL_COND(!canvas_item);
|
||||||
@ -2200,7 +2206,7 @@ void RenderingServerCanvas::tick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RenderingServerCanvas::update_interpolation_tick(bool p_process) {
|
void RenderingServerCanvas::update_interpolation_tick(bool p_process) {
|
||||||
#define PANDEMONIUM_UPDATE_INTERPOLATION_TICK(LIST_PREV, LIST_CURR, TYPE, OWNER_LIST) \
|
#define PANDEMONIUM_UPDATE_INTERPOLATION_TICK(LIST_PREV, LIST_CURR, TYPE, OWNER_LIST) \
|
||||||
/* Detect any that were on the previous transform list that are no longer active. */ \
|
/* Detect any that were on the previous transform list that are no longer active. */ \
|
||||||
for (unsigned int n = 0; n < _interpolation_data.LIST_PREV->size(); n++) { \
|
for (unsigned int n = 0; n < _interpolation_data.LIST_PREV->size(); n++) { \
|
||||||
const RID &rid = (*_interpolation_data.LIST_PREV)[n]; \
|
const RID &rid = (*_interpolation_data.LIST_PREV)[n]; \
|
||||||
@ -2268,8 +2274,6 @@ void RenderingServerCanvas::InterpolationData::notify_free_canvas_light_occluder
|
|||||||
canvas_light_occluder_transform_update_list_prev->erase_multiple_unordered(p_rid);
|
canvas_light_occluder_transform_update_list_prev->erase_multiple_unordered(p_rid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RenderingServerCanvas::RenderingServerCanvas() {
|
RenderingServerCanvas::RenderingServerCanvas() {
|
||||||
_canvas_cull_mode = CANVAS_CULL_MODE_NODE;
|
_canvas_cull_mode = CANVAS_CULL_MODE_NODE;
|
||||||
|
|
||||||
|
@ -259,6 +259,7 @@ public:
|
|||||||
void _canvas_item_skeleton_moved(RID p_item);
|
void _canvas_item_skeleton_moved(RID p_item);
|
||||||
void canvas_item_set_skeleton_relative_xform(RID p_item, Transform2D p_relative_xform);
|
void canvas_item_set_skeleton_relative_xform(RID p_item, Transform2D p_relative_xform);
|
||||||
Rect2 _debug_canvas_item_get_rect(RID p_item);
|
Rect2 _debug_canvas_item_get_rect(RID p_item);
|
||||||
|
Rect2 _debug_canvas_item_get_local_bound(RID p_item);
|
||||||
|
|
||||||
void canvas_item_set_interpolated(RID p_item, bool p_interpolated);
|
void canvas_item_set_interpolated(RID p_item, bool p_interpolated);
|
||||||
void canvas_item_reset_physics_interpolation(RID p_item);
|
void canvas_item_reset_physics_interpolation(RID p_item);
|
||||||
|
@ -623,6 +623,7 @@ public:
|
|||||||
BIND2(canvas_item_attach_skeleton, RID, RID)
|
BIND2(canvas_item_attach_skeleton, RID, RID)
|
||||||
BIND2(canvas_item_set_skeleton_relative_xform, RID, Transform2D)
|
BIND2(canvas_item_set_skeleton_relative_xform, RID, Transform2D)
|
||||||
BIND1R(Rect2, _debug_canvas_item_get_rect, RID)
|
BIND1R(Rect2, _debug_canvas_item_get_rect, RID)
|
||||||
|
BIND1R(Rect2, _debug_canvas_item_get_local_bound, RID)
|
||||||
|
|
||||||
BIND2(canvas_item_set_interpolated, RID, bool)
|
BIND2(canvas_item_set_interpolated, RID, bool)
|
||||||
BIND1(canvas_item_reset_physics_interpolation, RID)
|
BIND1(canvas_item_reset_physics_interpolation, RID)
|
||||||
|
@ -531,6 +531,7 @@ public:
|
|||||||
FUNC2(canvas_item_attach_skeleton, RID, RID)
|
FUNC2(canvas_item_attach_skeleton, RID, RID)
|
||||||
FUNC2(canvas_item_set_skeleton_relative_xform, RID, Transform2D)
|
FUNC2(canvas_item_set_skeleton_relative_xform, RID, Transform2D)
|
||||||
FUNC1R(Rect2, _debug_canvas_item_get_rect, RID)
|
FUNC1R(Rect2, _debug_canvas_item_get_rect, RID)
|
||||||
|
FUNC1R(Rect2, _debug_canvas_item_get_local_bound, RID)
|
||||||
|
|
||||||
FUNC2(canvas_item_set_interpolated, RID, bool)
|
FUNC2(canvas_item_set_interpolated, RID, bool)
|
||||||
FUNC1(canvas_item_reset_physics_interpolation, RID)
|
FUNC1(canvas_item_reset_physics_interpolation, RID)
|
||||||
|
@ -2141,6 +2141,7 @@ void RenderingServer::_bind_methods() {
|
|||||||
ClassDB::bind_method(D_METHOD("canvas_item_set_material", "item", "material"), &RenderingServer::canvas_item_set_material);
|
ClassDB::bind_method(D_METHOD("canvas_item_set_material", "item", "material"), &RenderingServer::canvas_item_set_material);
|
||||||
ClassDB::bind_method(D_METHOD("canvas_item_set_use_parent_material", "item", "enabled"), &RenderingServer::canvas_item_set_use_parent_material);
|
ClassDB::bind_method(D_METHOD("canvas_item_set_use_parent_material", "item", "enabled"), &RenderingServer::canvas_item_set_use_parent_material);
|
||||||
ClassDB::bind_method(D_METHOD("debug_canvas_item_get_rect", "item"), &RenderingServer::debug_canvas_item_get_rect);
|
ClassDB::bind_method(D_METHOD("debug_canvas_item_get_rect", "item"), &RenderingServer::debug_canvas_item_get_rect);
|
||||||
|
ClassDB::bind_method(D_METHOD("debug_canvas_item_get_local_bound", "item"), &RenderingServer::debug_canvas_item_get_local_bound);
|
||||||
ClassDB::bind_method(D_METHOD("canvas_light_create"), &RenderingServer::canvas_light_create);
|
ClassDB::bind_method(D_METHOD("canvas_light_create"), &RenderingServer::canvas_light_create);
|
||||||
ClassDB::bind_method(D_METHOD("canvas_light_attach_to_canvas", "light", "canvas"), &RenderingServer::canvas_light_attach_to_canvas);
|
ClassDB::bind_method(D_METHOD("canvas_light_attach_to_canvas", "light", "canvas"), &RenderingServer::canvas_light_attach_to_canvas);
|
||||||
ClassDB::bind_method(D_METHOD("canvas_light_set_enabled", "light", "enabled"), &RenderingServer::canvas_light_set_enabled);
|
ClassDB::bind_method(D_METHOD("canvas_light_set_enabled", "light", "enabled"), &RenderingServer::canvas_light_set_enabled);
|
||||||
|
@ -950,14 +950,16 @@ public:
|
|||||||
virtual void canvas_item_attach_skeleton(RID p_item, RID p_skeleton) = 0;
|
virtual void canvas_item_attach_skeleton(RID p_item, RID p_skeleton) = 0;
|
||||||
virtual void canvas_item_set_skeleton_relative_xform(RID p_item, Transform2D p_relative_xform) = 0;
|
virtual void canvas_item_set_skeleton_relative_xform(RID p_item, Transform2D p_relative_xform) = 0;
|
||||||
|
|
||||||
Rect2 debug_canvas_item_get_rect(RID p_item) {
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
return _debug_canvas_item_get_rect(p_item);
|
Rect2 debug_canvas_item_get_rect(RID p_item) { return _debug_canvas_item_get_rect(p_item); }
|
||||||
|
Rect2 debug_canvas_item_get_local_bound(RID p_item) { return _debug_canvas_item_get_local_bound(p_item); }
|
||||||
#else
|
#else
|
||||||
return Rect2();
|
Rect2 debug_canvas_item_get_rect(RID p_item) { return Rect2(); }
|
||||||
|
Rect2 debug_canvas_item_get_local_bound(RID p_item) { return Rect2(); }
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
virtual Rect2 _debug_canvas_item_get_rect(RID p_item) = 0;
|
virtual Rect2 _debug_canvas_item_get_rect(RID p_item) = 0;
|
||||||
|
virtual Rect2 _debug_canvas_item_get_local_bound(RID p_item) = 0;
|
||||||
|
|
||||||
virtual void canvas_item_set_interpolated(RID p_item, bool p_interpolated) = 0;
|
virtual void canvas_item_set_interpolated(RID p_item, bool p_interpolated) = 0;
|
||||||
virtual void canvas_item_reset_physics_interpolation(RID p_item) = 0;
|
virtual void canvas_item_reset_physics_interpolation(RID p_item) = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user