Skip map objects beyond the AVA2 object loading distance

AVA2 builds with ENABLE_MAP_OBJECT_OPTIMIZATION: CArea::
__UpdateLoadedObjectInstances unloads objects whose 2D distance from the
main actor is at least max(OBJECT_DIST, 5000). CPythonBackground::Update
now takes the main actor position (as CPythonApplication passes it) and
sets that loading center on MapObjectManager, which skips farther
objects before their frustum test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-12 17:14:00 +09:00
co-authored by Claude Opus 5.5
parent 46880be537
commit b57f2fba99
5 changed files with 17 additions and 4 deletions
+4
View File
@@ -386,6 +386,10 @@ void MapObjectManager::AppendDrawRefs(const float* view, const float* proj, std:
const float* light_direction, const float* light_ambient) const {
for (const auto& obj : m_objects) {
if (!obj.model) continue;
if (m_maxDistanceSq > 0.0f) {
const float dx = obj.x - m_centerX, dz = obj.z - m_centerZ;
if (dx * dx + dz * dz >= m_maxDistanceSq) continue;
}
float world[16];
MakeFullTransformMatrix(obj.yaw, obj.pitch, obj.roll, obj.x, obj.y, obj.z, obj.scale, world);