blob: 7e29616bfe2e4997b0db29af41bbdc7c1d0f9ebc (
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
|
#include "impl.hpp"
#include "compat/assert.hpp"
#include "loader/scenery.hpp"
#include <cstring>
#include <Corrade/Containers/Pair.h>
#include <Magnum/Trade/ImageData.h>
#ifdef __GNUG__
#pragma GCC diagnostic ignored "-Walloca"
#endif
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);
}
} // namespace floormat::loader_detail
|