summaryrefslogtreecommitdiffhomepage
path: root/loader/impl.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-07 23:38:31 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-08 08:43:49 +0100
commita6514d1a95d0f84f0935866215463ef6aed23e19 (patch)
tree639075646b1ea42a3cd4a76ae59af7dda0c4b14a /loader/impl.cpp
parent4575194adb4615deeca174044a872093c3664ad4 (diff)
loader: work toward removing duplicate atlas code
Diffstat (limited to 'loader/impl.cpp')
-rw-r--r--loader/impl.cpp38
1 files changed, 32 insertions, 6 deletions
diff --git a/loader/impl.cpp b/loader/impl.cpp
index 7da85f3f..543f0794 100644
--- a/loader/impl.cpp
+++ b/loader/impl.cpp
@@ -1,9 +1,13 @@
#include "impl.hpp"
#include "compat/assert.hpp"
-#include "loader/scenery.hpp"
-#include "loader/wall-info.hpp"
-#include "loader/anim-info.hpp"
-#include "src/ground-atlas.hpp"
+#include "scenery.hpp"
+#include "wall-cell.hpp"
+#include "anim-cell.hpp"
+#include "ground-cell.hpp"
+#include "ground-traits.hpp"
+#include "atlas-loader.hpp"
+#include "atlas-loader-storage.hpp"
+
#include <Corrade/Containers/Pair.h>
#include <Magnum/Trade/ImageData.h>
@@ -11,6 +15,10 @@
#pragma GCC diagnostic ignored "-Walloca"
#endif
+namespace floormat {
+
+} // namespace floormat
+
namespace floormat::loader_detail {
StringView loader_impl::shader(StringView filename) noexcept
@@ -23,9 +31,9 @@ StringView loader_impl::shader(StringView filename) noexcept
return ret;
}
-loader_impl::loader_impl()
+loader_impl::loader_impl() :
+ _ground_loader{ make_ground_atlas_loader() }
{
- missing_ground_atlases.reserve(32);
missing_wall_atlases.reserve(32);
system_init();
set_application_working_directory();
@@ -46,4 +54,22 @@ void loader_impl::ensure_plugins()
fm_assert(tga_importer);
}
+void loader_impl::destroy()
+{
+ wall_atlas_map.clear();
+ wall_atlas_array.clear();
+ invalid_wall_atlas = nullptr;
+ missing_wall_atlases.clear();
+ _ground_loader = {InPlace};
+ anim_atlas_map.clear();
+ anim_atlases.clear();
+ invalid_anim_atlas = nullptr;
+ sceneries_map.clear();
+ sceneries_array.clear();
+
+ vobj_atlas_map.clear();
+ vobjs.clear();
+}
+
+
} // namespace floormat::loader_detail