1 #include "app/Assets.hpp"
2 #include "shared/WorldResources.hpp"
3 #include "world/Chunk.hpp"
4 #include "world/Generator.hpp"
8 #include <glm/gtx/io.hpp>
10 using namespace blank;
12 using namespace chrono;
16 AssetLoader loader("assets/");
18 res.Load(loader, "default");
19 Generator::Config conf;
21 gen.LoadTypes(res.block_types);
22 Chunk chunk(res.block_types);
24 const ExactLocation::Coarse begin(-6);
25 const ExactLocation::Coarse end(6);
26 size_t total_chunks = ((end.x - begin.x) * (end.y - begin.y) * (end.z - begin.z));
28 size_t candidates = 0;
29 for (const BlockType &type : res.block_types) {
35 cout << "generating " << total_chunks << " chunks from " << begin << " to " << (end - 1) << endl;
36 cout << candidates << " of " << res.block_types.size() << " block types applicable for generation" << endl;
37 auto enter = high_resolution_clock::now();
39 for (int z = begin.z; z < end.z; ++z) {
40 for (int y = begin.y; y < end.y; ++y) {
41 for (int x = begin.x; x < end.x; ++x) {
42 chunk.Position({ x, y, z });
48 auto exit = high_resolution_clock::now();
49 cout << duration_cast<milliseconds>(exit - enter).count() << "ms ("
50 << (duration_cast<nanoseconds>(exit - enter).count() / total_chunks / 1.0e6f) << "ms chunk avg)" << endl;