mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-04-10 06:14:07 +08:00
feat: add frustum culling
This commit is contained in:
@@ -11,6 +11,7 @@ private:
|
||||
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;
|
||||
public:
|
||||
|
||||
World();
|
||||
@@ -20,8 +21,10 @@ public:
|
||||
const std::optional<LookBlock>& get_look_block_pos(const std::string& name) const;
|
||||
Player& get_player(const std::string& name);
|
||||
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 render();
|
||||
|
||||
void render(const glm::mat4& mvp_matrix);
|
||||
void set_block(const glm::ivec3& pos, unsigned id);
|
||||
void update(float delta_time);
|
||||
|
||||
|
||||
5
include/Cubed/tools/math_tools.hpp
Normal file
5
include/Cubed/tools/math_tools.hpp
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
#include <glm/glm.hpp>
|
||||
namespace Math {
|
||||
void extract_frustum_planes(const glm::mat4& mvp_matrix, std::vector<glm::vec4>& planes);
|
||||
}
|
||||
Reference in New Issue
Block a user