10#define GLM_ENABLE_EXPERIMENTAL
12#include <glm/gtx/hash.hpp>
17#include <unordered_map>
50 const glm::ivec3 & pos,
51 const uint32_t normal,
52 const glm::ivec2 & texCoord,
53 const uint32_t texLayer,
59 data[0] |=
static_cast<uint64_t
>(pos.x) & 0b11111;
60 data[0] |= (
static_cast<uint64_t
>(pos.y) & 0b1111111111) << 5;
61 data[0] |= (
static_cast<uint64_t
>(pos.z) & 0b11111) << 15;
62 data[0] |= (
static_cast<uint64_t
>(normal) & 0b111) << 20;
63 data[0] |= (
static_cast<uint64_t
>(texCoord.x) & 0b11111) << 23;
64 data[0] |= (
static_cast<uint64_t
>(texCoord.y) & 0b11111) << 28;
65 data[0] |= (
static_cast<uint64_t
>(light) & 0xFF) << 33;
66 data[0] |= (
static_cast<uint64_t
>(ao) & 0b11) << 41;
68 data[1] |= (
static_cast<uint64_t
>(texLayer) & 0xFFFFFFFF);
78 VkVertexInputBindingDescription bindingDescription{};
79 bindingDescription.binding = 0;
81 bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
83 return bindingDescription;
88 std::vector<VkVertexInputAttributeDescription> attributeDescriptions(1);
90 attributeDescriptions[0].binding = 0;
91 attributeDescriptions[0].location = 0;
92 attributeDescriptions[0].format = VK_FORMAT_R64G64_UINT;
95 return attributeDescriptions;
220 uint8_t
getLight(
const int x,
const int y,
const int z);
221 uint8_t
getLight(
const glm::ivec3 & pos);
228 const glm::ivec3 & start,
229 const glm::ivec3 & max_iter,
230 const std::array<int, 6> & indices_order,
231 const std::array<int, 6> & indices_order_fliped,
232 const glm::ivec3 & abs_normal,
233 const int normal_signe,
240 const glm::ivec3 & start,
241 const glm::ivec3 & max_iter,
242 const std::array<int, 6> & indices_order,
243 const std::array<int, 6> & indices_order_fliped,
244 const glm::ivec3 & abs_normal,
245 const int normal_signe,
250 const glm::ivec3 & pos,
261 const glm::ivec3 & pos,
265 uint8_t
getLight(uint8_t pos, uint8_t side_1, uint8_t side_2, uint8_t corner);
268 std::vector<std::vector<std::vector<std::shared_ptr<Chunk>>>>
chunks;
285 std::array<uint8_t, 4> ao;
286 std::array<uint8_t, 4> light;
288 bool operator==(
const FaceData & other)
const
290 return texture == other.texture && ao == other.ao && light == other.light;
294 std::vector<std::vector<std::vector<FaceData>>> face_data;
uint32_t TextureID
Definition: Block.hpp:10
std::unordered_map< glm::ivec3, std::shared_ptr< Chunk > > ChunkMap
Definition: Chunk.hpp:177
Type
Definition: Block.hpp:33
Definition: CreateMeshData.hpp:180
std::shared_ptr< Chunk > getCenterChunk()
Definition: CreateMeshData.hpp:275
std::vector< uint32_t > indices
Definition: CreateMeshData.hpp:270
std::vector< std::vector< std::vector< std::shared_ptr< Chunk > > > > chunks
Definition: CreateMeshData.hpp:268
std::vector< uint32_t > water_indices
Definition: CreateMeshData.hpp:273
uint8_t getLight(const int x, const int y, const int z)
Definition: CreateMeshData.cpp:127
@ NEG
Definition: CreateMeshData.hpp:188
@ POS
Definition: CreateMeshData.hpp:186
@ NEUT
Definition: CreateMeshData.hpp:187
~CreateMeshData()
Definition: CreateMeshData.cpp:44
Dimensions
Definition: CreateMeshData.hpp:192
CreateMeshData & operator=(const CreateMeshData &)=delete
CreateMeshData(const CreateMeshData &)=delete
void create()
Definition: CreateMeshData.cpp:150
BlockInfo::Type getBlock(const int x, const int y, const int z)
Definition: CreateMeshData.cpp:104
void createFace(const int dim_1, const int dim_2, const glm::ivec3 &start, const glm::ivec3 &max_iter, const std::array< int, 6 > &indices_order, const std::array< int, 6 > &indices_order_fliped, const glm::ivec3 &abs_normal, const int normal_signe, const int face)
Definition: CreateMeshData.cpp:308
std::vector< BlockVertex > water_vertices
Definition: CreateMeshData.hpp:272
std::vector< BlockVertex > vertices
Definition: CreateMeshData.hpp:269
void unlock()
Definition: CreateMeshData.cpp:81
std::array< uint8_t, 4 > getAmbientOcclusion(const glm::ivec3 &pos, const int dim_1, const int dim_2)
Definition: CreateMeshData.cpp:684
void createFaceWater(const int dim_1, const int dim_2, const glm::ivec3 &start, const glm::ivec3 &max_iter, const std::array< int, 6 > &indices_order, const std::array< int, 6 > &indices_order_fliped, const glm::ivec3 &abs_normal, const int normal_signe, const int face)
Definition: CreateMeshData.cpp:502
Definition: CreateMeshData.hpp:46
BlockVertex(const glm::ivec3 &pos, const uint32_t normal, const glm::ivec2 &texCoord, const uint32_t texLayer, const uint8_t ao, const uint8_t light)
Definition: CreateMeshData.hpp:49
static VkVertexInputBindingDescription getBindingDescription()
Definition: CreateMeshData.hpp:76
static constexpr uint32_t getMaxTextureCoord()
Definition: CreateMeshData.hpp:71
uint64_t data[2]
Definition: CreateMeshData.hpp:47
static std::vector< VkVertexInputAttributeDescription > getAttributeDescriptions()
Definition: CreateMeshData.hpp:86