summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolavatar.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-02-24 13:23:39 -0800
committerMerov Linden <merov@lindenlab.com>2014-02-24 13:23:39 -0800
commit245de340d72d0a836cc7525cf8143c232b00235b (patch)
tree1436dbf2dfac1deecee4a2ded9a891b7bf68bfb5 /indra/newview/lldrawpoolavatar.cpp
parente6efb8f297fa21d76876f391f57d8abdd065584a (diff)
parentde8fea13627cc5978b8a6135802a52864a11c39a (diff)
Pull merge from viewer-release
Diffstat (limited to 'indra/newview/lldrawpoolavatar.cpp')
-rwxr-xr-xindra/newview/lldrawpoolavatar.cpp47
1 files changed, 41 insertions, 6 deletions
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index f622d5a63a..24f467f954 100755
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -55,6 +55,7 @@ static U32 sDataMask = LLDrawPoolAvatar::VERTEX_DATA_MASK;
static U32 sBufferUsage = GL_STREAM_DRAW_ARB;
static U32 sShaderLevel = 0;
+#define JOINT_COUNT 52
LLGLSLShader* LLDrawPoolAvatar::sVertexProgram = NULL;
BOOL LLDrawPoolAvatar::sSkipOpaque = FALSE;
@@ -1582,10 +1583,11 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
LLVector4a* norm = has_normal ? (LLVector4a*) normal.get() : NULL;
//build matrix palette
- LLMatrix4a mp[64];
+ LLMatrix4a mp[JOINT_COUNT];
LLMatrix4* mat = (LLMatrix4*) mp;
- for (U32 j = 0; j < skin->mJointNames.size(); ++j)
+ U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT);
+ for (U32 j = 0; j < count; ++j)
{
LLJoint* joint = avatar->getJoint(skin->mJointNames[j]);
if (joint)
@@ -1642,6 +1644,7 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*
LLVector4a& n = vol_face.mNormals[j];
bind_shape_matrix.rotate(n, t);
final_mat.rotate(t, dst);
+ dst.normalize3fast();
norm[j] = dst;
}
}
@@ -1708,9 +1711,9 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
{
if (sShaderLevel > 0)
{ //upload matrix palette to shader
- LLMatrix4 mat[32];
+ LLMatrix4 mat[JOINT_COUNT];
- U32 count = llmin((U32) skin->mJointNames.size(), (U32) 32);
+ U32 count = llmin((U32) skin->mJointNames.size(), (U32) JOINT_COUNT);
for (U32 i = 0; i < count; ++i)
{
@@ -1724,10 +1727,42 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)
stop_glerror();
- LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv(LLViewerShaderMgr::AVATAR_MATRIX,
+ F32 mp[JOINT_COUNT*9];
+
+ F32 transp[JOINT_COUNT*3];
+
+ for (U32 i = 0; i < count; ++i)
+ {
+ F32* m = (F32*) mat[i].mMatrix;
+
+ U32 idx = i*9;
+
+ mp[idx+0] = m[0];
+ mp[idx+1] = m[1];
+ mp[idx+2] = m[2];
+
+ mp[idx+3] = m[4];
+ mp[idx+4] = m[5];
+ mp[idx+5] = m[6];
+
+ mp[idx+6] = m[8];
+ mp[idx+7] = m[9];
+ mp[idx+8] = m[10];
+
+ idx = i*3;
+
+ transp[idx+0] = m[12];
+ transp[idx+1] = m[13];
+ transp[idx+2] = m[14];
+ }
+
+ LLDrawPoolAvatar::sVertexProgram->uniformMatrix3fv(LLViewerShaderMgr::AVATAR_MATRIX,
count,
FALSE,
- (GLfloat*) mat[0].mMatrix);
+ (GLfloat*) mp);
+
+ LLDrawPoolAvatar::sVertexProgram->uniform3fv(LLShaderMgr::AVATAR_TRANSLATION, count, transp);
+
stop_glerror();
}