enable async loading, optimize rendering and distance checks

This commit is contained in:
savis
2025-12-26 06:21:13 +01:00
parent 1592ec93f6
commit 9907febf28
5 changed files with 40 additions and 6 deletions

View File

@@ -8,7 +8,7 @@
#include "ResourceManager.h"
#include "GrpImage.h"
int g_iLoadingDelayTime = 20;
int g_iLoadingDelayTime = 1; // Reduced from 20ms to 1ms for faster async loading
const long c_Deleting_Wait_Time = 30000; // 삭제 대기 시간 (30초)
const long c_DeletingCountPerFrame = 30; // 프레임당 체크 리소스 갯수
@@ -16,6 +16,21 @@ const long c_Reference_Decrease_Wait_Time = 30000; // 선로딩 리소스의 해
CFileLoaderThread CResourceManager::ms_loadingThread;
void CResourceManager::BeginThreadLoading()
{
// Already started in constructor, nothing to do
}
void CResourceManager::EndThreadLoading()
{
// Wait for all pending requests to complete
while (!m_RequestMap.empty() || !m_WaitingMap.empty())
{
ProcessBackgroundLoading();
Sleep(10);
}
}
void CResourceManager::LoadStaticCache(const char* c_szFileName)
{
CResource* pkRes=GetResourcePointer(c_szFileName);
@@ -514,11 +529,11 @@ void CResourceManager::ReserveDeletingResource(CResource * pResource)
CResourceManager::CResourceManager()
{
//ms_loadingThread.Create(0);
ms_loadingThread.Create(0);
}
CResourceManager::~CResourceManager()
{
Destroy();
//ms_loadingThread.Shutdown();
ms_loadingThread.Shutdown();
}