summaryrefslogtreecommitdiffhomepage
path: root/draw
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-04-07 20:44:42 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-04-07 20:44:49 +0200
commit21eaaee936a47742f59eb6b5665422de2bd8e7ae (patch)
treeaeb89f45aaee920eeb88dd14ce53b76eb818d047 /draw
parent82ec1a07c79b1c96688464609d043d6ce23685b1 (diff)
fix closed doors clipping through walls
Diffstat (limited to 'draw')
-rw-r--r--draw/anim.cpp10
-rw-r--r--draw/anim.hpp2
2 files changed, 6 insertions, 6 deletions
diff --git a/draw/anim.cpp b/draw/anim.cpp
index 0d1f2827..119bd6c6 100644
--- a/draw/anim.cpp
+++ b/draw/anim.cpp
@@ -96,10 +96,11 @@ void anim_mesh::draw(tile_shader& shader, const Vector2i& win_size, chunk& c, st
}
if (e.is_dynamic())
{
- const auto depth = e.depth_offset();
- const auto depth1 = depth[1]*TILE_MAX_DIM + depth[0];
+ const auto depth0 = e.depth_offset();
+ const auto depth1 = depth0[1]*TILE_MAX_DIM + depth0[0];
+ const auto depth = tile_shader::depth_value(e.coord.local(), depth1);
//Debug{} << "draw-dyn" << e.atlas->name() << e.ordinal() << Vector2i(e.coord.local());
- draw(shader, atlas, e.r, e.frame, e.coord.local(), e.offset, depth1 + tile_shader::scenery_depth_offset);
+ draw(shader, atlas, e.r, e.frame, e.coord.local(), e.offset, depth);
last = nullptr;
}
else
@@ -137,10 +138,9 @@ void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t
shader.draw(_mesh);
}
-void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, local_coords xy, Vector2b offset, float depth_offset)
+void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, local_coords xy, Vector2b offset, float depth)
{
const auto pos = Vector3(xy) * TILE_SIZE + Vector3(Vector2(offset), 0);
- const float depth = tile_shader::depth_value(xy, depth_offset);
draw(shader, atlas, r, frame, pos, depth);
}
diff --git a/draw/anim.hpp b/draw/anim.hpp
index 96c1de7e..eaa191f5 100644
--- a/draw/anim.hpp
+++ b/draw/anim.hpp
@@ -28,7 +28,7 @@ struct anim_mesh final
void draw(tile_shader& shader, const Vector2i& win_size, chunk& c, std::vector<clickable>& list);
void draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, const Vector3& pos, float depth);
- void draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, local_coords xy, Vector2b offset, float depth_offset);
+ void draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, local_coords xy, Vector2b offset, float dpeth);
static void add_clickable(tile_shader& shader, const Vector2i& win_size,
entity* s_, const chunk::topo_sort_data& data,
std::vector<clickable>& list);