MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / loaderThread

Method loaderThread

deps/physx/physx/samples/samplelargeworld/ChunkLoader.cpp:1030–1231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1028}
1029
1030void* BackgroundLoader::loaderThread()
1031{
1032 std::vector<ChunkID> lastUpdateQueue;
1033
1034#if ENABLE_PROGRESS_BAR
1035 mLoaderStatusLock.lockWriter();
1036 mPhyXStreamTime = 0.0f;
1037 mGraphicStreamTime = 0.0f;
1038 mLoaderStatusLock.unlockWriter();
1039#endif
1040 while(mRequestReady.wait())
1041 {
1042 physx::shdfnd::Thread::yield();
1043
1044 mRequestReady.reset();
1045
1046 if (mLoaderThread->quitIsSignalled())
1047 {
1048 mLoaderThread->quit();
1049 break;
1050 }
1051
1052#if ENABLE_PROGRESS_BAR
1053 mLoaderStatusLock.lockWriter();
1054 mQueryLength = 0;
1055 mQueryProgress = 0.0f;
1056 mLoaderStatusLock.unlockWriter();
1057#endif
1058
1059 bool bDirty = false;
1060
1061 std::vector<ChunkID> requestedQueue;
1062 std::vector<DeferredLoadedRenderData> loadedRenderDataQueue;
1063 std::vector<ChunkCommand> theChunkCmds;
1064
1065 mQueueLock.lock();
1066 requestedQueue = mRequestQueue;
1067 mQueueLock.unlock();
1068
1069 for(unsigned iLast = 0; iLast < lastUpdateQueue.size(); iLast++)
1070 {
1071 bool bFound = false;
1072 for(unsigned iRequest = 0; iRequest < requestedQueue.size(); iRequest++)
1073 {
1074 bFound = lastUpdateQueue[iLast].id == requestedQueue[iRequest].id;
1075 if(bFound)
1076 break;
1077 }
1078 if(!bFound)
1079 {
1080 bDirty = true;
1081 theChunkCmds.push_back(ChunkCommand(ChunkCommandType::eRemove,lastUpdateQueue[iLast]));
1082 }
1083 }
1084
1085 for(unsigned iRequest = 0; iRequest < requestedQueue.size(); iRequest++)
1086 {
1087 bool bFound = false;

Callers

nothing calls this directly

Calls 15

ChunkCommandClass · 0.85
getShapeFunction · 0.85
getObjectMethod · 0.80
lockWriterMethod · 0.45
unlockWriterMethod · 0.45
waitMethod · 0.45
resetMethod · 0.45
quitIsSignalledMethod · 0.45
quitMethod · 0.45
lockMethod · 0.45

Tested by

no test coverage detected