Merge branch 'main' into main

This commit is contained in:
Astazium 2026-10-15 16:19:06 +03:00 • committed by GitHub
commit bf59e520a7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
109 changed files with 1908 additions and 474 deletions

View file

@ -328,14 +328,17 @@ void Entities::preparePhysics(float delta) {
auto view = registry->view<EntityId, Rigidbody>();
for (auto [entity, eid, rigidbody] : view.each()) {
auto bodyType = rigidbody.hitbox.type;
if (eid.destroyFlag || !rigidbody.enabled || bodyType == BodyType::STATIC) {
if (eid.destroyFlag || !rigidbody.enabled) {
continue;
}
rigidbody.hitbox.selectable = rigidbody.selectable;
rigidbody.hitbox.mass = bodyType == BodyType::DYNAMIC
? rigidbody.mass
: std::numeric_limits<float>::infinity();
rigidbody.hitbox.elasticity = rigidbody.elasticity;
rigidbody.hitbox.selectable = rigidbody.selectable;
if (bodyType == BodyType::STATIC) {
continue;
}
hitboxes.emplace_back(&rigidbody.hitbox);
if (!eid.def.solid) {
continue;
@ -480,15 +483,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;
}

View file

@ -322,7 +322,7 @@ void Player::deserialize(const dv::value& src) {
src.at("loading-chunks").get(loadingChunks);
setChosenSlot(src["chosen-slot"].asInteger());
eid = src["entity"].asNumber();
eid = src["entity"].asInteger();
if (src.has("inventory")) {
getInventory()->deserialize(src["inventory"]);