45 lines
875 B
C++
45 lines
875 B
C++
#pragma once
|
|
|
|
#include "Types.h"
|
|
|
|
#include "nbt/NBT.h"
|
|
#include "PalettedContainer.h"
|
|
#include "block/state/BlockState.h"
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
namespace Feather
|
|
{
|
|
// 16x16x16 sections of a chunk
|
|
struct ChunkSection
|
|
{
|
|
static constexpr size_t MaximumLongCount = (16 * 16 * 16) * 14 / 64;
|
|
|
|
std::array<uint64_t, MaximumLongCount> blockStates;
|
|
|
|
// TODO: this should eventually be Palette<BlockState>
|
|
// Palette of local indexs to indexs in the global palette
|
|
IDMapper<int> localPalette;
|
|
|
|
uint8_t bitsPerBlock;
|
|
};
|
|
|
|
// Chunk: 16x256x16 world chunk
|
|
class Chunk
|
|
{
|
|
public:
|
|
static constexpr int NUM_SECTIONS = 16;
|
|
|
|
// Each chunk is made of up 16 ChunkSections
|
|
ChunkSection sections[NUM_SECTIONS];
|
|
|
|
ChunkPos pos;
|
|
|
|
// TODO: save heightmaps here
|
|
// UNSERIALIZED
|
|
//const NBT::CompoundTag* heightmaps;
|
|
|
|
Chunk(ChunkPos& pos, NBT::CompoundTag& tag);
|
|
};
|
|
}; |