From d74df1b763979d281f76f3f30543aee8d8a638b7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 11 Jan 2024 14:29:53 +0100 Subject: rename floor -> ground --- CMakeLists.txt | 2 +- bench/bitmask.cpp | 2 +- draw/floor.cpp | 49 ----------------------------------------------- draw/floor.hpp | 15 --------------- draw/ground.cpp | 49 +++++++++++++++++++++++++++++++++++++++++++++++ draw/ground.hpp | 15 +++++++++++++++ editor/draw.cpp | 4 ++-- editor/ground-editor.cpp | 4 ++-- editor/update.cpp | 2 +- floormat/main.hpp | 4 ++-- ground/concrete1.tga | Bin 0 -> 110610 bytes ground/concrete6.tga | Bin 0 -> 193075 bytes ground/concrete7.tga | Bin 0 -> 49633 bytes ground/floor-tiles.tga | Bin 0 -> 8427493 bytes ground/ground.json | 23 ++++++++++++++++++++++ ground/metal1.tga | Bin 0 -> 49459 bytes ground/metal2.tga | Bin 0 -> 1070043 bytes ground/teak1.tga | Bin 0 -> 49360 bytes ground/texel.tga | Bin 0 -> 663 bytes ground/tiles.tga | Bin 0 -> 492059 bytes ground/wall1.tga | Bin 0 -> 140727 bytes ground/wood1.tga | Bin 0 -> 12838 bytes ground/wood2.tga | Bin 0 -> 12854 bytes images/concrete1.tga | Bin 110610 -> 0 bytes images/concrete6.tga | Bin 193075 -> 0 bytes images/concrete7.tga | Bin 49633 -> 0 bytes images/floor-tiles.tga | Bin 8427493 -> 0 bytes images/floor.json | 23 ---------------------- images/metal1.tga | Bin 49459 -> 0 bytes images/metal2.tga | Bin 1070043 -> 0 bytes images/teak1.tga | Bin 49360 -> 0 bytes images/texel.tga | Bin 663 -> 0 bytes images/tiles.tga | Bin 492059 -> 0 bytes images/wall1.tga | Bin 140727 -> 0 bytes images/wood1.tga | Bin 12838 -> 0 bytes images/wood2.tga | Bin 12854 -> 0 bytes loader/atlas.cpp | 6 +++--- loader/impl.hpp | 6 +++--- loader/json.cpp | 2 +- loader/loader.cpp | 9 ++++++--- loader/loader.hpp | 8 +++++--- loader/vobj.cpp | 2 +- loader/wall-atlas.cpp | 4 ++-- main/draw.cpp | 2 +- main/main-impl.hpp | 4 ++-- main/setup.cpp | 2 +- test/bitmask.cpp | 2 +- test/loader.cpp | 2 +- 48 files changed, 123 insertions(+), 118 deletions(-) delete mode 100644 draw/floor.cpp delete mode 100644 draw/floor.hpp create mode 100644 draw/ground.cpp create mode 100644 draw/ground.hpp create mode 100644 ground/concrete1.tga create mode 100644 ground/concrete6.tga create mode 100644 ground/concrete7.tga create mode 100644 ground/floor-tiles.tga create mode 100644 ground/ground.json create mode 100644 ground/metal1.tga create mode 100644 ground/metal2.tga create mode 100644 ground/teak1.tga create mode 100644 ground/texel.tga create mode 100644 ground/tiles.tga create mode 100644 ground/wall1.tga create mode 100644 ground/wood1.tga create mode 100644 ground/wood2.tga delete mode 100644 images/concrete1.tga delete mode 100644 images/concrete6.tga delete mode 100644 images/concrete7.tga delete mode 100644 images/floor-tiles.tga delete mode 100644 images/floor.json delete mode 100644 images/metal1.tga delete mode 100644 images/metal2.tga delete mode 100644 images/teak1.tga delete mode 100644 images/texel.tga delete mode 100644 images/tiles.tga delete mode 100644 images/wall1.tga delete mode 100644 images/wood1.tga delete mode 100644 images/wood2.tga diff --git a/CMakeLists.txt b/CMakeLists.txt index c427b13b..6a050c7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,7 +272,7 @@ endfunction() function(fm_install_assets) set(CMAKE_INSTALL_MESSAGE NEVER) - foreach(subdir images anim scenery vobj walls) + foreach(subdir images anim scenery vobj ground walls) fm_install_kill_directory("${subdir}") install(DIRECTORY "${subdir}" DESTINATION "share/floormat") endforeach() diff --git a/bench/bitmask.cpp b/bench/bitmask.cpp index 9efa25a9..6f80e992 100644 --- a/bench/bitmask.cpp +++ b/bench/bitmask.cpp @@ -12,7 +12,7 @@ namespace { [[maybe_unused]] void Bitmask(benchmark::State& state) { - auto img = loader.texture(loader.SCENERY_PATH, "door-close"_s); + auto img = loader.texture(loader.SCENERY_PATH, "door-close"_s, false); auto bitmask = anim_atlas::make_bitmask(img); anim_atlas::make_bitmask_(img, bitmask); diff --git a/draw/floor.cpp b/draw/floor.cpp deleted file mode 100644 index a073f39f..00000000 --- a/draw/floor.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "floor.hpp" -#include "shaders/shader.hpp" -#include "src/chunk.hpp" -#include "src/ground-atlas.hpp" -#include "compat/assert.hpp" -#include - -namespace floormat { - -floor_mesh::floor_mesh() = default; - -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 { - ground_atlas* atlas = nullptr; size_t pos = 0; } last; - GL::MeshView mesh{mesh_}; - - [[maybe_unused]] size_t draw_count = 0; - fm_debug_assert(size_t(mesh_.count()) == size*quad_index_count); - - const auto do_draw = [&](size_t i, ground_atlas* atlas, uint32_t max_index) { - if (atlas == last.atlas) - return; - if (auto len = i - last.pos; last.atlas && len > 0) - { - mesh.setCount((int)(quad_index_count * len)); - mesh.setIndexOffset((int)(last.pos*quad_index_count), 0, max_index); - shader.draw(last.atlas->texture(), mesh); - draw_count++; - } - last = { atlas, i }; - }; - - 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); - -//#define FM_DEBUG_DRAW_COUNT -#ifdef FM_DEBUG_DRAW_COUNT - if (draw_count) - fm_debug("floor draws: %zu", draw_count); -#endif -} - -} // namespace floormat diff --git a/draw/floor.hpp b/draw/floor.hpp deleted file mode 100644 index 74547857..00000000 --- a/draw/floor.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -namespace floormat { - -struct tile_shader; -struct chunk; - -struct floor_mesh final -{ - floor_mesh(); - - void draw(tile_shader& shader, chunk& c); -}; - -} // namespace floormat diff --git a/draw/ground.cpp b/draw/ground.cpp new file mode 100644 index 00000000..515729b1 --- /dev/null +++ b/draw/ground.cpp @@ -0,0 +1,49 @@ +#include "ground.hpp" +#include "shaders/shader.hpp" +#include "src/chunk.hpp" +#include "src/ground-atlas.hpp" +#include "compat/assert.hpp" +#include + +namespace floormat { + +ground_mesh::ground_mesh() = default; + +void ground_mesh::draw(tile_shader& shader, chunk& c) +{ + constexpr int quad_index_count = 6; + const auto [mesh_, ids, size] = c.ensure_ground_mesh(); + struct { + ground_atlas* atlas = nullptr; size_t pos = 0; } last; + GL::MeshView mesh{mesh_}; + + [[maybe_unused]] size_t draw_count = 0; + fm_debug_assert(size_t(mesh_.count()) == size*quad_index_count); + + const auto do_draw = [&](size_t i, ground_atlas* atlas, uint32_t max_index) { + if (atlas == last.atlas) + return; + if (auto len = i - last.pos; last.atlas && len > 0) + { + mesh.setCount((int)(quad_index_count * len)); + mesh.setIndexOffset((int)(last.pos*quad_index_count), 0, max_index); + shader.draw(last.atlas->texture(), mesh); + draw_count++; + } + last = { atlas, i }; + }; + + 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); + +//#define FM_DEBUG_DRAW_COUNT +#ifdef FM_DEBUG_DRAW_COUNT + if (draw_count) + fm_debug("ground draws: %zu", draw_count); +#endif +} + +} // namespace floormat diff --git a/draw/ground.hpp b/draw/ground.hpp new file mode 100644 index 00000000..b960e8b1 --- /dev/null +++ b/draw/ground.hpp @@ -0,0 +1,15 @@ +#pragma once + +namespace floormat { + +struct tile_shader; +struct chunk; + +struct ground_mesh final +{ + ground_mesh(); + + void draw(tile_shader& shader, chunk& c); +}; + +} // namespace floormat diff --git a/editor/draw.cpp b/editor/draw.cpp index c4f6a8a2..84ceef00 100644 --- a/editor/draw.cpp +++ b/editor/draw.cpp @@ -68,7 +68,7 @@ void app::draw_cursor() if (ed->is_anything_selected()) { shader.set_tint({1, 1, 1, 0.75f}); - auto [_f, _w, anim_mesh] = M->meshes(); + auto [_g, _w, anim_mesh] = M->meshes(); const auto offset = Vector3i(Vector2i(sel.offset), 0); const auto pos = Vector3i(tile)*iTILE_SIZE + offset; auto [ch, t] = w[tile]; @@ -86,7 +86,7 @@ void app::draw_cursor() const auto& atlas = vo->get_selected()->factory->atlas(); draw(_wireframe_quad, TILE_SIZE2); shader.set_tint({1, 1, 1, 0.75f}); - auto [_f, _w, anim_mesh] = M->meshes(); + auto [_g, _w, anim_mesh] = M->meshes(); const auto pos = Vector3i(tile)*iTILE_SIZE; anim_mesh.draw(shader, *atlas, rotation::N, 0, Vector3(pos), 1); } diff --git a/editor/ground-editor.cpp b/editor/ground-editor.cpp index 0f67853e..2a74952c 100644 --- a/editor/ground-editor.cpp +++ b/editor/ground-editor.cpp @@ -17,7 +17,7 @@ ground_editor::ground_editor() void ground_editor::load_atlases() { - for (const auto& atlas : loader.ground_atlases("floor.json"_s)) + for (const auto& atlas : loader.ground_atlases("ground.json"_s)) { auto& [_, vec] = _permutation; vec.reserve(atlas->num_tiles()); @@ -41,7 +41,7 @@ std::shared_ptr ground_editor::atlas(StringView str) fm_throw("no such atlas: {}"_cf, str); } -StringView ground_editor::name() const noexcept { return "floor"_s; } +StringView ground_editor::name() const noexcept { return "ground"_s; } void ground_editor::clear_selection() { diff --git a/editor/update.cpp b/editor/update.cpp index 1140ad47..6ecffc80 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -17,7 +17,7 @@ namespace floormat { void app::maybe_initialize_chunk_(const chunk_coords_& pos, chunk& c) { - auto floor1 = loader.ground_atlas("floor-tiles", { 44, 4 }, pass_mode::pass); + auto floor1 = loader.ground_atlas("ground-tiles", { 44, 4 }, pass_mode::pass); auto floor2 = loader.ground_atlas("metal1", { 2, 2 }, pass_mode::pass); auto wall1 = loader.ground_atlas("wood2", { 2, 1 }, pass_mode::blocked); auto wall2 = loader.ground_atlas("wood1", { 2, 1 }, pass_mode::blocked); diff --git a/floormat/main.hpp b/floormat/main.hpp index 1604ad22..27404fe3 100644 --- a/floormat/main.hpp +++ b/floormat/main.hpp @@ -17,7 +17,7 @@ struct world; struct scenery; class anim_atlas; struct clickable; -struct floor_mesh; +struct ground_mesh; struct wall_mesh; struct anim_mesh; struct texture_unit_cache; @@ -28,7 +28,7 @@ struct floormat_main { struct draw_bounds final { int16_t minx, maxx, miny, maxy; }; struct meshes final { - floor_mesh& floor; + ground_mesh& ground; wall_mesh& wall; anim_mesh& anim; }; diff --git a/ground/concrete1.tga b/ground/concrete1.tga new file mode 100644 index 00000000..e7856645 Binary files /dev/null and b/ground/concrete1.tga differ diff --git a/ground/concrete6.tga b/ground/concrete6.tga new file mode 100644 index 00000000..91b332dd Binary files /dev/null and b/ground/concrete6.tga differ diff --git a/ground/concrete7.tga b/ground/concrete7.tga new file mode 100644 index 00000000..476dcec0 Binary files /dev/null and b/ground/concrete7.tga differ diff --git a/ground/floor-tiles.tga b/ground/floor-tiles.tga new file mode 100644 index 00000000..1a0a6d79 Binary files /dev/null and b/ground/floor-tiles.tga differ diff --git a/ground/ground.json b/ground/ground.json new file mode 100644 index 00000000..9d9e0c2e --- /dev/null +++ b/ground/ground.json @@ -0,0 +1,23 @@ +[ + { + "name": "floor-tiles", + "size": "44 x 4" + }, + { + "name": "tiles", + "size": "8 x 5" + }, + { + "name": "texel", + "size": "2 x 2", + "pass-mode": "blocked" + }, + { + "name": "metal1", + "size": "2 x 2" + }, + { + "name": "concrete6", + "size": "4 x 4" + } +] diff --git a/ground/metal1.tga b/ground/metal1.tga new file mode 100644 index 00000000..d305638d Binary files /dev/null and b/ground/metal1.tga differ diff --git a/ground/metal2.tga b/ground/metal2.tga new file mode 100644 index 00000000..6e9b64e9 Binary files /dev/null and b/ground/metal2.tga differ diff --git a/ground/teak1.tga b/ground/teak1.tga new file mode 100644 index 00000000..df1927c6 Binary files /dev/null and b/ground/teak1.tga differ diff --git a/ground/texel.tga b/ground/texel.tga new file mode 100644 index 00000000..99314406 Binary files /dev/null and b/ground/texel.tga differ diff --git a/ground/tiles.tga b/ground/tiles.tga new file mode 100644 index 00000000..1376a27c Binary files /dev/null and b/ground/tiles.tga differ diff --git a/ground/wall1.tga b/ground/wall1.tga new file mode 100644 index 00000000..44f3566d Binary files /dev/null and b/ground/wall1.tga differ diff --git a/ground/wood1.tga b/ground/wood1.tga new file mode 100644 index 00000000..6c28183c Binary files /dev/null and b/ground/wood1.tga differ diff --git a/ground/wood2.tga b/ground/wood2.tga new file mode 100644 index 00000000..e8c689d2 Binary files /dev/null and b/ground/wood2.tga differ diff --git a/images/concrete1.tga b/images/concrete1.tga deleted file mode 100644 index e7856645..00000000 Binary files a/images/concrete1.tga and /dev/null differ diff --git a/images/concrete6.tga b/images/concrete6.tga deleted file mode 100644 index 91b332dd..00000000 Binary files a/images/concrete6.tga and /dev/null differ diff --git a/images/concrete7.tga b/images/concrete7.tga deleted file mode 100644 index 476dcec0..00000000 Binary files a/images/concrete7.tga and /dev/null differ diff --git a/images/floor-tiles.tga b/images/floor-tiles.tga deleted file mode 100644 index 1a0a6d79..00000000 Binary files a/images/floor-tiles.tga and /dev/null differ diff --git a/images/floor.json b/images/floor.json deleted file mode 100644 index 9d9e0c2e..00000000 --- a/images/floor.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "name": "floor-tiles", - "size": "44 x 4" - }, - { - "name": "tiles", - "size": "8 x 5" - }, - { - "name": "texel", - "size": "2 x 2", - "pass-mode": "blocked" - }, - { - "name": "metal1", - "size": "2 x 2" - }, - { - "name": "concrete6", - "size": "4 x 4" - } -] diff --git a/images/metal1.tga b/images/metal1.tga deleted file mode 100644 index d305638d..00000000 Binary files a/images/metal1.tga and /dev/null differ diff --git a/images/metal2.tga b/images/metal2.tga deleted file mode 100644 index 6e9b64e9..00000000 Binary files a/images/metal2.tga and /dev/null differ diff --git a/images/teak1.tga b/images/teak1.tga deleted file mode 100644 index df1927c6..00000000 Binary files a/images/teak1.tga and /dev/null differ diff --git a/images/texel.tga b/images/texel.tga deleted file mode 100644 index 99314406..00000000 Binary files a/images/texel.tga and /dev/null differ diff --git a/images/tiles.tga b/images/tiles.tga deleted file mode 100644 index 1376a27c..00000000 Binary files a/images/tiles.tga and /dev/null differ diff --git a/images/wall1.tga b/images/wall1.tga deleted file mode 100644 index 44f3566d..00000000 Binary files a/images/wall1.tga and /dev/null differ diff --git a/images/wood1.tga b/images/wood1.tga deleted file mode 100644 index 6c28183c..00000000 Binary files a/images/wood1.tga and /dev/null differ diff --git a/images/wood2.tga b/images/wood2.tga deleted file mode 100644 index e8c689d2..00000000 Binary files a/images/wood2.tga and /dev/null differ diff --git a/loader/atlas.cpp b/loader/atlas.cpp index c7bfbdbf..eb368952 100644 --- a/loader/atlas.cpp +++ b/loader/atlas.cpp @@ -56,9 +56,9 @@ std::shared_ptr loader_impl::ground_atlas(StringView name, Vector2 fm_soft_assert(check_atlas_name(name)); char buf[FILENAME_MAX]; - auto path = make_atlas_path(buf, IMAGE_PATH, name); + auto path = make_atlas_path(buf, GROUND_TILESET_PATH, name); - auto atlas = std::make_shared(path, name, texture(""_s, path), size, pass); + auto atlas = std::make_shared(path, name, texture(""_s, path, false), size, pass); ground_atlas_map[atlas->name()] = atlas; return atlas; } @@ -107,7 +107,7 @@ std::shared_ptr loader_impl::anim_atlas(StringView name, StringView } } - auto tex = texture(""_s, path); + auto tex = texture(""_s, path, false); fm_soft_assert(!anim_info.object_name.isEmpty()); fm_soft_assert(anim_info.pixel_size.product() > 0); diff --git a/loader/impl.hpp b/loader/impl.hpp index 165b7c2f..ad82e46d 100644 --- a/loader/impl.hpp +++ b/loader/impl.hpp @@ -42,7 +42,7 @@ struct loader_impl final : loader_ StringView shader(StringView filename) noexcept override; Trade::ImageData2D make_error_texture(Vector2ui size); - Trade::ImageData2D texture(StringView prefix, StringView filename, bool fail_ok = true) noexcept(false) override; + Trade::ImageData2D texture(StringView prefix, StringView filename) noexcept(false) override; // >-----> walls >-----> struct wall_index { uint32_t val = (uint32_t)-1; }; @@ -55,7 +55,7 @@ struct loader_impl final : loader_ std::shared_ptr wall_atlas(StringView name, bool fail_ok = true) override; ArrayView wall_atlas_list() override; void get_wall_atlas_list(); - const wall_info& make_invalid_wall_atlas(); + const wall_info& make_invalid_wall_atlas() noexcept override; std::shared_ptr get_wall_atlas(StringView name, StringView path); // >-----> tile >-----> @@ -64,7 +64,7 @@ struct loader_impl final : loader_ ArrayView> ground_atlases(StringView filename) noexcept(false) override; std::shared_ptr ground_atlas(StringView filename, Vector2ub size, pass_mode pass) noexcept(false) override; - std::shared_ptr ground_atlas(StringView filename) noexcept(false) override; + std::shared_ptr ground_atlas(StringView filename, bool fail_ok) noexcept(false) override; // >-----> anim >-----> tsl::robin_map> anim_atlas_map; diff --git a/loader/json.cpp b/loader/json.cpp index 8e2f329f..ed15edbc 100644 --- a/loader/json.cpp +++ b/loader/json.cpp @@ -58,7 +58,7 @@ ArrayView> loader_impl::ground_atlases if (!ground_atlas_array.empty()) [[likely]] return ground_atlas_array; ground_atlas_array = json_helper::from_json>>( - Path::join(loader_::IMAGE_PATH, filename)); + Path::join(loader_::GROUND_TILESET_PATH, filename)); fm_assert(!ground_atlas_array.empty()); return ground_atlas_array; } diff --git a/loader/loader.cpp b/loader/loader.cpp index 71be9b16..80599c3d 100644 --- a/loader/loader.cpp +++ b/loader/loader.cpp @@ -24,24 +24,27 @@ loader_::~loader_() noexcept = default; StringView loader_::strip_prefix(StringView name) { - if (name.hasPrefix(IMAGE_PATH)) - return name.exceptPrefix(IMAGE_PATH.size()); + if (name.hasPrefix(IMAGE_PATH_)) + return name.exceptPrefix(IMAGE_PATH_.size()); if (name.hasPrefix(ANIM_PATH)) return name.exceptPrefix(ANIM_PATH.size()); if (name.hasPrefix(SCENERY_PATH)) return name.exceptPrefix(SCENERY_PATH.size()); if (name.hasPrefix(VOBJ_PATH)) return name.exceptPrefix(VOBJ_PATH.size()); + if (name.hasPrefix(GROUND_TILESET_PATH)) + return name.exceptPrefix(GROUND_TILESET_PATH.size()); if (name.hasPrefix(WALL_TILESET_PATH)) return name.exceptPrefix(WALL_TILESET_PATH.size()); return name; } -const StringView loader_::IMAGE_PATH = "images/"_s; +const StringView loader_::IMAGE_PATH_ = "images/"_s; const StringView loader_::ANIM_PATH = "anim/"_s; const StringView loader_::SCENERY_PATH = "scenery/"_s; const StringView loader_::TEMP_PATH = "../../../"_s; const StringView loader_::VOBJ_PATH = "vobj/"_s; +const StringView loader_::GROUND_TILESET_PATH = "ground/"_s; const StringView loader_::WALL_TILESET_PATH = "walls/"_s; } // namespace floormat diff --git a/loader/loader.hpp b/loader/loader.hpp index 63b5ea5c..fc58e61a 100644 --- a/loader/loader.hpp +++ b/loader/loader.hpp @@ -23,11 +23,12 @@ struct wall_info; struct loader_ { virtual StringView shader(StringView filename) noexcept = 0; - virtual Trade::ImageData2D texture(StringView prefix, StringView filename, bool fail_ok = true) noexcept(false) = 0; + virtual Trade::ImageData2D texture(StringView prefix, StringView filename) noexcept(false) = 0; virtual std::shared_ptr ground_atlas(StringView filename, Vector2ub size, pass_mode pass) noexcept(false) = 0; - virtual std::shared_ptr ground_atlas(StringView filename) noexcept(false) = 0; + virtual std::shared_ptr ground_atlas(StringView filename, bool fail_ok = false) noexcept(false) = 0; virtual ArrayView anim_atlas_list() = 0; virtual std::shared_ptr anim_atlas(StringView name, StringView dir = ANIM_PATH) noexcept(false) = 0; + virtual const wall_info& make_invalid_wall_atlas() noexcept = 0; virtual std::shared_ptr wall_atlas(StringView name, bool fail_ok = true) noexcept(false) = 0; virtual ArrayView wall_atlas_list() = 0; static void destroy(); @@ -47,11 +48,12 @@ struct loader_ virtual ~loader_() noexcept; - static const StringView IMAGE_PATH; + static const StringView IMAGE_PATH_; static const StringView ANIM_PATH; static const StringView SCENERY_PATH; static const StringView TEMP_PATH; static const StringView VOBJ_PATH; + static const StringView GROUND_TILESET_PATH; static const StringView WALL_TILESET_PATH; protected: diff --git a/loader/vobj.cpp b/loader/vobj.cpp index 9aa6fb39..a309fd6a 100644 --- a/loader/vobj.cpp +++ b/loader/vobj.cpp @@ -46,7 +46,7 @@ namespace floormat::loader_detail { std::shared_ptr loader_impl::make_vobj_anim_atlas(StringView name, StringView image_filename) { - auto tex = texture(VOBJ_PATH, image_filename); + auto tex = texture(VOBJ_PATH, image_filename, false); anim_def def; def.object_name = name; const auto size = tex.pixels().size(); diff --git a/loader/wall-atlas.cpp b/loader/wall-atlas.cpp index 66dc3ba5..7d423b26 100644 --- a/loader/wall-atlas.cpp +++ b/loader/wall-atlas.cpp @@ -46,7 +46,7 @@ std::shared_ptr loader_impl::get_wall_atlas(StringView name, StringV char buf[FILENAME_MAX]; auto filename = make_atlas_path(buf, path, name); auto def = wall_atlas_def::deserialize(""_s.join({filename, ".json"_s})); - auto tex = texture(""_s, filename, false); + auto tex = texture(""_s, filename); fm_soft_assert(name == def.header.name); fm_soft_assert(!def.frames.empty()); @@ -54,7 +54,7 @@ std::shared_ptr loader_impl::get_wall_atlas(StringView name, StringV return atlas; } -const wall_info& loader_impl::make_invalid_wall_atlas() +const wall_info& loader_impl::make_invalid_wall_atlas() noexcept { if (invalid_wall_atlas) [[likely]] return *invalid_wall_atlas; diff --git a/main/draw.cpp b/main/draw.cpp index 98fd861e..4de42473 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -178,7 +178,7 @@ void main_impl::draw_world() noexcept const with_shifted_camera_offset o{_shader, ch, {minx, miny}, {maxx, maxy}}; if (check_chunk_visible(_shader.camera_offset(), sz)) { - _floor_mesh.draw(_shader, c); + _ground_mesh.draw(_shader, c); _wall_mesh.draw(_shader, c); } } diff --git a/main/main-impl.hpp b/main/main-impl.hpp index f66b0248..8aaf6312 100644 --- a/main/main-impl.hpp +++ b/main/main-impl.hpp @@ -2,7 +2,7 @@ #include "floormat/main.hpp" #include "floormat/settings.hpp" #include "src/world.hpp" -#include "draw/floor.hpp" +#include "draw/ground.hpp" #include "draw/wall.hpp" #include "draw/anim.hpp" #include "shaders/texture-unit-cache.hpp" @@ -111,7 +111,7 @@ private: struct world _world{}; Magnum::Timeline timeline; uint32_t _mouse_cursor = (uint32_t)-1; - floor_mesh _floor_mesh; + ground_mesh _ground_mesh; wall_mesh _wall_mesh; anim_mesh _anim_mesh; #ifdef FM_USE_DEPTH32 diff --git a/main/setup.cpp b/main/setup.cpp index 15b34b2b..45f941cb 100644 --- a/main/setup.cpp +++ b/main/setup.cpp @@ -100,7 +100,7 @@ void main_impl::update_window_state() auto main_impl::meshes() noexcept -> struct meshes { - return { _floor_mesh, _wall_mesh, _anim_mesh, }; + return { _ground_mesh, _wall_mesh, _anim_mesh, }; }; struct world& main_impl::reset_world() noexcept diff --git a/test/bitmask.cpp b/test/bitmask.cpp index ef8f3b1c..0fae6a23 100644 --- a/test/bitmask.cpp +++ b/test/bitmask.cpp @@ -23,7 +23,7 @@ static_assert(data_nbytes == 128); void bitmask_test() { - auto img = loader.texture(loader.SCENERY_PATH, "door-close"_s); + auto img = loader.texture(loader.SCENERY_PATH, "door-close"_s, false); auto bitmask = anim_atlas::make_bitmask(img); fm_assert(img.pixelSize() == 4 && (size_t)img.size().product() >= data_nbytes); #ifdef DO_GENERATE diff --git a/test/loader.cpp b/test/loader.cpp index 88fa2b32..f400ecb3 100644 --- a/test/loader.cpp +++ b/test/loader.cpp @@ -8,7 +8,7 @@ namespace floormat { void test_app::test_loader() { - (void)loader.ground_atlases("floor.json"); + (void)loader.ground_atlases("ground.json"); fm_assert(loader.ground_atlas("texel")->pass_mode() == pass_mode::blocked); fm_assert(loader.ground_atlas("metal1")->pass_mode() == pass_mode::pass); loader.sceneries(); -- cgit v1.2.3