summaryrefslogtreecommitdiffhomepage
path: root/draw
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-08 02:33:38 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-08 02:33:38 +0100
commit69324ea83c8c4e73e5e201e0ca53114484a49791 (patch)
tree85f77a6408cb06a405f48beedd229319f376755a /draw
parent8df4de4557ea49ff39462505a0662aacca447bf3 (diff)
a
Diffstat (limited to 'draw')
-rw-r--r--draw/anim.cpp6
-rw-r--r--draw/anim.hpp3
-rw-r--r--draw/wall.cpp2
3 files changed, 6 insertions, 5 deletions
diff --git a/draw/anim.cpp b/draw/anim.cpp
index 0e913d08..1a02ad93 100644
--- a/draw/anim.cpp
+++ b/draw/anim.cpp
@@ -23,12 +23,12 @@ std::array<UnsignedShort, 6> anim_mesh::make_index_array()
}};
}
-void anim_mesh::draw(tile_shader& shader, const anim_atlas& atlas, const anim_frame& frame, local_coords xy)
+void anim_mesh::draw(tile_shader& shader, const anim_atlas& atlas, rotation r, std::size_t frame, local_coords xy)
{
const auto center = Vector3(xy.x, xy.y, 0.f) * TILE_SIZE;
- const auto pos = atlas.frame_quad(center, frame);
+ const auto pos = atlas.frame_quad(center, r, frame);
_positions_buffer.setSubData(0, pos);
- const auto texcoords = atlas.texcoords_for_frame(frame);
+ const auto texcoords = atlas.texcoords_for_frame(r, frame);
_vertex_buffer.setSubData(0, texcoords);
shader.draw(_mesh);
}
diff --git a/draw/anim.hpp b/draw/anim.hpp
index 85c73bcb..04fd92c8 100644
--- a/draw/anim.hpp
+++ b/draw/anim.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "local-coords.hpp"
+#include "scenery.hpp"
#include <array>
#include <Corrade/Containers/ArrayViewStl.h>
#include <Magnum/Magnum.h>
@@ -20,7 +21,7 @@ using anim_frame = Serialize::anim_frame;
struct anim_mesh final
{
anim_mesh();
- void draw(tile_shader& shader, const anim_atlas& atlas, const anim_frame& frame, local_coords pos);
+ void draw(tile_shader& shader, const anim_atlas& atlas, rotation r, std::size_t frame, local_coords xy);
private:
struct vertex_data final { Vector2 texcoords; };
diff --git a/draw/wall.cpp b/draw/wall.cpp
index 353925f6..9bcfe9d4 100644
--- a/draw/wall.cpp
+++ b/draw/wall.cpp
@@ -79,7 +79,7 @@ void wall_mesh::draw(tile_shader& shader, chunk& c)
f = 0;
frame.frame = (scenery::frame_t)std::min(f, a.atlas->info().nframes - 1);
#endif
- _anim_mesh.draw(shader, *a.atlas, a.atlas->frame(a.frame.r, frame.frame), local_coords{idx});
+ _anim_mesh.draw(shader, *a.atlas, a.frame.r, frame.frame, local_coords{idx});
}
}
}