mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
fear: add r to gen new chunk
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
#pragma once
|
||||
constexpr int WORLD_SIZE_X = 32;
|
||||
constexpr int WORLD_SIZE_Z = 32;
|
||||
constexpr int WORLD_SIZE_Y = 256;
|
||||
constexpr int MAX_BLOCK_NUM = 2;
|
||||
constexpr int MAX_UI_NUM = 1;
|
||||
|
||||
@@ -9,10 +9,18 @@ class Player;
|
||||
|
||||
class World {
|
||||
private:
|
||||
bool need_gen_chunk = false;
|
||||
|
||||
BlockRenderData m_block_render_data;
|
||||
std::unordered_map<ChunkPos , Chunk, ChunkPos::Hash> m_chunks;
|
||||
std::unordered_map<std::size_t, Player> m_players;
|
||||
std::vector<glm::vec4> m_planes;
|
||||
|
||||
std::pair<int, int> chunk_pos(int world_x, int world_z);
|
||||
void gen_chunks();
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
World();
|
||||
@@ -24,8 +32,10 @@ public:
|
||||
void init_world();
|
||||
bool is_aabb_in_frustum(const glm::vec3& center, const glm::vec3& half_extents);
|
||||
bool is_block(const glm::ivec3& block_pos) const;
|
||||
|
||||
|
||||
void need_gen();
|
||||
void render(const glm::mat4& mvp_matrix);
|
||||
|
||||
void set_block(const glm::ivec3& pos, unsigned id);
|
||||
void update(float delta_time);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user