Skip to content
Snippets Groups Projects
Commit c8283782 authored by Brad Payne (Vir Linden)'s avatar Brad Payne (Vir Linden)
Browse files

SL-234 WIP - fix for enforcement of MaxJointsPerMeshObject limit

parent 8970e9c6
No related branches found
No related tags found
No related merge requests found
...@@ -154,6 +154,8 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski ...@@ -154,6 +154,8 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski
return; return;
} }
U32 max_joints = getMeshJointCount(skin);
// Compute the remap // Compute the remap
std::vector<U32> j_proxy(skin->mJointNames.size()); std::vector<U32> j_proxy(skin->mJointNames.size());
for (U32 j = 0; j < skin->mJointNames.size(); ++j) for (U32 j = 0; j < skin->mJointNames.size(); ++j)
...@@ -163,13 +165,19 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski ...@@ -163,13 +165,19 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski
} }
S32 top = 0; S32 top = 0;
std::vector<U32> j_remap(skin->mJointNames.size()); std::vector<U32> j_remap(skin->mJointNames.size());
// Fill in j_remap for all joints that will make the cut. // Fill in j_remap for all joints that will be kept.
for (U32 j = 0; j < skin->mJointNames.size(); ++j) for (U32 j = 0; j < skin->mJointNames.size(); ++j)
{ {
if (j_proxy[j] == j) if (j_proxy[j] == j)
{ {
// Joint will be included // Joint will be included
j_remap[j] = top++; j_remap[j] = top;
if (top < max_joints-1)
{
top++;
}
} }
} }
// Then use j_proxy to fill in j_remap for the joints that will be discarded // Then use j_proxy to fill in j_remap for the joints that will be discarded
...@@ -189,7 +197,7 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski ...@@ -189,7 +197,7 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski
for (U32 j = 0; j < skin->mJointNames.size(); ++j) for (U32 j = 0; j < skin->mJointNames.size(); ++j)
{ {
if (j_proxy[j] == j) if (j_proxy[j] == j && new_joint_names.size() < max_joints)
{ {
new_joint_names.push_back(skin->mJointNames[j]); new_joint_names.push_back(skin->mJointNames[j]);
new_inv_bind_matrix.push_back(skin->mInvBindMatrix[j]); new_inv_bind_matrix.push_back(skin->mInvBindMatrix[j]);
...@@ -199,6 +207,7 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski ...@@ -199,6 +207,7 @@ void LLSkinningUtil::remapSkinInfoJoints(LLVOAvatar *avatar, LLMeshSkinInfo* ski
} }
} }
} }
llassert(new_joint_names.size() <= max_joints);
for (U32 j = 0; j < skin->mJointNames.size(); ++j) for (U32 j = 0; j < skin->mJointNames.size(); ++j)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment