fixed bug in real-time occlusion culling that caused octree nodes and flares to disappear when they should be visible

This commit is contained in:
2013-04-11 14:04:56 -07:00
parent 260326094d
commit def0bae4d8
3 changed files with 10 additions and 1 deletions

View File

@@ -228,7 +228,7 @@ void KRCamera::renderFrame(float deltaTime, GLint renderBufferWidth, GLint rende
// Render the geometry
scene.render(this, m_viewport.getVisibleBounds(), m_viewport, KRNode::RENDER_PASS_FORWARD_OPAQUE, false);
scene.render(this, m_viewport.getVisibleBounds(), m_viewport, KRNode::RENDER_PASS_FORWARD_OPAQUE, true);
}
// ----====---- Sky Box ----====----

View File

@@ -286,6 +286,10 @@ void KRLight::render(KRCamera *pCamera, std::vector<KRLight *> &lights, const KR
if(m_flareTexture.size() && m_flareSize > 0.0f) {
if(m_occlusionQuery) {
GLuint hasBeenTested = 0;
while(!hasBeenTested) {
GLDEBUG(glGetQueryObjectuivEXT(m_occlusionQuery, GL_QUERY_RESULT_AVAILABLE_EXT, &hasBeenTested)); // FINDME, HACK!! This needs to be replaced with asynchonous logic
}
GLuint params = 0;
GLDEBUG(glGetQueryObjectuivEXT(m_occlusionQuery, GL_QUERY_RESULT_EXT, &params));
GLDEBUG(glDeleteQueriesEXT(1, &m_occlusionQuery));

View File

@@ -165,6 +165,11 @@ void KRScene::render(KROctreeNode *pOctreeNode, std::map<KRAABB, int> &visibleBo
if(bOcclusionResultsPass) {
// ----====---- Occlusion results pass ----====----
if(pOctreeNode->m_occlusionTested) {
GLuint hasBeenTested = 0;
while(!hasBeenTested) {
GLDEBUG(glGetQueryObjectuivEXT(pOctreeNode->m_occlusionQuery, GL_QUERY_RESULT_AVAILABLE_EXT, &hasBeenTested)); // FINDME, HACK!! This needs to be replaced with asynchonous logic
}
GLuint params = 0;
GLDEBUG(glGetQueryObjectuivEXT(pOctreeNode->m_occlusionQuery, GL_QUERY_RESULT_EXT, &params));