mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-21 07:39:40 +00:00
handle timeout
This commit is contained in:
parent
98a33a7fc6
commit
4ee03cd61f
3 changed files with 19 additions and 5 deletions
|
@ -12,7 +12,7 @@ using namespace Ogre;
|
||||||
OcclusionQuery::OcclusionQuery(OEngine::Render::OgreRenderer* renderer, SceneNode* sunNode) :
|
OcclusionQuery::OcclusionQuery(OEngine::Render::OgreRenderer* renderer, SceneNode* sunNode) :
|
||||||
mSunTotalAreaQuery(0), mSunVisibleAreaQuery(0), mSingleObjectQuery(0), mActiveQuery(0),
|
mSunTotalAreaQuery(0), mSunVisibleAreaQuery(0), mSingleObjectQuery(0), mActiveQuery(0),
|
||||||
mDoQuery(0), mSunVisibility(0), mQuerySingleObjectStarted(false),
|
mDoQuery(0), mSunVisibility(0), mQuerySingleObjectStarted(false),
|
||||||
mQuerySingleObjectRequested(false)
|
mQuerySingleObjectRequested(false), mResponding(true), mDelay(0)
|
||||||
{
|
{
|
||||||
mRendering = renderer;
|
mRendering = renderer;
|
||||||
mSunNode = sunNode;
|
mSunNode = sunNode;
|
||||||
|
@ -93,7 +93,8 @@ OcclusionQuery::~OcclusionQuery()
|
||||||
|
|
||||||
bool OcclusionQuery::supported()
|
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,
|
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;
|
if (!mSupported) return;
|
||||||
|
|
||||||
|
mDelay += duration;
|
||||||
|
if (mDelay >= 2) mResponding = false;
|
||||||
|
|
||||||
mWasVisible = false;
|
mWasVisible = false;
|
||||||
|
|
||||||
// Adjust the position of the sun billboards according to camera viewing distance
|
// Adjust the position of the sun billboards according to camera viewing distance
|
||||||
|
@ -172,6 +176,9 @@ void OcclusionQuery::update()
|
||||||
if (!mSunTotalAreaQuery->isStillOutstanding()
|
if (!mSunTotalAreaQuery->isStillOutstanding()
|
||||||
&& !mSunVisibleAreaQuery->isStillOutstanding())
|
&& !mSunVisibleAreaQuery->isStillOutstanding())
|
||||||
{
|
{
|
||||||
|
mDelay = 0;
|
||||||
|
mResponding = true;
|
||||||
|
|
||||||
unsigned int totalPixels;
|
unsigned int totalPixels;
|
||||||
unsigned int visiblePixels;
|
unsigned int visiblePixels;
|
||||||
|
|
||||||
|
@ -193,6 +200,9 @@ void OcclusionQuery::update()
|
||||||
}
|
}
|
||||||
if (!mSingleObjectQuery->isStillOutstanding() && mQuerySingleObjectStarted)
|
if (!mSingleObjectQuery->isStillOutstanding() && mQuerySingleObjectStarted)
|
||||||
{
|
{
|
||||||
|
mDelay = 0;
|
||||||
|
mResponding = true;
|
||||||
|
|
||||||
unsigned int result;
|
unsigned int result;
|
||||||
|
|
||||||
mSingleObjectQuery->pullOcclusionQuery(&result);
|
mSingleObjectQuery->pullOcclusionQuery(&result);
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace MWRender
|
||||||
/**
|
/**
|
||||||
* per-frame update
|
* per-frame update
|
||||||
*/
|
*/
|
||||||
void update();
|
void update(float duration);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* request occlusion test for a billboard at the given position, omitting an entity
|
* request occlusion test for a billboard at the given position, omitting an entity
|
||||||
|
@ -79,6 +79,10 @@ namespace MWRender
|
||||||
|
|
||||||
bool mWasVisible;
|
bool mWasVisible;
|
||||||
|
|
||||||
|
bool mResponding;
|
||||||
|
|
||||||
|
float mDelay;
|
||||||
|
|
||||||
bool mTestResult;
|
bool mTestResult;
|
||||||
|
|
||||||
bool mSupported;
|
bool mSupported;
|
||||||
|
|
|
@ -150,7 +150,7 @@ void RenderingManager::update (float duration){
|
||||||
|
|
||||||
mActors.update (duration);
|
mActors.update (duration);
|
||||||
|
|
||||||
mOcclusionQuery->update();
|
mOcclusionQuery->update(duration);
|
||||||
|
|
||||||
mSkyManager->update(duration);
|
mSkyManager->update(duration);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue