summaryrefslogtreecommitdiff
path: root/src/world.hpp
blob: 12e0285680c268d7e0fd22e2bd7bfa1ca22ed1e1 (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
#pragma once

#include "xe_game_object.hpp"
#include "chunk_renderer.hpp"
#include "chunk.hpp"

#include <vector>

namespace app {

class World {

  public:

    World(xe::GameObject& viewer, int renderDistance, int worldSeed);
    ~World();

    void reloadChunks();
    void reloadChunks(int newRenderDistance);
    
    void render(xe::Camera& camera);

  private:

    void resetChunks();

    void unloadOldChunks();
    void loadNewChunks();
    void updateChunkMeshs();

    int viewX, viewZ;

    int worldSeed;
    int renderDistance;
    
    const xe::GameObject& viewer;
    std::vector<xe::GameObject> loadedChunks;

    ChunkRenderer chunkRenderer;

};

}