mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Implement 2D instance shader parameters
Co-authored-by: kobewi <kobewi4e@gmail.com> Co-authored-by: yesfish <huwpascoe@users.noreply.github.com> Co-authored-by: Álex Román Núñez <eirexe123@gmail.com>
This commit is contained in:
@@ -34,11 +34,16 @@
|
||||
#include "core/templates/paged_allocator.h"
|
||||
#include "renderer_compositor.h"
|
||||
#include "renderer_viewport.h"
|
||||
#include "servers/rendering/instance_uniforms.h"
|
||||
|
||||
class RendererCanvasCull {
|
||||
static void _dependency_changed(Dependency::DependencyChangedNotification p_notification, DependencyTracker *p_tracker);
|
||||
static void _dependency_deleted(const RID &p_dependency, DependencyTracker *p_tracker);
|
||||
|
||||
public:
|
||||
struct Item : public RendererCanvasRender::Item {
|
||||
RID parent; // canvas it belongs to
|
||||
RID self;
|
||||
List<Item *>::Element *E;
|
||||
int z_index;
|
||||
bool z_relative;
|
||||
@@ -71,7 +76,14 @@ public:
|
||||
|
||||
VisibilityNotifierData *visibility_notifier = nullptr;
|
||||
|
||||
Item() {
|
||||
DependencyTracker dependency_tracker;
|
||||
InstanceUniforms instance_uniforms;
|
||||
SelfList<Item> update_item;
|
||||
|
||||
bool update_dependencies = false;
|
||||
|
||||
Item() :
|
||||
update_item(this) {
|
||||
children_order_dirty = true;
|
||||
E = nullptr;
|
||||
z_index = 0;
|
||||
@@ -85,9 +97,16 @@ public:
|
||||
ysort_xform = Transform2D();
|
||||
ysort_index = 0;
|
||||
ysort_parent_abs_z_index = 0;
|
||||
|
||||
dependency_tracker.userdata = this;
|
||||
dependency_tracker.changed_callback = &RendererCanvasCull::_dependency_changed;
|
||||
dependency_tracker.deleted_callback = &RendererCanvasCull::_dependency_deleted;
|
||||
}
|
||||
};
|
||||
|
||||
void _item_queue_update(Item *p_item, bool p_update_dependencies);
|
||||
SelfList<Item>::List _item_update_list;
|
||||
|
||||
struct ItemIndexSort {
|
||||
_FORCE_INLINE_ bool operator()(const Item *p_left, const Item *p_right) const {
|
||||
return p_left->index < p_right->index;
|
||||
@@ -267,6 +286,11 @@ public:
|
||||
|
||||
void canvas_item_set_use_parent_material(RID p_item, bool p_enable);
|
||||
|
||||
void canvas_item_set_instance_shader_parameter(RID p_item, const StringName &p_parameter, const Variant &p_value);
|
||||
void canvas_item_get_instance_shader_parameter_list(RID p_item, List<PropertyInfo> *p_parameters) const;
|
||||
Variant canvas_item_get_instance_shader_parameter(RID p_item, const StringName &p_parameter) const;
|
||||
Variant canvas_item_get_instance_shader_parameter_default_value(RID p_item, const StringName &p_parameter) const;
|
||||
|
||||
void canvas_item_set_visibility_notifier(RID p_item, bool p_enable, const Rect2 &p_area, const Callable &p_enter_callable, const Callable &p_exit_callable);
|
||||
|
||||
void canvas_item_set_canvas_group_mode(RID p_item, RS::CanvasGroupMode p_mode, float p_clear_margin = 5.0, bool p_fit_empty = false, float p_fit_margin = 0.0, bool p_blur_mipmaps = false);
|
||||
@@ -281,6 +305,8 @@ public:
|
||||
RID canvas_light_allocate();
|
||||
void canvas_light_initialize(RID p_rid);
|
||||
|
||||
void update();
|
||||
|
||||
void canvas_light_set_mode(RID p_light, RS::CanvasLightMode p_mode);
|
||||
void canvas_light_attach_to_canvas(RID p_light, RID p_canvas);
|
||||
void canvas_light_set_enabled(RID p_light, bool p_enabled);
|
||||
@@ -344,6 +370,9 @@ public:
|
||||
void canvas_item_set_default_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat);
|
||||
|
||||
void update_visibility_notifiers();
|
||||
void update_dirty_items();
|
||||
|
||||
void _update_dirty_item(Item *p_item);
|
||||
|
||||
Rect2 _debug_canvas_item_get_rect(RID p_item);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user