blob: 0b69e4ddc812cd32b336bfabd94937abf59a0782 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "anim.hpp"
#include "anim-atlas.hpp"
#include "shaders/tile.hpp"
namespace floormat {
anim_mesh::anim_mesh() = default;
std::array<UnsignedShort, 6> anim_mesh::make_index_array()
{
using u16 = std::uint16_t;
return {{
(u16)0, (u16)1, (u16)2,
(u16)2, (u16)1, (u16)3,
}};
}
void anim_mesh::draw(local_coords xy, const anim_atlas& atlas, const anim_frame& frame)
{
const auto center_ = Vector3(xy.x, xy.y, 0.f) * TILE_SIZE;
const auto pos = atlas.frame_quad(center_, frame);
_positions_buffer.setSubData(0, pos);
}
} // namespace floormat
|