minecraftvulkan/src/world.hpp

55 lines
887 B
C++
Raw Permalink Normal View History

2022-10-01 20:28:38 +00:00
#pragma once
#include "xe_game_object.hpp"
2022-10-03 10:50:49 +00:00
#include "skinned_renderer.hpp"
2022-10-01 20:28:38 +00:00
#include "chunk.hpp"
2022-10-03 10:50:49 +00:00
#define GLM_FORCE_RADIANS
#include <glm/common.hpp>
#include <glm/fwd.hpp>
#include <glm/geometric.hpp>
2022-10-01 20:28:38 +00:00
#include <vector>
namespace app {
class World {
public:
2022-10-03 10:50:49 +00:00
struct Ray {
glm::ivec3 pos;
int hit;
};
2022-10-01 20:28:38 +00:00
World(xe::GameObject& viewer, int renderDistance, int worldSeed);
~World();
void reloadChunks();
void reloadChunks(int newRenderDistance);
void render(xe::Camera& camera);
2022-10-03 10:50:49 +00:00
Ray raycast(float distance, int steps);
2022-10-01 20:28:38 +00:00
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;
2022-10-03 10:50:49 +00:00
SkinnedRenderer skinnedRenderer;
2022-10-01 20:28:38 +00:00
};
}