diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-11-30 17:47:58 +0100 |
---|---|---|
committer | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-12-05 03:37:06 +0100 |
commit | c9cd5631e4b149f83c5a49c8fbf869cf2fb5b6a7 (patch) | |
tree | d09566a4132530ea65574a886540e0f258103017 /indra/newview/lldrawpooltree.cpp | |
parent | 54db4206e9302e7510bc4f103ff59714c1be942d (diff) | |
parent | 683bf84bb38adc88d4a4b7fedaed89b41fcac45e (diff) |
Merge branch 'main' into DRTVWR-489
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; } |