Additional code hide behind OCTREE_DEBUG flag.

pull/278/head
pirogronian 2019-05-01 20:54:00 +02:00 committed by Łukasz Buczyński
parent 29beca06ad
commit 226f1ee793
4 changed files with 30 additions and 0 deletions

View File

@ -74,12 +74,14 @@ void DSOOctree::processVisibleObjects(DSOHandler& processor,
double scale,
OctreeProcStats *stats) const
{
#ifdef OCTREE_NODE
size_t h;
if (stats != nullptr)
{
h = stats->height + 1;
stats->nodes++;
}
#endif
// See if this node lies within the view frustum
// Test the cubic octree node against each one of the five
@ -102,8 +104,10 @@ void DSOOctree::processVisibleObjects(DSOHandler& processor,
for (unsigned int i=0; i<nObjects; ++i)
{
#ifdef OCTREE_NODE
if (stats != nullptr)
stats->objects++;
#endif
DeepSkyObject* _obj = _firstObject[i];
float absMag = _obj->getAbsoluteMagnitude();
if (absMag < dimmest)
@ -131,11 +135,15 @@ void DSOOctree::processVisibleObjects(DSOHandler& processor,
limitingFactor,
scale * 0.5f,
stats);
#ifdef OCTREE_DEBUG
if (stats != nullptr && stats->height > h)
h = stats->height;
#endif
}
#ifdef OCTREE_DEBUG
if (stats != nullptr)
stats->height = h;
#endif
}
}
}

View File

@ -6750,16 +6750,22 @@ void Renderer::renderPointStars(const StarDatabase& starDB,
else
starRenderer.starVertexBuffer->startSprites();
#ifdef OCTREE_DEBUG
m_starProcStats.nodes = 0;
m_starProcStats.height = 0;
m_starProcStats.objects = 0;
#endif
starDB.findVisibleStars(starRenderer,
obsPos.cast<float>(),
observer.getOrientationf(),
degToRad(fov),
(float) windowWidth / (float) windowHeight,
faintestMagNight,
#ifdef OCTREE_DEBUG
&m_starProcStats);
#else
nullptr);
#endif
starRenderer.starVertexBuffer->render();
starRenderer.glareVertexBuffer->render();
@ -7024,16 +7030,22 @@ void Renderer::renderDeepSkyObjects(const Universe& universe,
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
#ifdef OCTREE_DEBUG
m_dsoProcStats.objects = 0;
m_dsoProcStats.nodes = 0;
m_dsoProcStats.height = 0;
#endif
dsoDB->findVisibleDSOs(dsoRenderer,
obsPos,
observer.getOrientationf(),
degToRad(fov),
(float) windowWidth / (float) windowHeight,
2 * faintestMagNight,
#ifdef OCTREE_DEBUG
&m_dsoProcStats);
#else
nullptr);
#endif
// clog << "DSOs processed: " << dsoRenderer.dsosProcessed << endl;

View File

@ -375,8 +375,10 @@ class Renderer
LightingState::EclipseShadowVector* eclipseShadows;
};
#ifdef OCTREE_DEBUG
OctreeProcStats m_starProcStats;
OctreeProcStats m_dsoProcStats;
#endif
private:
struct SkyVertex
{

View File

@ -92,12 +92,14 @@ void StarOctree::processVisibleObjects(StarHandler& processor,
float scale,
OctreeProcStats *stats) const
{
#ifdef OCTREE_DEBUG
size_t h;
if (stats != nullptr)
{
h = stats->height + 1;
stats->nodes++;
}
#endif
// See if this node lies within the view frustum
// Test the cubic octree node against each one of the five
@ -119,8 +121,10 @@ void StarOctree::processVisibleObjects(StarHandler& processor,
for (unsigned int i=0; i<nObjects; ++i)
{
#ifdef OCTREE_DEBUG
if (stats != nullptr)
stats->objects++;
#endif
const Star& obj = _firstObject[i];
if (obj.getAbsoluteMagnitude() < dimmest)
@ -149,11 +153,15 @@ void StarOctree::processVisibleObjects(StarHandler& processor,
scale * 0.5f,
stats
);
#ifdef OCTREE_DEBUG
if (stats != nullptr && stats->height > h)
h = stats->height;
#endif
}
#ifdef OCTREE_DEBUG
if (stats != nullptr)
stats->height = h;
#endif
}
}
}