mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 09:29:44 +00:00
optimize animator
This commit is contained in:
parent
17bdbb1a38
commit
fd17ce32ab
11 changed files with 294 additions and 2 deletions
|
|
@ -509,6 +509,19 @@ void Entities::render(
|
|||
}
|
||||
}
|
||||
|
||||
void Entities::updateCulling(const Frustum* frustum, entityid_t fpsEntity) {
|
||||
auto view = registry->view<EntityId, Transform, rigging::Skeleton, Rigidbody>();
|
||||
for (auto [entity, eid, transform, skeleton, rigidbody] : view.each()) {
|
||||
if (frustum == nullptr || eid.uid == fpsEntity) {
|
||||
skeleton.culled = false;
|
||||
continue;
|
||||
}
|
||||
const auto& pos = transform.pos;
|
||||
const auto& halfSize = rigidbody.hitbox.getHalfSize();
|
||||
skeleton.culled = !frustum->isBoxVisible(pos - halfSize, pos + halfSize);
|
||||
}
|
||||
}
|
||||
|
||||
bool Entities::hasBlockingInside(AABB aabb) {
|
||||
constexpr float eps = 0.05f;
|
||||
auto view = registry->view<EntityId, Rigidbody>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue