mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 17:39:46 +00:00
feat: variant-based hitboxes
This commit is contained in:
parent
563001351b
commit
b8b2e4f451
16 changed files with 145 additions and 102 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue