diff options
author | Kostadin Damyanov <maxmight@gmail.com> | 2015-10-13 05:01:54 +0300 |
---|---|---|
committer | Kostadin Damyanov <maxmight@gmail.com> | 2015-10-13 05:01:54 +0300 |
commit | 29caf2bb5be061cd1ab014cf938f2c71d0bd2663 (patch) | |
tree | 859a0c3d2805198672c1e22d4780c3eb68f55a57 /scene/2d/tile_map.cpp | |
parent | c5f574b914b3cb11d97ae616df4a0bced45bb17c (diff) | |
parent | 79e5ced7e668fa53567ac6aaf5a26393cea6c9a2 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r-- | scene/2d/tile_map.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 17f93f816f..418ee192b2 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -30,6 +30,7 @@ #include "io/marshalls.h" #include "servers/physics_2d_server.h" #include "method_bind_ext.inc" +#include "os/os.h" int TileMap::_get_quadrant_size() const { @@ -262,6 +263,14 @@ void TileMap::_update_dirty_quadrants() { Vector2 qofs; + SceneTree *st=SceneTree::get_singleton(); + Color debug_collision_color; + + bool debug_shapes = st && st->is_debugging_collisions_hint(); + if (debug_shapes) { + debug_collision_color=st->get_debug_collisions_color(); + } + while (dirty_quadrant_list.first()) { Quadrant &q = *dirty_quadrant_list.first()->self(); @@ -398,11 +407,19 @@ void TileMap::_update_dirty_quadrants() { _fix_cell_transform(xform,c,shape_ofs+center_ofs,s); - ps->body_add_shape(q.body,shape->get_rid(),xform); + if (debug_shapes) { + vs->canvas_item_add_set_transform(canvas_item,xform); + shape->draw(canvas_item,debug_collision_color); + + } + ps->body_add_shape(q.body,shape->get_rid(),xform); ps->body_set_shape_metadata(q.body,shape_idx++,Vector2(E->key().x,E->key().y)); } } + if (debug_shapes) { + vs->canvas_item_add_set_transform(canvas_item,Matrix32()); + } if (navigation) { Ref<NavigationPolygon> navpoly = tile_set->tile_get_navigation_polygon(c.id); @@ -412,6 +429,7 @@ void TileMap::_update_dirty_quadrants() { xform.set_origin(offset.floor()+q.pos); _fix_cell_transform(xform,c,npoly_ofs+center_ofs,s); + int pid = navigation->navpoly_create(navpoly,nav_rel * xform); Quadrant::NavPoly np; |