summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-02-14 18:26:12 -0600
committerDave Parks <davep@lindenlab.com>2011-02-14 18:26:12 -0600
commitb862e3adfa006fbc62015ddd160a545c1bb44654 (patch)
treeecc2feeafa8125cf4249012aac19e97cab57e7ca /indra/newview
parent547293305bdc6c345f52519db514bb5be34c72ef (diff)
SH-547 Fix for rigged attachments being invisible in impostors and fix for impostors not working with lighting and shadows enabled.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl2
-rw-r--r--indra/newview/lldrawpoolalpha.cpp18
-rw-r--r--indra/newview/lldrawpoolavatar.cpp2
-rwxr-xr-xindra/newview/pipeline.cpp46
4 files changed, 34 insertions, 34 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index 7125d845d9..e3c15a2ab2 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
@@ -14,7 +14,7 @@ uniform sampler2D specularMap;
void main()
{
vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy);
- gl_FragData[0] = vec4(col.rgb, col.a <= 0.5 ? 0.0 : 0.005);
+ gl_FragData[0] = vec4(col.rgb, col.a * 0.005);
gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy);
gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0);
}
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 2519d0297c..7f1740e29f 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -103,7 +103,14 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass)
S32 LLDrawPoolAlpha::getNumPostDeferredPasses()
{
- return 2;
+ if (LLPipeline::sImpostorRender)
+ { //skip depth buffer filling pass when rendering impostors
+ return 1;
+ }
+ else
+ {
+ return 2;
+ }
}
void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
@@ -137,8 +144,13 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
void LLDrawPoolAlpha::endPostDeferredPass(S32 pass)
{
- gPipeline.mDeferredDepth.flush();
- gPipeline.mScreen.bindTarget();
+
+ if (pass == 1)
+ {
+ gPipeline.mDeferredDepth.flush();
+ gPipeline.mScreen.bindTarget();
+ }
+
deferred_render = FALSE;
endRenderPass(pass);
}
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index df5b341fdf..ae3421a019 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -494,7 +494,7 @@ void LLDrawPoolAvatar::render(S32 pass)
LLFastTimer t(FTM_RENDER_CHARACTERS);
if (LLPipeline::sImpostorRender)
{
- renderAvatars(NULL, 2);
+ renderAvatars(NULL, pass+2);
return;
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index b0aa50bc57..813aab0680 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -9372,8 +9372,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
glClearColor(0.0f,0.0f,0.0f,0.0f);
gGL.setColorMask(true, true);
- glStencilMask(0xFFFFFFFF);
- glClearStencil(0);
// get the number of pixels per angle
F32 pa = gViewerWindow->getWindowHeightRaw() / (RAD_TO_DEG * viewer_camera->getView());
@@ -9385,7 +9383,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
if (!avatar->mImpostor.isComplete() || resX != avatar->mImpostor.getWidth() ||
resY != avatar->mImpostor.getHeight())
{
- avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,TRUE);
+ avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE,FALSE);
if (LLPipeline::sRenderDeferred)
{
@@ -9397,40 +9395,30 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
- LLGLEnable stencil(GL_STENCIL_TEST);
- glStencilMask(0xFFFFFFFF);
- glStencilFunc(GL_ALWAYS, 1, 0xFFFFFFFF);
- glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+ avatar->mImpostor.bindTarget();
- {
- LLGLEnable scissor(GL_SCISSOR_TEST);
- glScissor(0, 0, resX, resY);
- avatar->mImpostor.bindTarget();
- avatar->mImpostor.clear();
- }
-
if (LLPipeline::sRenderDeferred)
{
- stop_glerror();
+ avatar->mImpostor.clear();
renderGeomDeferred(camera);
renderGeomPostDeferred(camera);
}
else
{
+ LLGLEnable scissor(GL_SCISSOR_TEST);
+ glScissor(0, 0, resX, resY);
+ avatar->mImpostor.clear();
renderGeom(camera);
}
- glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
- glStencilFunc(GL_EQUAL, 1, 0xFFFFFF);
-
- { //create alpha mask based on stencil buffer (grey out if muted)
+ { //create alpha mask based on depth buffer (grey out if muted)
if (LLPipeline::sRenderDeferred)
{
- GLuint buff = GL_COLOR_ATTACHMENT0_EXT;
+ GLuint buff = GL_COLOR_ATTACHMENT0;
glDrawBuffersARB(1, &buff);
}
- LLGLEnable blend(muted ? 0 : GL_BLEND);
+ LLGLDisable blend(GL_BLEND);
if (muted)
{
@@ -9441,34 +9429,34 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
gGL.setColorMask(false, true);
}
- gGL.setSceneBlendType(LLRender::BT_ADD);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest depth(GL_FALSE, GL_FALSE);
+ LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_GREATER);
gGL.flush();
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
glLoadIdentity();
+ static const F32 clip_plane = 0.99999f;
+
gGL.color4ub(64,64,64,255);
gGL.begin(LLRender::QUADS);
- gGL.vertex2f(-1, -1);
- gGL.vertex2f(1, -1);
- gGL.vertex2f(1, 1);
- gGL.vertex2f(-1, 1);
+ gGL.vertex3f(-1, -1, clip_plane);
+ gGL.vertex3f(1, -1, clip_plane);
+ gGL.vertex3f(1, 1, clip_plane);
+ gGL.vertex3f(-1, 1, clip_plane);
gGL.end();
gGL.flush();
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
-
avatar->mImpostor.flush();
avatar->setImpostorDim(tdim);