diff options
author | Richard Linden <none@none> | 2012-03-20 16:50:30 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2012-03-20 16:50:30 -0700 |
commit | 49e1af3029cc7f6f82e052140ae84a857992d156 (patch) | |
tree | e920bc740b3e78cf1199f4593d7443a7b54ca312 /indra/newview/llspatialpartition.cpp | |
parent | 3215c6c4ca9553abc1cb8097f2466a409b37af24 (diff) | |
parent | 11e5c8b322a35d17e75ea57902296de860005c1d (diff) |
Automated merge with https://bitbucket.org/don_linden/viewer-thx-runway-shared-1
Diffstat (limited to 'indra/newview/llspatialpartition.cpp')
-rw-r--r-- | indra/newview/llspatialpartition.cpp | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 5d196a465f..5ef71fe6d9 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3647,6 +3647,47 @@ void renderShadowFrusta(LLDrawInfo* params) gGL.setSceneBlendType(LLRender::BT_ALPHA); } +void renderTexelDensity(LLDrawInfo* params) +{ + LLGLEnable _(GL_BLEND); + if (LLViewerTexture::sDebugTexelsMode == LLViewerTexture::DEBUG_TEXELS_OFF + || LLViewerTexture::sCheckerBoardImagep.isNull()) + { + return; + } + LLViewerTexture* texturep = params->mTexture.get(); + LLMatrix4 checkboard_matrix; + S32 discard_level = -1; + switch(LLViewerTexture::sDebugTexelsMode) + { + case LLViewerTexture::DEBUG_TEXELS_CURRENT: + discard_level = -1; + break; + case LLViewerTexture::DEBUG_TEXELS_DESIRED: + { + LLViewerFetchedTexture* fetched_texturep = dynamic_cast<LLViewerFetchedTexture*>(texturep); + discard_level = fetched_texturep ? fetched_texturep->getDesiredDiscardLevel() : -1; + break; + } + default: + case LLViewerTexture::DEBUG_TEXELS_FULL: + discard_level = 0; + break; + } + + checkboard_matrix.initScale(LLVector3(texturep->getWidth(discard_level) / 8, texturep->getHeight(discard_level) / 8, 1.f)); + gGL.getTexUnit(0)->activate(); + gGL.matrixMode(LLRender::MM_TEXTURE); + gGL.loadMatrix((GLfloat*) checkboard_matrix.mMatrix); + + gGL.getTexUnit(0)->bind(LLViewerTexture::sCheckerBoardImagep, TRUE); + + pushVerts(params, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0); + + gGL.loadIdentity(); + gGL.matrixMode(LLRender::MM_MODELVIEW); +} + void renderLights(LLDrawable* drawablep) { @@ -4097,6 +4138,10 @@ public: { renderShadowFrusta(draw_info); } + if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXEL_DENSITY)) + { + renderTexelDensity(draw_info); + } } } } @@ -4291,7 +4336,8 @@ void LLSpatialPartition::renderDebug() LLPipeline::RENDER_DEBUG_AGENT_TARGET | //LLPipeline::RENDER_DEBUG_BUILD_QUEUE | LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA | - LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY)) + LLPipeline::RENDER_DEBUG_RENDER_COMPLEXITY | + LLPipeline::RENDER_DEBUG_TEXEL_DENSITY)) { return; } |