blob: cc37e8c82a6a06eae1b2c0e569315a7476075480 (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include "impl.hpp"
#include "compat/assert.hpp"
#include "ground-traits.hpp"
#include "ground-cell.hpp"
#include "wall-traits.hpp"
#include "wall-cell.hpp"
#include "anim-traits.hpp"
#include "anim-cell.hpp"
#include "scenery-traits.hpp"
#include "scenery-cell.hpp"
// todo scenery_traits
#include "vobj-cell.hpp"
#include "atlas-loader.hpp"
#include "atlas-loader-storage.hpp"
#include "serialize/json-wrapper.hpp"
namespace floormat {
} // namespace floormat
namespace floormat::loader_detail {
StringView loader_impl::shader(StringView filename) noexcept
{
if (!shader_res)
shader_res = Optional<Utility::Resource>(InPlaceInit, "floormat/shaders");
auto ret = shader_res->getString(filename);
if (ret.isEmpty())
fm_abort("can't find shader resource '%s'", filename.cbegin());
return ret;
}
loader_impl::loader_impl()
{
system_init();
set_application_working_directory();
}
loader_impl::~loader_impl() = default;
void loader_impl::ensure_plugins()
{
if (importer_plugins)
return;
importer_plugins.emplace();
image_importer = importer_plugins->loadAndInstantiate("StbImageImporter");
tga_importer = importer_plugins->loadAndInstantiate("TgaImporter");
fm_assert(image_importer);
fm_assert(tga_importer);
}
void loader_impl::destroy()
{
_ground_loader = {InPlace};
_wall_loader = {InPlace};
_anim_loader = {InPlace};
_scenery_loader = {InPlace};
vobj_atlas_map.clear();
vobjs.clear();
}
} // namespace floormat::loader_detail
|