summaryrefslogtreecommitdiff
path: root/scene/2d
diff options
context:
space:
mode:
authorBojidar Marinov <bojidar.marinov.bg@gmail.com>2017-06-22 18:15:50 +0300
committerBojidar Marinov <bojidar.marinov.bg@gmail.com>2017-06-22 18:15:50 +0300
commit2edb082c7eb85fa1175771ad298f8a8169bc267a (patch)
tree2420685c836b4d22ee4aa2d5665c7aa4ef9f07ba /scene/2d
parentf27d2a3355b8c577fccd961d28dd6085887623c2 (diff)
Add normal map to tilemaps and tilesets
Fixes #9310
Diffstat (limited to 'scene/2d')
-rw-r--r--scene/2d/tile_map.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 4f892a31fc..4676f2c4c1 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -441,14 +441,15 @@ void TileMap::_update_dirty_quadrants() {
rect.position.y -= center.y;
}
+ Ref<Texture> normal_map = tile_set->tile_get_normal_map(c.id);
Color modulate = tile_set->tile_get_modulate(c.id);
Color self_modulate = get_self_modulate();
modulate = Color(modulate.r * self_modulate.r, modulate.g * self_modulate.g,
modulate.b * self_modulate.b, modulate.a * self_modulate.a);
if (r == Rect2()) {
- tex->draw_rect(canvas_item, rect, false, modulate, c.transpose);
+ tex->draw_rect(canvas_item, rect, false, modulate, c.transpose, normal_map);
} else {
- tex->draw_rect_region(canvas_item, rect, r, modulate, c.transpose);
+ tex->draw_rect_region(canvas_item, rect, r, modulate, c.transpose, normal_map);
}
Vector<Ref<Shape2D> > shapes = tile_set->tile_get_shapes(c.id);