1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-19 17:09:40 +00:00

handle timeout

This commit is contained in:
scrawl 2012-03-26 00:31:03 +02:00
parent 98a33a7fc6
commit 4ee03cd61f
3 changed files with 19 additions and 5 deletions

View file

@ -12,7 +12,7 @@ using namespace Ogre;
OcclusionQuery::OcclusionQuery(OEngine::Render::OgreRenderer* renderer, SceneNode* sunNode) :
mSunTotalAreaQuery(0), mSunVisibleAreaQuery(0), mSingleObjectQuery(0), mActiveQuery(0),
mDoQuery(0), mSunVisibility(0), mQuerySingleObjectStarted(false),
mQuerySingleObjectRequested(false)
mQuerySingleObjectRequested(false), mResponding(true), mDelay(0)
{
mRendering = renderer;
mSunNode = sunNode;
@ -93,7 +93,8 @@ OcclusionQuery::~OcclusionQuery()
bool OcclusionQuery::supported()
{
return mSupported;
if (!mResponding) std::cout << "Occlusion query timed out" << std::endl;
return mSupported && mResponding;
}
void OcclusionQuery::notifyRenderSingleObject(Renderable* rend, const Pass* pass, const AutoParamDataSource* source,
@ -150,10 +151,13 @@ void OcclusionQuery::renderQueueEnded(uint8 queueGroupId, const String& invocati
}
}
void OcclusionQuery::update()
void OcclusionQuery::update(float duration)
{
if (!mSupported) return;
mDelay += duration;
if (mDelay >= 2) mResponding = false;
mWasVisible = false;
// Adjust the position of the sun billboards according to camera viewing distance
@ -172,6 +176,9 @@ void OcclusionQuery::update()
if (!mSunTotalAreaQuery->isStillOutstanding()
&& !mSunVisibleAreaQuery->isStillOutstanding())
{
mDelay = 0;
mResponding = true;
unsigned int totalPixels;
unsigned int visiblePixels;
@ -193,6 +200,9 @@ void OcclusionQuery::update()
}
if (!mSingleObjectQuery->isStillOutstanding() && mQuerySingleObjectStarted)
{
mDelay = 0;
mResponding = true;
unsigned int result;
mSingleObjectQuery->pullOcclusionQuery(&result);

View file

@ -39,7 +39,7 @@ namespace MWRender
/**
* per-frame update
*/
void update();
void update(float duration);
/**
* request occlusion test for a billboard at the given position, omitting an entity
@ -79,6 +79,10 @@ namespace MWRender
bool mWasVisible;
bool mResponding;
float mDelay;
bool mTestResult;
bool mSupported;

View file

@ -150,7 +150,7 @@ void RenderingManager::update (float duration){
mActors.update (duration);
mOcclusionQuery->update();
mOcclusionQuery->update(duration);
mSkyManager->update(duration);