This commit is contained in:
Martin Slachta
2026-07-18 14:31:15 +02:00
commit a04f0dc262
3343 changed files with 1140208 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#pragma once
#include <vector>
#include <cstdint>
#include <glm/glm.hpp>
namespace tw {
#define CHUNK_WIDTH 16
struct ChunkData {
using Type = uint8_t;
std::vector<Type> data;
ChunkData() : data(CHUNK_WIDTH * CHUNK_WIDTH * CHUNK_WIDTH)
{ }
Type get(glm::ivec3 position) {
assert(position.x >= 0 && position.x < CHUNK_WIDTH);
assert(position.y >= 0 && position.y < CHUNK_WIDTH);
assert(position.z >= 0 && position.z < CHUNK_WIDTH);
return data[position.x + position.y * CHUNK_WIDTH + position.z * CHUNK_WIDTH * CHUNK_WIDTH];
}
};
}