summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-02-11 16:45:59 -0600
committerDave Parks <davep@lindenlab.com>2011-02-11 16:45:59 -0600
commit246b2100e18e6e9e596aacc92a65bd7b6442b0ec (patch)
treed501aeba8a656321ee9d5b92f395ea2a3ba829d0 /indra/newview
parentf546f06452f453cf062d166ddebefd98afbd118b (diff)
SH-912 Fix for avatar impostors glitching out at weird angles.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llvoavatar.cpp10
-rwxr-xr-xindra/newview/pipeline.cpp28
2 files changed, 26 insertions, 12 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index a257703b24..0771e72bdc 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -3335,13 +3335,21 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
if (visible && !isSelf() && !mIsDummy && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter)
{
+ const LLVector4a* ext = mDrawable->getSpatialExtents();
+ LLVector4a size;
+ size.setSub(ext[1],ext[0]);
+ F32 mag = size.getLength3().getF32()*0.5f;
+
F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f);
if (LLMuteList::getInstance()->isMuted(getID()))
{ // muted avatars update at 16 hz
mUpdatePeriod = 16;
}
- else if (mVisibilityRank <= LLVOAvatar::sMaxVisible)
+ else if (mVisibilityRank <= LLVOAvatar::sMaxVisible ||
+ mDrawable->mDistanceWRTCamera < 1.f + mag)
{ //first 25% of max visible avatars are not impostored
+ //also, don't impostor avatars whose bounding box may be penetrating the
+ //impostor camera near clip plane
mUpdatePeriod = 1;
}
else if (mVisibilityRank > LLVOAvatar::sMaxVisible * 4)
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 69173d26f4..b0aa50bc57 100755
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -9352,10 +9352,10 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
glMatrixMode(GL_PROJECTION);
glPushMatrix();
- //glh::matrix4f ortho = gl_ortho(-tdim.mV[0], tdim.mV[0], -tdim.mV[1], tdim.mV[1], 1.0, 256.0);
+
F32 distance = (pos-camera.getOrigin()).length();
F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG;
- F32 aspect = tdim.mV[0]/tdim.mV[1]; //128.f/256.f;
+ F32 aspect = tdim.mV[0]/tdim.mV[1];
glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f);
glh_set_current_projection(persp);
glLoadMatrixf(persp.m);
@@ -9374,7 +9374,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
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());
@@ -9424,9 +9424,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
glStencilFunc(GL_EQUAL, 1, 0xFFFFFF);
{ //create alpha mask based on stencil buffer (grey out if muted)
- LLVector3 left = camera.getLeftAxis()*tdim.mV[0]*2.f;
- LLVector3 up = camera.getUpAxis()*tdim.mV[1]*2.f;
-
if (LLPipeline::sRenderDeferred)
{
GLuint buff = GL_COLOR_ATTACHMENT0_EXT;
@@ -9449,16 +9446,25 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
LLGLDepthTest depth(GL_FALSE, GL_FALSE);
- gGL.color4f(1,1,1,1);
+ gGL.flush();
+
+ glPushMatrix();
+ glLoadIdentity();
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+
gGL.color4ub(64,64,64,255);
gGL.begin(LLRender::QUADS);
- gGL.vertex3fv((pos+left-up).mV);
- gGL.vertex3fv((pos-left-up).mV);
- gGL.vertex3fv((pos-left+up).mV);
- gGL.vertex3fv((pos+left+up).mV);
+ gGL.vertex2f(-1, -1);
+ gGL.vertex2f(1, -1);
+ gGL.vertex2f(1, 1);
+ gGL.vertex2f(-1, 1);
gGL.end();
gGL.flush();
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}