From 853f7fc9d17ef7f3992e8e1b3f5fd7aaa7f8fcc4 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sat, 8 Jun 2024 09:57:01 +0300 Subject: [PATCH] update blockstate.segment size --- src/voxels/voxel.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/voxels/voxel.hpp b/src/voxels/voxel.hpp index 0e19415f..460a6a4f 100644 --- a/src/voxels/voxel.hpp +++ b/src/voxels/voxel.hpp @@ -12,8 +12,8 @@ inline constexpr int BLOCK_DIR_DOWN = 0x5; struct blockstate { uint8_t rotation : 3; // block rotation index - uint8_t segment : 1; // segment block bit - uint8_t reserved : 4; // reserved bits + uint8_t segment : 3; // segment block bits + uint8_t reserved : 2; // reserved bits uint8_t userbits : 8; // bits for use in block script }; static_assert (sizeof(blockstate) == 2); @@ -22,7 +22,7 @@ static_assert (sizeof(blockstate) == 2); inline constexpr blockstate_t blockstate2int(blockstate b) { return static_cast(b.rotation) | static_cast(b.segment) << 3 | - static_cast(b.reserved) << 4 | + static_cast(b.reserved) << 6 | static_cast(b.userbits) << 8; } @@ -30,8 +30,8 @@ inline constexpr blockstate_t blockstate2int(blockstate b) { inline constexpr blockstate int2blockstate(blockstate_t i) { return { static_cast(i & 0b111), - static_cast((i >> 3) & 0b1), - static_cast((i >> 4) & 0b1111), + static_cast((i >> 3) & 0b111), + static_cast((i >> 6) & 0b11), static_cast((i >> 8) & 0xFF) }; }