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
+6 -2
View File
@@ -589,8 +589,12 @@ void CPythonBackground::DeleteSpecialEffect(uint32_t dwID) {
(void)dwID;
}
void CPythonBackground::Update(float fCameraX, float fCameraY, float fCameraZ) {
(void)fCameraX; (void)fCameraY; (void)fCameraZ;
void CPythonBackground::Update(float fCenterX, float fCenterY, float fCenterZ) {
(void)fCenterY;
if (m_mapObjects) {
// CArea::GetMaxLoadingDistanceSqr: OBJECT_DIST, never under 5000.
m_mapObjects->SetLoadingCenter(fCenterX, fCenterZ, std::max(5000.0f, CPythonSystem::Instance().GetObjectDistance()));
}
if (m_skybox) {
m_skybox->Update(0.033f);
}
+2 -1
View File
@@ -184,7 +184,8 @@ public:
void CreateSpecialEffect(uint32_t dwID, float fx, float fy, float fz, const char* szFileName);
void DeleteSpecialEffect(uint32_t dwID);
void Update(float fCameraX, float fCameraY, float fCameraZ);
// Original CPythonApplication passes the main actor position (map-object loading center).
void Update(float fCenterX, float fCenterY, float fCenterZ);
void Render();
void RenderSky();