#pragma once #include #include #include #include #include #include "graphics/core/MeshData.hpp" #include "util/Buffer.hpp" /// @brief Chunk mesh vertex format struct ChunkVertex { glm::vec3 position; glm::vec2 uv; std::array color; std::array normal; static constexpr VertexAttribute ATTRIBUTES[] = { {VertexAttribute::Type::FLOAT, false, 3}, {VertexAttribute::Type::FLOAT, false, 2}, {VertexAttribute::Type::UNSIGNED_BYTE, true, 4}, {VertexAttribute::Type::UNSIGNED_BYTE, true, 4}, {{}, 0}}; }; template class Mesh; struct SortingMeshEntry { glm::vec3 position; util::Buffer vertexData; long long distance; inline bool operator<(const SortingMeshEntry &o) const noexcept { return distance > o.distance; } }; struct SortingMeshData { std::vector entries; }; struct ChunkMeshData { MeshData mesh; SortingMeshData sortingMesh; }; struct ChunkMesh { std::unique_ptr > mesh; SortingMeshData sortingMeshData; std::unique_ptr > sortedMesh = nullptr; };