summaryrefslogtreecommitdiffhomepage
path: root/draw
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-18 23:42:07 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-18 23:42:07 +0100
commit4d9a82b720c8ce74b94f43f72ddd819ef21abbdf (patch)
treec0a5d21b8e19fbb60c286faec8e302e6f32b6679 /draw
parent32b8c22828315292857e2cd9909fba620f30ff70 (diff)
pre-declare integer types without cstddef/cstdint
Diffstat (limited to 'draw')
-rw-r--r--draw/anim.cpp16
-rw-r--r--draw/anim.hpp4
-rw-r--r--draw/box.hpp2
-rw-r--r--draw/floor.cpp12
-rw-r--r--draw/quad-floor.hpp2
-rw-r--r--draw/quad-wall-n.hpp2
-rw-r--r--draw/quad-wall-w.hpp2
-rw-r--r--draw/quad.hpp2
-rw-r--r--draw/wall.cpp12
-rw-r--r--draw/wireframe.cpp2
-rw-r--r--draw/wireframe.hpp6
11 files changed, 31 insertions, 31 deletions
diff --git a/draw/anim.cpp b/draw/anim.cpp
index 4af20b8f..60e9b54c 100644
--- a/draw/anim.cpp
+++ b/draw/anim.cpp
@@ -51,12 +51,12 @@ void anim_mesh::draw(tile_shader& shader, chunk& c)
auto [mesh_] = c.ensure_scenery_mesh();
const auto& es = c.entities();
GL::MeshView mesh{mesh_};
- [[maybe_unused]] std::size_t draw_count = 0;
+ [[maybe_unused]] size_t draw_count = 0;
const auto size = es.size();
- const auto max_index = std::uint32_t(size*quad_index_count - 1);
+ const auto max_index = uint32_t(size*quad_index_count - 1);
- const auto do_draw = [&](std::size_t from, std::size_t to, anim_atlas* atlas) {
+ const auto do_draw = [&](size_t from, size_t to, anim_atlas* atlas) {
atlas->texture().bind(0);
mesh.setCount((int)(quad_index_count * (to-from)));
mesh.setIndexRange((int)(from*quad_index_count), 0, max_index);
@@ -64,14 +64,14 @@ void anim_mesh::draw(tile_shader& shader, chunk& c)
draw_count++;
};
- fm_debug_assert(std::size_t(mesh_.count()) <= size*quad_index_count);
+ fm_debug_assert(size_t(mesh_.count()) <= size*quad_index_count);
struct last_ {
- anim_atlas* atlas = nullptr; std::size_t run_from = 0;
+ anim_atlas* atlas = nullptr; size_t run_from = 0;
operator bool() const { return atlas; }
last_& operator=(std::nullptr_t) { atlas = nullptr; return *this; }
} last;
- std::size_t i = 0;
+ size_t i = 0;
for (auto k = 0_uz; k < size; k++)
{
@@ -111,7 +111,7 @@ void anim_mesh::draw(tile_shader& shader, chunk& c)
#endif
}
-void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, const Vector3& center, float depth)
+void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, size_t frame, const Vector3& center, float depth)
{
const auto pos = atlas.frame_quad(center, r, frame);
const auto& g = atlas.group(r);
@@ -124,7 +124,7 @@ void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::si
shader.draw(_mesh);
}
-void anim_mesh::draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::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_offset)
{
const auto pos = Vector3(xy) * TILE_SIZE + Vector3(Vector2(offset), 0);
const float depth = tile_shader::depth_value(xy, depth_offset);
diff --git a/draw/anim.hpp b/draw/anim.hpp
index b7d0a0cd..632a89e3 100644
--- a/draw/anim.hpp
+++ b/draw/anim.hpp
@@ -25,8 +25,8 @@ struct anim_mesh final
anim_mesh();
void draw(tile_shader& shader, chunk& c);
- void draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, const Vector3& pos, float depth);
- void draw(tile_shader& shader, anim_atlas& atlas, rotation r, std::size_t frame, local_coords xy, Vector2b offset, float depth_offset);
+ 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);
static void add_clickable(tile_shader& shader, const Vector2i& win_size, const std::shared_ptr<entity>& s, std::vector<clickable>& list);
private:
diff --git a/draw/box.hpp b/draw/box.hpp
index b187dc83..a6608e00 100644
--- a/draw/box.hpp
+++ b/draw/box.hpp
@@ -10,7 +10,7 @@ struct box final
{
box(Vector3 center, Vector3 size, float line_width);
- static constexpr std::size_t num_vertices = 8, num_indexes = 12*2;
+ static constexpr size_t num_vertices = 8, num_indexes = 12*2;
static constexpr GL::MeshPrimitive primitive = GL::MeshPrimitive::Lines;
using vertex_array = std::array<Vector3, num_vertices>;
diff --git a/draw/floor.cpp b/draw/floor.cpp
index 0f342a4e..6c5e1266 100644
--- a/draw/floor.cpp
+++ b/draw/floor.cpp
@@ -13,13 +13,13 @@ void floor_mesh::draw(tile_shader& shader, chunk& c)
{
constexpr int quad_index_count = 6;
const auto [mesh_, ids, size] = c.ensure_ground_mesh();
- struct { tile_atlas* atlas = nullptr; std::size_t pos = 0; } last;
+ struct { tile_atlas* atlas = nullptr; size_t pos = 0; } last;
GL::MeshView mesh{mesh_};
- [[maybe_unused]] std::size_t draw_count = 0;
- fm_debug_assert(std::size_t(mesh_.count()) == size*quad_index_count);
+ [[maybe_unused]] size_t draw_count = 0;
+ fm_debug_assert(size_t(mesh_.count()) == size*quad_index_count);
- const auto do_draw = [&](std::size_t i, tile_atlas* atlas, std::uint32_t max_index) {
+ const auto do_draw = [&](size_t i, tile_atlas* atlas, uint32_t max_index) {
if (atlas == last.atlas)
return;
if (auto len = i - last.pos; last.atlas && len > 0)
@@ -33,8 +33,8 @@ void floor_mesh::draw(tile_shader& shader, chunk& c)
last = { atlas, i };
};
- const auto max_index = std::uint32_t(size*quad_index_count - 1);
- std::size_t k;
+ const auto max_index = uint32_t(size*quad_index_count - 1);
+ size_t k;
for (k = 0; k < size; k++)
do_draw(k, c.ground_atlas_at(ids[k]), max_index);
do_draw(size, nullptr, max_index);
diff --git a/draw/quad-floor.hpp b/draw/quad-floor.hpp
index 7d974798..84ab17e9 100644
--- a/draw/quad-floor.hpp
+++ b/draw/quad-floor.hpp
@@ -12,7 +12,7 @@ struct quad_floor final
{
quad_floor(Vector3 center, Vector2 size, float line_width);
- static constexpr std::size_t num_vertices = 4, num_indexes = 0;
+ static constexpr size_t num_vertices = 4, num_indexes = 0;
static constexpr auto primitive = GL::MeshPrimitive::LineLoop;
using vertex_array = std::array<Vector3, num_vertices>;
diff --git a/draw/quad-wall-n.hpp b/draw/quad-wall-n.hpp
index f07d7d06..c490d8b2 100644
--- a/draw/quad-wall-n.hpp
+++ b/draw/quad-wall-n.hpp
@@ -11,7 +11,7 @@ struct quad_wall_n final
{
quad_wall_n(Vector3 center, Vector3 size, float line_width);
- static constexpr std::size_t num_vertices = 4, num_indexes = 0;
+ static constexpr size_t num_vertices = 4, num_indexes = 0;
static constexpr auto primitive = GL::MeshPrimitive::LineLoop;
using vertex_array = std::array<Vector3, num_vertices>;
diff --git a/draw/quad-wall-w.hpp b/draw/quad-wall-w.hpp
index cca70b30..b90d53c3 100644
--- a/draw/quad-wall-w.hpp
+++ b/draw/quad-wall-w.hpp
@@ -11,7 +11,7 @@ struct quad_wall_w final
{
quad_wall_w(Vector3 center, Vector3 size, float line_width);
- static constexpr std::size_t num_vertices = 4, num_indexes = 0;
+ static constexpr size_t num_vertices = 4, num_indexes = 0;
static constexpr auto primitive = GL::MeshPrimitive::LineLoop;
using vertex_array = std::array<Vector3, num_vertices>;
diff --git a/draw/quad.hpp b/draw/quad.hpp
index 7bccebae..c92e9544 100644
--- a/draw/quad.hpp
+++ b/draw/quad.hpp
@@ -10,7 +10,7 @@ struct quad final
{
quad(Vector3 start, Vector2 size, float line_width);
- static constexpr std::size_t num_vertices = 4, num_indexes = 0;
+ static constexpr size_t num_vertices = 4, num_indexes = 0;
static constexpr GL::MeshPrimitive primitive = GL::MeshPrimitive::LineLoop;
using vertex_array = std::array<Vector3, num_vertices>;
diff --git a/draw/wall.cpp b/draw/wall.cpp
index a88844a6..d1370d45 100644
--- a/draw/wall.cpp
+++ b/draw/wall.cpp
@@ -16,12 +16,12 @@ wall_mesh::wall_mesh() = default;
void wall_mesh::draw(tile_shader& shader, chunk& c)
{
const auto [mesh_, ids, size] = c.ensure_wall_mesh();
- struct { tile_atlas* atlas = nullptr; std::size_t pos = 0; } last;
+ struct { tile_atlas* atlas = nullptr; size_t pos = 0; } last;
GL::MeshView mesh{mesh_};
- [[maybe_unused]] std::size_t draw_count = 0;
- fm_debug_assert(std::size_t(mesh_.count()) == size*quad_index_count);
+ [[maybe_unused]] size_t draw_count = 0;
+ fm_debug_assert(size_t(mesh_.count()) == size*quad_index_count);
- const auto do_draw = [&](std::size_t i, tile_atlas* atlas, std::uint32_t max_index) {
+ const auto do_draw = [&](size_t i, tile_atlas* atlas, uint32_t max_index) {
if (atlas == last.atlas)
return;
if (auto len = i - last.pos; last.atlas && len > 0)
@@ -35,8 +35,8 @@ void wall_mesh::draw(tile_shader& shader, chunk& c)
last = { atlas, i };
};
- const auto max_index = std::uint32_t(size*quad_index_count - 1);
- std::size_t k;
+ const auto max_index = uint32_t(size*quad_index_count - 1);
+ size_t k;
for (k = 0; k < size; k++)
do_draw(k, c.wall_atlas_at(ids[k]), max_index);
do_draw(size, nullptr, max_index);
diff --git a/draw/wireframe.cpp b/draw/wireframe.cpp
index 7acebc70..84e086d4 100644
--- a/draw/wireframe.cpp
+++ b/draw/wireframe.cpp
@@ -34,7 +34,7 @@ struct constant_buf {
};
mesh_base::mesh_base(GL::MeshPrimitive primitive, ArrayView<const void> index_data,
- std::size_t num_vertices, std::size_t num_indexes, GL::Texture2D* texture) :
+ size_t num_vertices, size_t num_indexes, GL::Texture2D* texture) :
_vertex_buffer{Containers::Array<Vector3>{ValueInit, num_vertices}, GL::BufferUsage::DynamicDraw},
_constant_buffer{Containers::Array<constant_buf>{ValueInit, num_vertices}},
_index_buffer{num_indexes == 0 ? GL::Buffer{NoCreate} : GL::Buffer{index_data}},
diff --git a/draw/wireframe.hpp b/draw/wireframe.hpp
index 6d5249e1..922936ae 100644
--- a/draw/wireframe.hpp
+++ b/draw/wireframe.hpp
@@ -13,8 +13,8 @@ namespace wireframe {
template<typename T>
concept traits = requires (const T& x) {
- {T::num_vertices} -> std::convertible_to<std::size_t>;
- {T::num_indexes} -> std::convertible_to<std::size_t>;
+ {T::num_vertices} -> std::convertible_to<size_t>;
+ {T::num_indexes} -> std::convertible_to<size_t>;
{x.primitive} -> std::convertible_to<GL::MeshPrimitive>;
{x.make_vertex_array() } -> std::convertible_to<ArrayView<const void>>;
{T::make_index_array() } -> std::convertible_to<ArrayView<const void>>;
@@ -32,7 +32,7 @@ protected:
GL::Mesh _mesh;
mesh_base(GL::MeshPrimitive primitive, ArrayView<const void> index_data,
- std::size_t num_vertices, std::size_t num_indexes, GL::Texture2D* texture);
+ size_t num_vertices, size_t num_indexes, GL::Texture2D* texture);
void draw(tile_shader& shader);
void set_subdata(ArrayView<const void> array);
};