summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpooltree.cpp
diff options
context:
space:
mode:
authorBrad Kittenbrink <brad@lindenlab.com>2009-02-18 21:10:16 +0000
committerBrad Kittenbrink <brad@lindenlab.com>2009-02-18 21:10:16 +0000
commitabdc99f21b542c4fea67030ddbd7166c9d1c6c63 (patch)
tree3e984e405adfdec189ca8a047daca5250737ffbf /indra/newview/lldrawpooltree.cpp
parent34412f0530cf6a411b4de906a8e9da59cbcb3a85 (diff)
Merge of QAR-1267 to trunk. This was a combo merge of QAR-1175 (maint-render-9) and QAR-1236 (dll-msvcrt-2)
svn merge -r 109838:112264 svn+ssh://svn.lindenlab.com/svn/linden/branches/maint-render/maint-render-9-merge-r109833
Diffstat (limited to 'indra/newview/lldrawpooltree.cpp')
-rw-r--r--indra/newview/lldrawpooltree.cpp109
1 files changed, 105 insertions, 4 deletions
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index 616461d06e..2f2b07232a 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -43,6 +43,7 @@
#include "llviewercamera.h"
#include "llviewershadermgr.h"
#include "llrender.h"
+#include "llviewercontrol.h"
S32 LLDrawPoolTree::sDiffTex = 0;
static LLGLSLShader* shader = NULL;
@@ -52,7 +53,7 @@ LLDrawPoolTree::LLDrawPoolTree(LLViewerImage *texturep) :
mTexturep(texturep)
{
gGL.getTexUnit(0)->bind(mTexturep.get());
- mTexturep->setClamp(FALSE, FALSE);
+ mTexturep->setAddressMode(LLTexUnit::TAM_WRAP);
}
LLDrawPool *LLDrawPoolTree::instancePool()
@@ -91,7 +92,7 @@ void LLDrawPoolTree::beginRenderPass(S32 pass)
void LLDrawPoolTree::render(S32 pass)
{
- LLFastTimer t(LLFastTimer::FTM_RENDER_TREES);
+ LLFastTimer t(LLPipeline::sShadowRender ? LLFastTimer::FTM_SHADOW_TREE : LLFastTimer::FTM_RENDER_TREES);
if (mDrawFace.empty())
{
@@ -101,7 +102,23 @@ void LLDrawPoolTree::render(S32 pass)
LLGLEnable test(GL_ALPHA_TEST);
LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f);
- renderTree();
+ if (gSavedSettings.getBOOL("RenderAnimateTrees"))
+ {
+ renderTree();
+ }
+ else
+ {
+ gGL.getTexUnit(sDiffTex)->bind(mTexturep);
+
+ for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
+ iter != mDrawFace.end(); iter++)
+ {
+ LLFace *face = *iter;
+ face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
+ face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0);
+ gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices()/3);
+ }
+ }
}
void LLDrawPoolTree::endRenderPass(S32 pass)
@@ -115,6 +132,54 @@ void LLDrawPoolTree::endRenderPass(S32 pass)
}
}
+//============================================
+// deferred implementation
+//============================================
+void LLDrawPoolTree::beginDeferredPass(S32 pass)
+{
+ LLFastTimer t(LLFastTimer::FTM_RENDER_TREES);
+ gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
+
+ shader = &gDeferredTreeProgram;
+ shader->bind();
+}
+
+void LLDrawPoolTree::renderDeferred(S32 pass)
+{
+ render(pass);
+}
+
+void LLDrawPoolTree::endDeferredPass(S32 pass)
+{
+ LLFastTimer t(LLFastTimer::FTM_RENDER_TREES);
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+
+ shader->unbind();
+}
+
+//============================================
+// shadow implementation
+//============================================
+void LLDrawPoolTree::beginShadowPass(S32 pass)
+{
+ LLFastTimer t(LLFastTimer::FTM_SHADOW_TREE);
+ gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
+ gDeferredShadowProgram.bind();
+}
+
+void LLDrawPoolTree::renderShadow(S32 pass)
+{
+ render(pass);
+}
+
+void LLDrawPoolTree::endShadowPass(S32 pass)
+{
+ LLFastTimer t(LLFastTimer::FTM_SHADOW_TREE);
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ gDeferredShadowProgram.unbind();
+}
+
+
void LLDrawPoolTree::renderForSelect()
{
if (mDrawFace.empty())
@@ -133,7 +198,43 @@ void LLDrawPoolTree::renderForSelect()
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA);
- renderTree(TRUE);
+ if (gSavedSettings.getBOOL("RenderAnimateTrees"))
+ {
+ renderTree(TRUE);
+ }
+ else
+ {
+ gGL.getTexUnit(sDiffTex)->bind(mTexturep);
+
+ for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
+ iter != mDrawFace.end(); iter++)
+ {
+ LLFace *face = *iter;
+ LLDrawable *drawablep = face->getDrawable();
+
+ if (drawablep->isDead() || face->mVertexBuffer.isNull())
+ {
+ continue;
+ }
+
+ // Render each of the trees
+ LLVOTree *treep = (LLVOTree *)drawablep->getVObj().get();
+
+ LLColor4U color(255,255,255,255);
+
+ if (treep->mGLName != 0)
+ {
+ S32 name = treep->mGLName;
+ color = LLColor4U((U8)(name >> 16), (U8)(name >> 8), (U8)name, 255);
+
+ LLFacePool::LLOverrideFaceColor col(this, color);
+
+ face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
+ face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0);
+ gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices()/3);
+ }
+ }
+ }
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
gGL.setSceneBlendType(LLRender::BT_ALPHA);