From 2f05fa27485f06df96b29c1cc693741070d3844b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 17 Feb 2014 01:54:12 +0100 Subject: [PATCH] Make IG load waiting loop more agreeable --- code/ryzom/client/src/streamable_ig.cpp | 37 ++++++++++++++++++------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/code/ryzom/client/src/streamable_ig.cpp b/code/ryzom/client/src/streamable_ig.cpp index 514357b0c..f73df6126 100644 --- a/code/ryzom/client/src/streamable_ig.cpp +++ b/code/ryzom/client/src/streamable_ig.cpp @@ -144,12 +144,14 @@ CStreamableIG::~CStreamableIG() #ifdef NL_DEBUG //nlinfo("Loading : %s", Name.c_str()); #endif + std::vector waitForIg; + waitForIg.resize(_IGs.size()); for(uint k = 0; k < _IGs.size(); ++k) { #ifdef NL_DEBUG //nlinfo("Loading ig %s", _IGs[k].Name.c_str()); #endif - progress.progress((float)k/(float)_IGs.size()); + progress.progress((float)k/((float)_IGs.size()*2.f)); if (!_IGs[k].IG) { @@ -161,19 +163,15 @@ CStreamableIG::~CStreamableIG() //nlinfo("start blocking load"); // blocking load + // block after queueing all _Callback.Owner = this; _Scene->createInstanceGroupAndAddToSceneAsync(_IGs[k].Name + ".ig", &_IGs[k].IG, _IGs[k].Pos, _IGs[k].Rot, season, &_Callback); + _IGs[k].Loading = true; } + + _Scene->updateWaitingInstances(1000); /* set a high value to upload texture at a fast rate */ - //nlinfo("wait for end of blockin load"); - // blocking call - while (!_IGs[k].IG) - { - NLMISC::nlSleep(0); - // wait till loaded... - _Scene->updateWaitingInstances(1000); /* set a high value to upload texture at a fast rate */ - } - _IGs[k].Loading = false; + waitForIg[k] = true; } else { @@ -181,6 +179,25 @@ CStreamableIG::~CStreamableIG() { _IGs[k].Loading = false; } + + waitForIg[k] = false; + } + } + for(uint k = 0; k < _IGs.size(); ++k) + { + progress.progress(((float)k + (float)_IGs.size())/((float)_IGs.size()*2.f)); + + if (waitForIg[k]) + { + //nlinfo("wait for end of blockin load"); + // blocking call + while (!_IGs[k].IG) + { + NLMISC::nlSleep(1); + // wait till loaded... + _Scene->updateWaitingInstances(1000); /* set a high value to upload texture at a fast rate */ + } + _IGs[k].Loading = false; } } linkInstances();