-Initial (untested) implementation of 2D shaders. Probably broken, will be fixed later.

-fixed issue of opacity not working
This commit is contained in:
Juan Linietsky
2015-01-11 11:43:31 -03:00
parent 336d9ce5d7
commit 66afddb3e8
20 changed files with 584 additions and 197 deletions

View File

@ -32,6 +32,7 @@
#include "scene/main/node.h"
#include "scene/resources/texture.h"
#include "scene/main/scene_main_loop.h"
#include "scene/resources/shader.h"
class CanvasLayer;
class Viewport;
@ -80,6 +81,8 @@ private:
bool block_transform_notify;
bool behind;
Ref<Shader> shader;
mutable Matrix32 global_transform;
mutable bool global_invalid;
@ -99,8 +102,9 @@ private:
void _queue_sort_children();
void _sort_children();
#ifdef TOOLS_ENABLED
void _shader_changed();
#endif
void _notify_transform(CanvasItem *p_node);
void _set_on_top(bool p_on_top) { set_draw_behind_parent(!p_on_top); }
@ -108,6 +112,9 @@ private:
protected:
bool _set(const StringName& p_name, const Variant& p_value);
bool _get(const StringName& p_name,Variant &r_ret) const;
void _get_property_list( List<PropertyInfo> *p_list) const;
_FORCE_INLINE_ void _notify_transform() { if (!is_inside_tree()) return; _notify_transform(this); if (!block_transform_notify) notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED); }
@ -204,7 +211,11 @@ public:
RID get_canvas() const;
Ref<World2D> get_world_2d() const;
void set_shader(const Ref<Shader>& p_shader);
Ref<Shader> get_shader() const;
void set_shader_param(const StringName& p_param,const Variant& p_value);
Variant get_shader_param(const StringName& p_param) const;
CanvasItem();
~CanvasItem();