diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-11-29 10:45:43 +0200 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-11-29 10:45:43 +0200 |
commit | d1c0a5b840e9ec2d3a468216339ae5367aed4bf5 (patch) | |
tree | 30a47a8bf5ba4561c0f6d3839afd1a9f35dac873 /indra/newview/lldrawpooltree.cpp | |
parent | 6f99a844efe4e7809ed0a995b0118851e6f0d8d5 (diff) | |
parent | 53e958a2638705572ed7dbf61369d92b332c4b60 (diff) |
Merge branch 'DRTVWR-559' into marchcat/587-v-pbr-merge
# Conflicts:
# indra/llcommon/CMakeLists.txt
# indra/newview/llspatialpartition.cpp
# indra/newview/llviewergenericmessage.cpp
# indra/newview/llvoavatar.cpp
Diffstat (limited to 'indra/newview/lldrawpooltree.cpp')
-rw-r--r-- | indra/newview/lldrawpooltree.cpp | 135 |
1 files changed, 37 insertions, 98 deletions
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index facfb235c9..9dcbc48697 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -50,94 +50,6 @@ LLDrawPoolTree::LLDrawPoolTree(LLViewerTexture *texturep) : mTexturep->setAddressMode(LLTexUnit::TAM_WRAP); } -void LLDrawPoolTree::prerender() -{ - mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); -} - -void LLDrawPoolTree::beginRenderPass(S32 pass) -{ - LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES); - - if (LLPipeline::sUnderWaterRender) - { - shader = &gTreeWaterProgram; - } - else - { - shader = &gTreeProgram; - } - - if (gPipeline.shadersLoaded()) - { - shader->bind(); - shader->setMinimumAlpha(0.5f); - gGL.diffuseColor4f(1,1,1,1); - } - else - { - gPipeline.enableLightsDynamic(); - gGL.flush(); - } -} - -void LLDrawPoolTree::render(S32 pass) -{ - LL_PROFILE_ZONE_SCOPED; - - if (mDrawFace.empty()) - { - return; - } - - LLGLState test(GL_ALPHA_TEST, 0); - - gGL.getTexUnit(sDiffTex)->bindFast(mTexturep); - gPipeline.touchTexture(mTexturep, 1024.f * 1024.f); // <=== keep Linden tree textures at full res - - for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); - iter != mDrawFace.end(); iter++) - { - LLFace *face = *iter; - LLVertexBuffer* buff = face->getVertexBuffer(); - - if(buff) - { - LLMatrix4* model_matrix = &(face->getDrawable()->getRegion()->mRenderMatrix); - - if (model_matrix != gGLLastMatrix) - { - gGLLastMatrix = model_matrix; - gGL.loadMatrix(gGLModelView); - if (model_matrix) - { - llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW); - gGL.multMatrix((GLfloat*) model_matrix->mMatrix); - } - gPipeline.mMatrixOpCount++; - } - - buff->setBufferFast(LLDrawPoolTree::VERTEX_DATA_MASK); - buff->drawRangeFast(LLRender::TRIANGLES, 0, buff->getNumVerts()-1, buff->getNumIndices(), 0); - } - } -} - -void LLDrawPoolTree::endRenderPass(S32 pass) -{ - LL_RECORD_BLOCK_TIME(FTM_RENDER_TREES); - - if (gPipeline.canUseWindLightShadersOnObjects()) - { - shader->unbind(); - } - - if (mShaderLevel <= 0) - { - gGL.flush(); - } -} - //============================================ // deferred implementation //============================================ @@ -153,7 +65,42 @@ void LLDrawPoolTree::beginDeferredPass(S32 pass) void LLDrawPoolTree::renderDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED; - render(pass); + + if (mDrawFace.empty()) + { + return; + } + + + gGL.getTexUnit(sDiffTex)->bindFast(mTexturep); + mTexturep->addTextureStats(1024.f * 1024.f); // <=== keep Linden tree textures at full res + + for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); + iter != mDrawFace.end(); iter++) + { + LLFace* face = *iter; + LLVertexBuffer* buff = face->getVertexBuffer(); + + if (buff) + { + LLMatrix4* model_matrix = &(face->getDrawable()->getRegion()->mRenderMatrix); + + if (model_matrix != gGLLastMatrix) + { + gGLLastMatrix = model_matrix; + gGL.loadMatrix(gGLModelView); + if (model_matrix) + { + llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW); + gGL.multMatrix((GLfloat*)model_matrix->mMatrix); + } + gPipeline.mMatrixOpCount++; + } + + buff->setBuffer(); + buff->drawRange(LLRender::TRIANGLES, 0, buff->getNumVerts() - 1, buff->getNumIndices(), 0); + } + } } void LLDrawPoolTree::endDeferredPass(S32 pass) @@ -182,7 +129,7 @@ void LLDrawPoolTree::beginShadowPass(S32 pass) void LLDrawPoolTree::renderShadow(S32 pass) { - render(pass); + renderDeferred(pass); } void LLDrawPoolTree::endShadowPass(S32 pass) @@ -196,14 +143,6 @@ void LLDrawPoolTree::endShadowPass(S32 pass) BOOL LLDrawPoolTree::verify() const { -/* BOOL ok = TRUE; - - if (!ok) - { - printDebugInfo(); - } - return ok;*/ - return TRUE; } |