1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00
This commit is contained in:
scrawl 2012-03-31 19:12:02 +02:00
parent 909abb480d
commit c08a2b2942
2 changed files with 8 additions and 3 deletions

View file

@ -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), mTestResult(false), mDoQuery(0), mSunVisibility(0), mQuerySingleObjectStarted(false), mTestResult(false),
mQuerySingleObjectRequested(false), mWasVisible(false), mObjectWasVisible(false) mQuerySingleObjectRequested(false), mWasVisible(false), mObjectWasVisible(false), mDoQuery2(false)
{ {
mRendering = renderer; mRendering = renderer;
mSunNode = sunNode; mSunNode = sunNode;
@ -82,6 +82,7 @@ OcclusionQuery::OcclusionQuery(OEngine::Render::OgreRenderer* renderer, SceneNod
mRendering->getScene()->addRenderObjectListener(this); mRendering->getScene()->addRenderObjectListener(this);
mRendering->getScene()->addRenderQueueListener(this); mRendering->getScene()->addRenderQueueListener(this);
mDoQuery = true; mDoQuery = true;
mDoQuery2 = true;
} }
OcclusionQuery::~OcclusionQuery() OcclusionQuery::~OcclusionQuery()
@ -125,7 +126,7 @@ void OcclusionQuery::notifyRenderSingleObject(Renderable* rend, const Pass* pass
mActiveQuery = mSunVisibleAreaQuery; mActiveQuery = mSunVisibleAreaQuery;
} }
} }
if (rend == mBBQuerySingleObject && mQuerySingleObjectRequested) if (mDoQuery2 == true && rend == mBBQuerySingleObject && mQuerySingleObjectRequested)
{ {
mQuerySingleObjectStarted = true; mQuerySingleObjectStarted = true;
mQuerySingleObjectRequested = false; mQuerySingleObjectRequested = false;
@ -154,7 +155,7 @@ void OcclusionQuery::renderQueueEnded(uint8 queueGroupId, const String& invocati
mSunVisibleAreaQuery->beginOcclusionQuery(); mSunVisibleAreaQuery->beginOcclusionQuery();
mSunVisibleAreaQuery->endOcclusionQuery(); mSunVisibleAreaQuery->endOcclusionQuery();
} }
if (mObjectWasVisible == false && mQuerySingleObjectRequested) if (mObjectWasVisible == false && mDoQuery2 && mQuerySingleObjectRequested)
{ {
mSingleObjectQuery->beginOcclusionQuery(); mSingleObjectQuery->beginOcclusionQuery();
mSingleObjectQuery->endOcclusionQuery(); mSingleObjectQuery->endOcclusionQuery();
@ -185,6 +186,7 @@ void OcclusionQuery::update(float duration)
// Stop occlusion queries until we get their information // Stop occlusion queries until we get their information
// (may not happen on the same frame they are requested in) // (may not happen on the same frame they are requested in)
mDoQuery = false; mDoQuery = false;
mDoQuery2 = false;
if (!mSunTotalAreaQuery->isStillOutstanding() if (!mSunTotalAreaQuery->isStillOutstanding()
&& !mSunVisibleAreaQuery->isStillOutstanding()) && !mSunVisibleAreaQuery->isStillOutstanding())
@ -219,6 +221,8 @@ void OcclusionQuery::update(float duration)
mQuerySingleObjectStarted = false; mQuerySingleObjectStarted = false;
mQuerySingleObjectRequested = false; mQuerySingleObjectRequested = false;
mDoQuery2 = true;
} }
} }

View file

@ -77,6 +77,7 @@ namespace MWRender
bool mSupported; bool mSupported;
bool mDoQuery; bool mDoQuery;
bool mDoQuery2;
bool mQuerySingleObjectRequested; bool mQuerySingleObjectRequested;
bool mQuerySingleObjectStarted; bool mQuerySingleObjectStarted;