diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-01-10 17:35:26 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-01-10 17:35:26 -0300 |
commit | 89970848311ee2d49040a148a56d80590091877c (patch) | |
tree | 804834a8c481fff872671c63afbf6bc6a7abf354 /scene | |
parent | 78f4b937034c8bc24c2a871b1fc08ecbe39d0e5e (diff) |
2D Rewrite Step [1]
-=-=-=-=-=-=-=-=-=-
-Moved drawing code to a single function that takes linked list (should make it easier to optimize in the future).
-Implemented Z ordering of 2D nodes. Node2D and those that inherit have a visibility/Z property that affects drawing order (besides the tree order)
-Removed OpenGL ES 1.x support. Good riddance!
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/node_2d.cpp | 22 | ||||
-rw-r--r-- | scene/2d/node_2d.h | 4 | ||||
-rw-r--r-- | scene/resources/shader_graph.cpp | 3 |
3 files changed, 25 insertions, 4 deletions
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 6dcee3458f..b9041e1224 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -289,6 +289,21 @@ void Node2D::set_global_transform(const Matrix32& p_transform) { } +void Node2D::set_z(int p_z) { + + ERR_FAIL_COND(p_z<-VS::CANVAS_ITEM_Z_DEFAULT); + ERR_FAIL_COND(p_z>=VS::CANVAS_ITEM_Z_DEFAULT); + z=p_z; + VS::get_singleton()->canvas_item_set_z(get_canvas_item(),z+VS::CANVAS_ITEM_Z_DEFAULT); + +} + +int Node2D::get_z() const{ + + return z; +} + + void Node2D::_bind_methods() { @@ -308,17 +323,21 @@ void Node2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("move_local_x","delta","scaled"),&Node2D::move_x,DEFVAL(false)); ObjectTypeDB::bind_method(_MD("move_local_y","delta","scaled"),&Node2D::move_y,DEFVAL(false)); + ObjectTypeDB::bind_method(_MD("set_global_pos","pos"),&Node2D::set_global_pos); ObjectTypeDB::bind_method(_MD("get_global_pos"),&Node2D::get_global_pos); - ObjectTypeDB::bind_method(_MD("set_global_pos"),&Node2D::set_global_pos); ObjectTypeDB::bind_method(_MD("set_transform","xform"),&Node2D::set_transform); ObjectTypeDB::bind_method(_MD("set_global_transform","xform"),&Node2D::set_global_transform); + ObjectTypeDB::bind_method(_MD("set_z","z"),&Node2D::set_z); + ObjectTypeDB::bind_method(_MD("get_z"),&Node2D::get_z); + ObjectTypeDB::bind_method(_MD("edit_set_pivot"),&Node2D::edit_set_pivot); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"transform/pos"),_SCS("set_pos"),_SCS("get_pos")); ADD_PROPERTY(PropertyInfo(Variant::REAL,"transform/rot",PROPERTY_HINT_RANGE,"-1440,1440,0.1"),_SCS("_set_rotd"),_SCS("_get_rotd")); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2,"transform/scale"),_SCS("set_scale"),_SCS("get_scale")); + ADD_PROPERTY(PropertyInfo(Variant::INT,"visibility/z",PROPERTY_HINT_RANGE,"-512,511,1"),_SCS("set_z"),_SCS("get_z")); @@ -331,6 +350,7 @@ Node2D::Node2D() { angle=0; scale=Vector2(1,1); _xform_dirty=false; + z=0; } diff --git a/scene/2d/node_2d.h b/scene/2d/node_2d.h index 582c56fa9b..63ca2e3b95 100644 --- a/scene/2d/node_2d.h +++ b/scene/2d/node_2d.h @@ -38,6 +38,7 @@ class Node2D : public CanvasItem { Point2 pos; float angle; Size2 scale; + int z; Matrix32 _mat; @@ -85,6 +86,9 @@ public: void set_global_transform(const Matrix32& p_transform); void set_global_pos(const Point2& p_pos); + void set_z(int p_z); + int get_z() const; + Matrix32 get_transform() const; diff --git a/scene/resources/shader_graph.cpp b/scene/resources/shader_graph.cpp index 8b2f318ec0..9703799a48 100644 --- a/scene/resources/shader_graph.cpp +++ b/scene/resources/shader_graph.cpp @@ -28,9 +28,6 @@ /*************************************************************************/ #include "shader_graph.h" #include "scene/scene_string_names.h" -//todo -//-RGB ops -//-mostrar error de conexion Array ShaderGraph::_get_node_list(ShaderType p_type) const { |