diff options
author | Merov Linden <merov@lindenlab.com> | 2014-02-10 21:07:21 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-02-10 21:07:21 -0800 |
commit | 2e948a8dc678d3bb5f1d4f34a04efac79b952187 (patch) | |
tree | 601637c76d2118a803ee79f91339453e1bc5f676 /indra/newview/lldrawpoolavatar.cpp | |
parent | bd800bc2efbba57b66c4a776ac399b3680d184b5 (diff) | |
parent | 413be91cf5044889ade97dcbec4b17fceff122e3 (diff) |
Pull merge from lindenlab/viewer-release
Diffstat (limited to 'indra/newview/lldrawpoolavatar.cpp')
-rwxr-xr-x | indra/newview/lldrawpoolavatar.cpp | 47 |
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(); } |