mirror of
https://github.com/LCEMP/LCEMP.git
synced 2026-06-11 13:42:01 +00:00
LCEMP v1.1.0, bugfixes, multithreading server, local leaderboard, performance fixes, and more
This commit is contained in:
@@ -76,6 +76,7 @@ Chunk LevelRenderer::permaChunk[MAX_CONCURRENT_CHUNK_REBUILDS];
|
||||
C4JThread *LevelRenderer::rebuildThreads[MAX_CHUNK_REBUILD_THREADS];
|
||||
C4JThread::EventArray *LevelRenderer::s_rebuildCompleteEvents;
|
||||
C4JThread::Event *LevelRenderer::s_activationEventA[MAX_CHUNK_REBUILD_THREADS];
|
||||
volatile bool LevelRenderer::s_rebuildThreadsTerminate = false;
|
||||
|
||||
// This defines the maximum size of renderable level, must be big enough to cope with actual size of level + view distance at each side
|
||||
// so that we can render the "infinite" sea at the edges. Currently defined as:
|
||||
@@ -3589,6 +3590,12 @@ void LevelRenderer::DestroyedTileManager::tick()
|
||||
#ifdef _LARGE_WORLDS
|
||||
void LevelRenderer::staticCtor()
|
||||
{
|
||||
if (s_rebuildCompleteEvents != NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s_rebuildThreadsTerminate = false;
|
||||
s_rebuildCompleteEvents = new C4JThread::EventArray(MAX_CHUNK_REBUILD_THREADS);
|
||||
char threadName[256];
|
||||
for(unsigned int i = 0; i < MAX_CHUNK_REBUILD_THREADS; ++i)
|
||||
@@ -3614,6 +3621,46 @@ void LevelRenderer::staticCtor()
|
||||
}
|
||||
}
|
||||
|
||||
void LevelRenderer::shutdownRebuildThreads()
|
||||
{
|
||||
if (s_rebuildCompleteEvents == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s_rebuildThreadsTerminate = true;
|
||||
|
||||
for (unsigned int i = 0; i < MAX_CHUNK_REBUILD_THREADS; ++i)
|
||||
{
|
||||
if (s_activationEventA[i] != NULL)
|
||||
{
|
||||
s_activationEventA[i]->Set();
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < MAX_CHUNK_REBUILD_THREADS; ++i)
|
||||
{
|
||||
if (rebuildThreads[i] != NULL)
|
||||
{
|
||||
rebuildThreads[i]->WaitForCompletion(INFINITE);
|
||||
delete rebuildThreads[i];
|
||||
rebuildThreads[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < MAX_CHUNK_REBUILD_THREADS; ++i)
|
||||
{
|
||||
if (s_activationEventA[i] != NULL)
|
||||
{
|
||||
delete s_activationEventA[i];
|
||||
s_activationEventA[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
delete s_rebuildCompleteEvents;
|
||||
s_rebuildCompleteEvents = NULL;
|
||||
}
|
||||
|
||||
int LevelRenderer::rebuildChunkThreadProc(LPVOID lpParam)
|
||||
{
|
||||
Vec3::CreateNewThreadStorage();
|
||||
@@ -3630,6 +3677,11 @@ int LevelRenderer::rebuildChunkThreadProc(LPVOID lpParam)
|
||||
{
|
||||
s_activationEventA[index]->WaitForSignal(INFINITE);
|
||||
|
||||
if (s_rebuildThreadsTerminate)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//app.DebugPrintf("Rebuilding permaChunk %d\n", index + 1);
|
||||
permaChunk[index + 1].rebuild();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user