mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 17:39:46 +00:00
Merge pull request #1042 from cutekitek/native-animation-tracks
Оптимизация анимаций
This commit is contained in:
commit
28ae13896f
11 changed files with 319 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>();
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ public:
|
|||
entityid_t fpsEntity
|
||||
);
|
||||
|
||||
void updateCulling(const Frustum* frustum, entityid_t fpsEntity);
|
||||
|
||||
entityid_t spawn(
|
||||
const EntityDef& def,
|
||||
glm::vec3 position,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue