feat: variant-based hitboxes

This commit is contained in:
MihailRis 2026-10-31 17:15:16 +03:00
parent 563001351b
commit b8b2e4f451
16 changed files with 145 additions and 102 deletions

View file

@ -70,9 +70,7 @@ void BlockWrapsRenderer::draw(BlockWrapper& wrapper, const Texture* texture) {
);
break;
case BlockModelType::AABB: {
const auto& aabb =
(def.rotatable ? def.rt.hitboxes[vox->state.rotation]
: def.hitboxes).at(0);
const auto& aabb = def.getHitboxes(vox->state).at(0);
const auto& size = aabb.size();
batch->cube(
glm::vec3(wrapper.position) + aabb.center(),
@ -121,9 +119,7 @@ void BlockWrapsRenderer::refreshWrapper(BlockWrapper& wrapper) {
wrapper.modelType = def.getModel(vox->state.userbits).type;
switch (wrapper.modelType) {
case BlockModelType::AABB: {
const auto& aabb =
(def.rotatable ? def.rt.hitboxes[vox->state.rotation]
: def.hitboxes).at(0);
const auto& aabb = def.getHitboxes(vox->state).at(0);
const auto& size = aabb.size();
wrapper.uvRegions[0].scale(size.z, size.y);
wrapper.uvRegions[1].scale(size.z, size.y);