converting block states to a bitfield

This commit is contained in:
MihailRis
2024-05-31 11:13:36 +03:00
parent 5dd06b233e
commit 6d933ac263
17 changed files with 197 additions and 164 deletions
+2 -4
View File
@@ -219,13 +219,11 @@ bool PhysicsSolver::isBlockInside(int x, int y, int z, Hitbox* hitbox) {
y >= floor(pos.y-half.y) && y <= floor(pos.y+half.y);
}
bool PhysicsSolver::isBlockInside(int x, int y, int z, Block* def, blockstate_t states, Hitbox* hitbox) {
bool PhysicsSolver::isBlockInside(int x, int y, int z, Block* def, blockstate state, Hitbox* hitbox) {
const glm::vec3& pos = hitbox->position;
const glm::vec3& half = hitbox->halfsize;
voxel v {};
v.states = states;
const auto& boxes = def->rotatable
? def->rt.hitboxes[v.rotation()]
? def->rt.hitboxes[state.rotation]
: def->hitboxes;
for (const auto& block_hitbox : boxes) {
glm::vec3 min = block_hitbox.min();