summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/chunk-collision.cpp2
-rw-r--r--src/chunk-render.cpp2
-rw-r--r--src/chunk.cpp2
-rw-r--r--src/chunk.hpp4
-rw-r--r--src/ground-atlas.cpp (renamed from src/tile-atlas.cpp)14
-rw-r--r--src/ground-atlas.hpp (renamed from src/tile-atlas.hpp)4
-rw-r--r--src/tile-image.cpp4
-rw-r--r--src/tile-image.hpp6
-rw-r--r--src/tile.cpp12
-rw-r--r--src/tile.hpp14
10 files changed, 32 insertions, 32 deletions
diff --git a/src/chunk-collision.cpp b/src/chunk-collision.cpp
index 4f94df6b..a6fd379d 100644
--- a/src/chunk-collision.cpp
+++ b/src/chunk-collision.cpp
@@ -1,5 +1,5 @@
#include "chunk.hpp"
-#include "tile-atlas.hpp"
+#include "ground-atlas.hpp"
#include "object.hpp"
#include "src/RTree-search.hpp"
#include "src/chunk-scenery.hpp"
diff --git a/src/chunk-render.cpp b/src/chunk-render.cpp
index d019a948..ffaa33ec 100644
--- a/src/chunk-render.cpp
+++ b/src/chunk-render.cpp
@@ -1,5 +1,5 @@
#include "chunk.hpp"
-#include "tile-atlas.hpp"
+#include "ground-atlas.hpp"
#include "quads.hpp"
#include "shaders/shader.hpp"
#include "compat/defs.hpp"
diff --git a/src/chunk.cpp b/src/chunk.cpp
index a49669c5..eaeb06e1 100644
--- a/src/chunk.cpp
+++ b/src/chunk.cpp
@@ -36,7 +36,7 @@ bool chunk::empty(bool force) const noexcept
return true;
}
-tile_atlas* chunk::ground_atlas_at(size_t i) const noexcept { return _ground ? _ground->atlases[i].get() : nullptr; }
+ground_atlas* chunk::ground_atlas_at(size_t i) const noexcept { return _ground ? _ground->atlases[i].get() : nullptr; }
tile_ref chunk::operator[](size_t idx) noexcept { return { *this, uint8_t(idx) }; }
tile_proto chunk::operator[](size_t idx) const noexcept { return tile_proto(tile_ref { *const_cast<chunk*>(this), uint8_t(idx) }); }
diff --git a/src/chunk.hpp b/src/chunk.hpp
index 3005475c..1f144ca7 100644
--- a/src/chunk.hpp
+++ b/src/chunk.hpp
@@ -103,7 +103,7 @@ struct chunk final
void ensure_alloc_ground();
void ensure_alloc_walls();
ground_mesh_tuple ensure_ground_mesh() noexcept;
- tile_atlas* ground_atlas_at(size_t i) const noexcept;
+ ground_atlas* ground_atlas_at(size_t i) const noexcept;
wall_atlas* wall_atlas_at(size_t i) const noexcept;
wall_mesh_tuple ensure_wall_mesh() noexcept;
@@ -129,7 +129,7 @@ struct chunk final
private:
struct ground_stuff
{
- std::array<std::shared_ptr<tile_atlas>, TILE_COUNT> atlases;
+ std::array<std::shared_ptr<ground_atlas>, TILE_COUNT> atlases;
std::array<uint8_t, TILE_COUNT> indexes = {};
std::array<variant_t, TILE_COUNT> variants = {};
};
diff --git a/src/tile-atlas.cpp b/src/ground-atlas.cpp
index 53156a84..a64264ff 100644
--- a/src/tile-atlas.cpp
+++ b/src/ground-atlas.cpp
@@ -1,4 +1,4 @@
-#include "tile-atlas.hpp"
+#include "ground-atlas.hpp"
#include "quads.hpp"
#include "compat/assert.hpp"
#include "tile-image.hpp"
@@ -12,7 +12,7 @@ namespace floormat {
using namespace floormat::Quads;
-tile_atlas::tile_atlas(StringView path, StringView name, const ImageView2D& image, Vector2ub tile_count, enum pass_mode p) :
+ground_atlas::ground_atlas(StringView path, StringView name, const ImageView2D& image, Vector2ub tile_count, enum pass_mode p) :
texcoords_{make_texcoords_array(Vector2ui(image.size()), tile_count)},
path_{path}, name_{name}, size_{image.size()}, dims_{tile_count}, passability{p}
{
@@ -30,13 +30,13 @@ tile_atlas::tile_atlas(StringView path, StringView name, const ImageView2D& imag
.setSubImage(0, {}, image);
}
-std::array<Vector2, 4> tile_atlas::texcoords_for_id(size_t i) const
+std::array<Vector2, 4> ground_atlas::texcoords_for_id(size_t i) const
{
fm_assert(i < num_tiles());
return texcoords_[i];
}
-auto tile_atlas::make_texcoords(Vector2ui pixel_size, Vector2ub tile_count, size_t i) -> texcoords
+auto ground_atlas::make_texcoords(Vector2ui pixel_size, Vector2ub tile_count, size_t i) -> texcoords
{
const auto sz = pixel_size/Vector2ui{tile_count};
const auto id = Vector2ui{ uint32_t(i % tile_count[0]), uint32_t(i / tile_count[0]) };
@@ -44,7 +44,7 @@ auto tile_atlas::make_texcoords(Vector2ui pixel_size, Vector2ub tile_count, size
return texcoords_at(p0, sz, pixel_size);
}
-auto tile_atlas::make_texcoords_array(Vector2ui pixel_size, Vector2ub tile_count) -> std::unique_ptr<const texcoords[]>
+auto ground_atlas::make_texcoords_array(Vector2ui pixel_size, Vector2ub tile_count) -> std::unique_ptr<const texcoords[]>
{
const size_t N = Vector2ui{tile_count}.product();
auto ptr = std::make_unique<std::array<Vector2, 4>[]>(N);
@@ -53,7 +53,7 @@ auto tile_atlas::make_texcoords_array(Vector2ui pixel_size, Vector2ub tile_count
return ptr;
}
-size_t tile_atlas::num_tiles() const { return Vector2ui{dims_}.product(); }
-enum pass_mode tile_atlas::pass_mode() const { return passability; }
+size_t ground_atlas::num_tiles() const { return Vector2ui{dims_}.product(); }
+enum pass_mode ground_atlas::pass_mode() const { return passability; }
} // namespace floormat
diff --git a/src/tile-atlas.hpp b/src/ground-atlas.hpp
index a4334b1a..e6e2d5ba 100644
--- a/src/tile-atlas.hpp
+++ b/src/ground-atlas.hpp
@@ -11,7 +11,7 @@
namespace floormat {
-class tile_atlas final
+class ground_atlas final
{
using quad = Quads::quad;
using texcoords = std::array<Vector2, 4>;
@@ -27,7 +27,7 @@ class tile_atlas final
enum pass_mode passability;
public:
- tile_atlas(StringView path, StringView name, const ImageView2D& img, Vector2ub tile_count, enum pass_mode pass_mode);
+ ground_atlas(StringView path, StringView name, const ImageView2D& img, Vector2ub tile_count, enum pass_mode pass_mode);
texcoords texcoords_for_id(size_t id) const;
diff --git a/src/tile-image.cpp b/src/tile-image.cpp
index 7bfea375..e2d84461 100644
--- a/src/tile-image.cpp
+++ b/src/tile-image.cpp
@@ -35,8 +35,8 @@ image_ref_<Atlas, Proto>& image_ref_<Atlas, Proto>::operator=(const Proto& proto
return *this;
}
-template struct image_proto_<tile_atlas>;
-template struct image_ref_<tile_atlas, tile_image_proto>;
+template struct image_proto_<ground_atlas>;
+template struct image_ref_<ground_atlas, tile_image_proto>;
template struct image_proto_<wall_atlas>;
template struct image_ref_<wall_atlas, wall_image_proto>;
diff --git a/src/tile-image.hpp b/src/tile-image.hpp
index facf9945..7292c5f0 100644
--- a/src/tile-image.hpp
+++ b/src/tile-image.hpp
@@ -4,7 +4,7 @@
namespace floormat {
-class tile_atlas;
+class ground_atlas;
class wall_atlas;
template<typename Atlas>
@@ -30,8 +30,8 @@ struct image_ref_ final
explicit operator bool() const noexcept;
};
-using tile_image_proto = image_proto_<tile_atlas>;
-using tile_image_ref = image_ref_<tile_atlas, tile_image_proto>;
+using tile_image_proto = image_proto_<ground_atlas>;
+using tile_image_ref = image_ref_<ground_atlas, tile_image_proto>;
using wall_image_proto = image_proto_<wall_atlas>;
using wall_image_ref = image_ref_<wall_atlas, wall_image_proto>;
diff --git a/src/tile.cpp b/src/tile.cpp
index ce21d506..c5eda401 100644
--- a/src/tile.cpp
+++ b/src/tile.cpp
@@ -18,13 +18,13 @@ wall_image_proto tile_proto::wall_west() const noexcept { return { wall_west_at
tile_ref::tile_ref(struct chunk& c, uint8_t i) noexcept : _chunk{&c}, i{i} {}
-std::shared_ptr<tile_atlas> tile_ref::ground_atlas() noexcept { return _chunk->_ground ? _chunk->_ground->atlases[i] : nullptr; }
-std::shared_ptr<wall_atlas> tile_ref::wall_north_atlas() noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+0] : nullptr; }
-std::shared_ptr<wall_atlas> tile_ref::wall_west_atlas() noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+1] : nullptr; }
+std::shared_ptr<class ground_atlas> tile_ref::ground_atlas() noexcept { return _chunk->_ground ? _chunk->_ground->atlases[i] : nullptr; }
+std::shared_ptr<class wall_atlas> tile_ref::wall_north_atlas() noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+0] : nullptr; }
+std::shared_ptr<class wall_atlas> tile_ref::wall_west_atlas() noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+1] : nullptr; }
-std::shared_ptr<const tile_atlas> tile_ref::ground_atlas() const noexcept { return _chunk->_ground ? _chunk->_ground->atlases[i] : nullptr; }
-std::shared_ptr<const wall_atlas> tile_ref::wall_north_atlas() const noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+0] : nullptr; }
-std::shared_ptr<const wall_atlas> tile_ref::wall_west_atlas() const noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+1] : nullptr; }
+std::shared_ptr<const class ground_atlas> tile_ref::ground_atlas() const noexcept { return _chunk->_ground ? _chunk->_ground->atlases[i] : nullptr; }
+std::shared_ptr<const class wall_atlas> tile_ref::wall_north_atlas() const noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+0] : nullptr; }
+std::shared_ptr<const class wall_atlas> tile_ref::wall_west_atlas() const noexcept { return _chunk->_walls ? _chunk->_walls->atlases[i*2+1] : nullptr; }
tile_image_ref tile_ref::ground() noexcept { _chunk->ensure_alloc_ground(); return {_chunk->_ground->atlases[i], _chunk->_ground->variants[i] }; }
wall_image_ref tile_ref::wall_north() noexcept { _chunk->ensure_alloc_walls(); return {_chunk->_walls->atlases[i*2+0], _chunk->_walls->variants[i*2+0] }; }
diff --git a/src/tile.hpp b/src/tile.hpp
index efdd331b..a195eec4 100644
--- a/src/tile.hpp
+++ b/src/tile.hpp
@@ -8,7 +8,7 @@ class anim_atlas;
struct tile_proto final
{
- std::shared_ptr<tile_atlas> ground_atlas;
+ std::shared_ptr<ground_atlas> ground_atlas;
std::shared_ptr<wall_atlas> wall_north_atlas, wall_west_atlas;
variant_t ground_variant = 0, wall_north_variant = 0, wall_west_variant = 0;
@@ -31,13 +31,13 @@ struct tile_ref final
wall_image_proto wall_north() const noexcept;
wall_image_proto wall_west() const noexcept;
- std::shared_ptr<tile_atlas> ground_atlas() noexcept;
- std::shared_ptr<wall_atlas> wall_north_atlas() noexcept;
- std::shared_ptr<wall_atlas> wall_west_atlas() noexcept;
+ std::shared_ptr<class ground_atlas> ground_atlas() noexcept;
+ std::shared_ptr<class wall_atlas> wall_north_atlas() noexcept;
+ std::shared_ptr<class wall_atlas> wall_west_atlas() noexcept;
- std::shared_ptr<const tile_atlas> ground_atlas() const noexcept;
- std::shared_ptr<const wall_atlas> wall_north_atlas() const noexcept;
- std::shared_ptr<const wall_atlas> wall_west_atlas() const noexcept;
+ std::shared_ptr<const class ground_atlas> ground_atlas() const noexcept;
+ std::shared_ptr<const class wall_atlas> wall_north_atlas() const noexcept;
+ std::shared_ptr<const class wall_atlas> wall_west_atlas() const noexcept;
explicit operator tile_proto() const noexcept;