diff options
| author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2015-09-01 15:20:15 -0400 | 
|---|---|---|
| committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2015-09-01 15:20:15 -0400 | 
| commit | cebfad26175affa600a372f96618e42c2a99c74b (patch) | |
| tree | 0627d3eb276d176c3c586814c71b64e5acce8eb0 /indra | |
| parent | 9c391b3deaf66e698590065b6770549e00f4d9bc (diff) | |
| parent | 98166af9c711e63b5fedbf2227d3eb2e5fca8600 (diff) | |
merge
Diffstat (limited to 'indra')
| -rwxr-xr-x | indra/newview/lldrawpoolavatar.cpp | 8 | ||||
| -rwxr-xr-x | indra/newview/llvovolume.cpp | 34 | 
2 files changed, 37 insertions, 5 deletions
| diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 821d58a9b2..f828b56f7f 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1600,6 +1600,14 @@ void LLDrawPoolAvatar::updateRiggedFaceVertexBuffer(LLVOAvatar* avatar, LLFace*  		for (U32 j = 0; j < count; ++j)  		{  			LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); +			if (!joint) +			{ +				joint = avatar->getJoint("mPelvis"); +			} +			if (!joint) +			{ +				LL_DEBUGS("Avatar") << "Failed to find " << skin->mJointNames[j] << LL_ENDL; +			}  			if (joint)  			{  				mat[j] = skin->mInvBindMatrix[j]; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 4b0e4514a0..fb34d6f588 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4184,11 +4184,23 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons  	for (U32 j = 0; j < maxJoints; ++j)  	{  		LLJoint* joint = avatar->getJoint(skin->mJointNames[j]); +        if (!joint) +        { +            // Fall back to a point inside the avatar if mesh is +            // rigged to an unknown joint. +            joint = avatar->getJoint("mPelvis"); +        }  		if (joint)  		{  			mat[j] = skin->mInvBindMatrix[j];  			mat[j] *= joint->getWorldMatrix();  		} +		else +		{ +            // This shouldn't be possible unless the avatar skeleton +            // is corrupt. +			llassert(false); +		}  	}  	for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) @@ -4228,8 +4240,21 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons  						wght[k] = w - floorf(w);  						scale += wght[k];  					} - -					wght *= 1.f/scale; +					if (scale > 0.f) +					{ +						wght *= 1.f / scale; +					} +                    else +                    { +                        // Complete weighting fail - all zeroes.  Just +                        // pick some values that add up to 1.0 so we +                        // don't wind up with garbage vertices +                        // pointing off at (0,0,0) +                        wght[0] = 1.f; +                        wght[1] = 0.f; +                        wght[2] = 0.f; +                        wght[3] = 0.f; +                    }  					for (U32 k = 0; k < 4; k++)  					{ @@ -4237,9 +4262,8 @@ void LLRiggedVolume::update(const LLMeshSkinInfo* skin, LLVOAvatar* avatar, cons  						LLMatrix4a src;  						// Insure ref'd bone is in our clamped array of mats -						llassert(idx[k] < kMaxJoints); -						// clamp k to kMaxJoints to avoid reading garbage off stack in release -						src.setMul(mp[idx[(k < kMaxJoints) ? k : 0]], w); +						// clamp idx to maxJoints to avoid reading garbage off stack in release +						src.setMul(mp[(idx[k]<maxJoints)?idx[k]:0], w);  						final_mat.add(src);  					} | 
