]> git.localhorst.tv Git - blank.git/blob - shared/shared.cpp
new gcc version
[blank.git] / shared / shared.cpp
1 #include "ResourceIndex.hpp"
2 #include "WorldResources.hpp"
3
4 #include "../app/Assets.hpp"
5
6
7 namespace blank {
8
9 ResourceIndex::ResourceIndex()
10 : id_map() {
11
12 }
13
14 std::size_t ResourceIndex::GetID(const std::string &name) {
15         auto entry = id_map.find(name);
16         if (entry == id_map.end()) {
17                 auto result = id_map.emplace(name, Size());
18                 return result.first->second;
19         } else {
20                 return entry->second;
21         }
22 }
23
24
25 WorldResources::WorldResources()
26 : shapes()
27 , block_types()
28 , models()
29 , snd_index()
30 , tex_index() {
31
32 }
33
34 void WorldResources::Load(const AssetLoader &loader, const std::string &set_name) {
35         loader.LoadShapes(set_name, shapes);
36         loader.LoadBlockTypes(set_name, block_types, snd_index, tex_index, shapes);
37         loader.LoadModels(set_name, models, tex_index, shapes);
38 }
39
40 }