mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-25 00:26:17 +00:00
Make IG load waiting loop more agreeable
This commit is contained in:
parent
3f8c52f918
commit
b34b883af3
1 changed files with 27 additions and 10 deletions
|
@ -144,12 +144,14 @@ CStreamableIG::~CStreamableIG()
|
||||||
#ifdef NL_DEBUG
|
#ifdef NL_DEBUG
|
||||||
//nlinfo("Loading : %s", Name.c_str());
|
//nlinfo("Loading : %s", Name.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
std::vector<bool> waitForIg;
|
||||||
|
waitForIg.resize(_IGs.size());
|
||||||
for(uint k = 0; k < _IGs.size(); ++k)
|
for(uint k = 0; k < _IGs.size(); ++k)
|
||||||
{
|
{
|
||||||
#ifdef NL_DEBUG
|
#ifdef NL_DEBUG
|
||||||
//nlinfo("Loading ig %s", _IGs[k].Name.c_str());
|
//nlinfo("Loading ig %s", _IGs[k].Name.c_str());
|
||||||
#endif
|
#endif
|
||||||
progress.progress((float)k/(float)_IGs.size());
|
progress.progress((float)k/((float)_IGs.size()*2.f));
|
||||||
|
|
||||||
if (!_IGs[k].IG)
|
if (!_IGs[k].IG)
|
||||||
{
|
{
|
||||||
|
@ -161,19 +163,15 @@ CStreamableIG::~CStreamableIG()
|
||||||
|
|
||||||
//nlinfo("start blocking load");
|
//nlinfo("start blocking load");
|
||||||
// blocking load
|
// blocking load
|
||||||
|
// block after queueing all
|
||||||
_Callback.Owner = this;
|
_Callback.Owner = this;
|
||||||
_Scene->createInstanceGroupAndAddToSceneAsync(_IGs[k].Name + ".ig", &_IGs[k].IG, _IGs[k].Pos, _IGs[k].Rot, season, &_Callback);
|
_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");
|
waitForIg[k] = true;
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -181,6 +179,25 @@ CStreamableIG::~CStreamableIG()
|
||||||
{
|
{
|
||||||
_IGs[k].Loading = false;
|
_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();
|
linkInstances();
|
||||||
|
|
Loading…
Reference in a new issue