mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 05:51:51 +00:00
fix: entities frustum-culling not uses hitbox size (it uses entity scale only)
Some checks are pending
x86-64 AppImage / build-appimage (ubuntu-22.04) (push) Waiting to run
Build / Build (push) Waiting to run
Macos Build / build-dmg (push) Waiting to run
Windows Build (CLang) / build-windows (clang, windows-latest) (push) Waiting to run
MSVC Build / build-windows (windows-2022) (push) Waiting to run
Some checks are pending
x86-64 AppImage / build-appimage (ubuntu-22.04) (push) Waiting to run
Build / Build (push) Waiting to run
Macos Build / build-dmg (push) Waiting to run
Windows Build (CLang) / build-windows (clang, windows-latest) (push) Waiting to run
MSVC Build / build-windows (windows-2022) (push) Waiting to run
This commit is contained in:
parent
365854fdeb
commit
40db547817
1 changed files with 5 additions and 3 deletions
|
|
@ -480,15 +480,17 @@ void Entities::render(
|
|||
const Frustum* frustum,
|
||||
entityid_t fpsEntity
|
||||
) {
|
||||
auto view = registry->view<EntityId, Transform, rigging::Skeleton>();
|
||||
for (auto [entity, eid, transform, skeleton] : view.each()) {
|
||||
auto view = registry->view<EntityId, Transform, rigging::Skeleton, Rigidbody>();
|
||||
for (auto [entity, eid, transform, skeleton, rigidbody] : view.each()) {
|
||||
if (eid.uid == fpsEntity) {
|
||||
continue;
|
||||
}
|
||||
const auto& def = eid.def;
|
||||
const auto& pos = transform.pos;
|
||||
const auto& size = transform.size;
|
||||
if (frustum && !frustum->isBoxVisible(pos - size, pos + size)) {
|
||||
const auto& halfSize = rigidbody.hitbox.getHalfSize();
|
||||
// todo: more correct frustum culling
|
||||
if (frustum && !frustum->isBoxVisible(pos - halfSize, pos + halfSize)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue