format: reformat project

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov
2024-08-03 19:53:48 +03:00
committed by Pugemon
parent 736cd175d5
commit bbf33e8e4d
202 changed files with 7389 additions and 5609 deletions
+9 -10
View File
@@ -11,14 +11,14 @@ inline constexpr int BLOCK_DIR_UP = 0x4;
inline constexpr int BLOCK_DIR_DOWN = 0x5;
struct blockstate {
uint8_t rotation : 3; // block rotation index
uint8_t segment : 3; // segment block bits
uint8_t reserved : 2; // reserved bits
uint8_t userbits : 8; // bits for use in block script
uint8_t rotation : 3; // block rotation index
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);
static_assert(sizeof(blockstate) == 2);
/// @brief blockstate cast to an integer (optimized out in most cases)
/// @brief blockstate cast to an integer (optimized out in most cases)
inline constexpr blockstate_t blockstate2int(blockstate b) {
return static_cast<blockstate_t>(b.rotation) |
static_cast<blockstate_t>(b.segment) << 3 |
@@ -26,14 +26,13 @@ inline constexpr blockstate_t blockstate2int(blockstate b) {
static_cast<blockstate_t>(b.userbits) << 8;
}
/// @brief integer cast to a blockstate (optimized out in most cases)
/// @brief integer cast to a blockstate (optimized out in most cases)
inline constexpr blockstate int2blockstate(blockstate_t i) {
return {
static_cast<uint8_t>(i & 0b111),
static_cast<uint8_t>((i >> 3) & 0b111),
static_cast<uint8_t>((i >> 6) & 0b11),
static_cast<uint8_t>((i >> 8) & 0xFF)
};
static_cast<uint8_t>((i >> 8) & 0xFF)};
}
struct voxel {
@@ -42,4 +41,4 @@ struct voxel {
};
static_assert(sizeof(voxel) == 4);
#endif // VOXELS_VOXEL_HPP_
#endif // VOXELS_VOXEL_HPP_