mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-11 14:43:34 +00:00
optimizing chunk mesh
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
#include <ScopGraphics.h>
|
||||
#include <ScopMaths.h>
|
||||
|
||||
constexpr Scop::Vec3ui CHUNK_SIZE = Scop::Vec3ui{ 32, 32, 32 };
|
||||
constexpr std::uint32_t CHUNK_VOLUME = CHUNK_SIZE.x * CHUNK_SIZE.y * CHUNK_SIZE.z;
|
||||
constexpr Scop::Vec3ui CHUNK_SIZE = Scop::Vec3ui{ 32, 256, 32 };
|
||||
constexpr Scop::Vec3ui CHUNK_SIZE_HALF = CHUNK_SIZE / 2 ;
|
||||
|
||||
class Chunk
|
||||
{
|
||||
@@ -19,13 +19,14 @@ class Chunk
|
||||
void UploadMesh();
|
||||
[[nodiscard]] std::uint32_t GetBlock(Scop::Vec3i position) const noexcept;
|
||||
[[nodiscard]] inline Scop::NonOwningPtr<Scop::Actor> GetActor() const noexcept { return p_actor; }
|
||||
[[nodiscard]] inline Scop::Vec2i GetPosition() const noexcept { return m_position; }
|
||||
|
||||
~Chunk() = default;
|
||||
|
||||
private:
|
||||
std::vector<Scop::Vertex> m_mesh_data;
|
||||
std::vector<std::uint32_t> m_mesh_index_data;
|
||||
std::vector<std::uint32_t> m_data;
|
||||
std::vector<std::vector<std::vector<std::uint32_t>>> m_data;
|
||||
Scop::Vec2i m_offset; // In chunks
|
||||
Scop::Vec2i m_position; // In blocks
|
||||
class World& m_world;
|
||||
|
||||
Reference in New Issue
Block a user