Rotation profiles limited to 8

This commit is contained in:
MihailRis 2024-01-04 21:48:41 +03:00
parent 6542bcbc6a
commit c35057d1de
4 changed files with 12 additions and 12 deletions

View File

@ -38,7 +38,7 @@ regfile::regfile(fs::path filename) : file(filename) {
throw std::runtime_error("invalid region file magic number");
}
version = header[8];
if (version > REGION_FORMAT_VERSION) {
if (uint(version) > REGION_FORMAT_VERSION) {
throw illegal_region_format(
"region format "+std::to_string(version)+" is not supported");
}

View File

@ -23,7 +23,7 @@ void CoordSystem::transform(AABB& aabb) const {
aabb.b += fix;
}
const BlockRotProfile BlockRotProfile::PIPE {"pipe", {//TODO consexpr or init-time fix calculations
const BlockRotProfile BlockRotProfile::PIPE {"pipe", {
{ { 1, 0, 0 }, { 0, 0, 1 }, { 0, -1, 0 }}, // North
{ { 0, 0, 1 }, {-1, 0, 0 }, { 0, -1, 0 }}, // East
{ {-1, 0, 0 }, { 0, 0,-1 }, { 0, -1, 0 }}, // South

View File

@ -47,7 +47,7 @@ struct CoordSystem {
};
struct BlockRotProfile {
static const int MAX_COUNT = 16;
static const int MAX_COUNT = 8;
std::string name;
CoordSystem variants[MAX_COUNT];

View File

@ -10,10 +10,10 @@ const int BLOCK_DIR_EAST = 0x3;
const int BLOCK_DIR_UP = 0x4;
const int BLOCK_DIR_DOWN = 0x5;
// limited to 16 block orientations
const int BLOCK_ROT_MASK = 0xF;
// limited to 16 block variants
const int BLOCK_VARIANT_MASK = 0xF0;
// limited to 8 block orientations
const int BLOCK_ROT_MASK = 0b0000'0111;
// limited to 32 block variants
const int BLOCK_VARIANT_MASK = 0b1111'1000;
struct voxel {
blockid_t id;
@ -24,7 +24,7 @@ struct voxel {
}
inline uint8_t variant() const {
return (states & BLOCK_VARIANT_MASK) >> 4;
return (states & BLOCK_VARIANT_MASK) >> 3;
}
};