From a5baa68caac01586e23b5e85812ee8b233968f82 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 26 Aug 2014 16:12:12 +0200 Subject: [PATCH] Back out 95717cf8bf82 as matrix array length is properly checked in a following step already and modified llfloatermodelpreview.cpp accordingly --- indra/newview/llfloatermodelpreview.cpp | 17 ++++++++++------- indra/newview/llvovolume.cpp | 5 +---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index bb73bd42cc..ee5df1688e 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -118,6 +118,9 @@ // #include "nd/ndboolswitch.h" // To toggle LLRender::sGLCoreProfile +// Proper matrix array length for fitted mesh +#define JOINT_COUNT 52 + const S32 SLM_SUPPORTED_VERSION = 3; //static @@ -5611,8 +5614,8 @@ BOOL LLModelPreview::render() // Proper matrix array length for fitted mesh //LLMatrix4 mat[64]; //for (U32 j = 0; j < model->mSkinInfo.mJointNames.size(); ++j) - LLMatrix4 mat[52]; - U32 count = llmin((U32) model->mSkinInfo.mJointNames.size(), (U32) 52); + LLMatrix4 mat[JOINT_COUNT]; + U32 count = llmin((U32) model->mSkinInfo.mJointNames.size(), (U32) JOINT_COUNT); for (U32 j = 0; j < count; ++j) // { @@ -5637,10 +5640,7 @@ BOOL LLModelPreview::render() { F32 w = weight[j].mV[k]; - // Proper matrix array length for fitted mesh - //idx[k] = (S32) floorf(w); - idx[k] = llclamp((S32) floorf(w), 0, 51); - // + idx[k] = (S32) floorf(w); wght.mV[k] = w - floorf(w); scale += wght.mV[k]; } @@ -5649,7 +5649,10 @@ BOOL LLModelPreview::render() for (U32 k = 0; k < 4; k++) { - F32* src = (F32*) mat[idx[k]].mMatrix; + // Proper matrix array length for fitted mesh + //F32* src = (F32*) mat[idx[k]].mMatrix; + F32* src = (F32*) mat[idx[(k < JOINT_COUNT) ? k : 0]].mMatrix; + // F32* dst = (F32*) final_mat.mMatrix; F32 w = wght.mV[k]; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index e435d16b40..024fa403de 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4087,10 +4087,7 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons { F32 w = weight[j][k]; - // Proper matrix array length for fitted mesh - //idx[k] = (S32) floorf(w); - idx[k] = llclamp((S32) floorf(w), 0, (S32)kMaxJoints - 1); - // + idx[k] = (S32) floorf(w); wght[k] = w - floorf(w); scale += wght[k]; }