summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-10-10 18:31:01 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-10-10 18:31:01 -0300
commit1527cf8c0d17891dd0ebf99d484f83daa46eba3c (patch)
treea9a0fc5a00f8f57a973f2861d051b76f99642114 /scene/2d
parent850eaf7ed796d2f2d9a35c6bc4ba9a4e69f5ca1d (diff)
2D Shaders are working again using the new syntax, though all is buggy in general
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/canvas_item.cpp14
-rw-r--r--scene/2d/canvas_item.h4
2 files changed, 6 insertions, 12 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index 07ee1ff753..0696261401 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -55,7 +55,7 @@ bool CanvasItemMaterial::_set(const StringName& p_name, const Variant& p_value)
}
}
if (pr) {
- VisualServer::get_singleton()->material_set_param(material,pr,p_value);
+ VisualServer::get_singleton()->material_set_param(_get_material(),pr,p_value);
return true;
}
}
@@ -78,7 +78,7 @@ bool CanvasItemMaterial::_get(const StringName& p_name,Variant &r_ret) const {
StringName pr = shader->remap_param(p_name);
if (pr) {
- r_ret=VisualServer::get_singleton()->material_get_param(material,pr);
+ r_ret=VisualServer::get_singleton()->material_get_param(_get_material(),pr);
return true;
}
}
@@ -111,7 +111,7 @@ void CanvasItemMaterial::set_shader(const Ref<Shader>& p_shader) {
if (shader.is_valid())
rid=shader->get_rid();
- VS::get_singleton()->material_set_shader(material,rid);
+ VS::get_singleton()->material_set_shader(_get_material(),rid);
_change_notify(); //properties for shader exposed
emit_changed();
}
@@ -123,18 +123,14 @@ Ref<Shader> CanvasItemMaterial::get_shader() const{
void CanvasItemMaterial::set_shader_param(const StringName& p_param,const Variant& p_value){
- VS::get_singleton()->material_set_param(material,p_param,p_value);
+ VS::get_singleton()->material_set_param(_get_material(),p_param,p_value);
}
Variant CanvasItemMaterial::get_shader_param(const StringName& p_param) const{
- return VS::get_singleton()->material_get_param(material,p_param);
+ return VS::get_singleton()->material_get_param(_get_material(),p_param);
}
-RID CanvasItemMaterial::get_rid() const {
-
- return material;
-}
void CanvasItemMaterial::_bind_methods() {
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index b65c1a60b4..9cc7982aa3 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -41,10 +41,9 @@ class Font;
class StyleBox;
-class CanvasItemMaterial : public Material{
+class CanvasItemMaterial : public Material {
OBJ_TYPE(CanvasItemMaterial,Material);
- RID material;
Ref<Shader> shader;
public:
/*enum ShadingMode {
@@ -70,7 +69,6 @@ public:
void set_shader_param(const StringName& p_param,const Variant& p_value);
Variant get_shader_param(const StringName& p_param) const;
- virtual RID get_rid() const;
CanvasItemMaterial();
~CanvasItemMaterial();
};