Merge branch 'animesh' of git://github.com/Shyotl/SingularityViewer into animesh
This commit is contained in:
@@ -257,10 +257,15 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
|
||||
//S32 active_verts = 0;
|
||||
vol_face.mJointRiggingInfoTab.resize(LL_CHARACTER_MAX_ANIMATED_JOINTS);
|
||||
LLJointRiggingInfoTab &rig_info_tab = vol_face.mJointRiggingInfoTab;
|
||||
|
||||
LLMatrix4a bind_shape;
|
||||
bind_shape.loadu(skin->mBindShapeMatrix);
|
||||
|
||||
LLMatrix4a bind_shape;
|
||||
bind_shape.loadu(skin->mBindShapeMatrix);
|
||||
LLMatrix4a matrixPalette[LL_CHARACTER_MAX_ANIMATED_JOINTS];
|
||||
for (U32 i = 0; i < llmin(skin->mInvBindMatrix.size(), (size_t)LL_CHARACTER_MAX_ANIMATED_JOINTS); ++i)
|
||||
{
|
||||
LLMatrix4a inverse_bind;
|
||||
inverse_bind.loadu(skin->mInvBindMatrix[i]);
|
||||
matrixPalette[i].setMul(inverse_bind, bind_shape);
|
||||
}
|
||||
for (S32 i=0; i<vol_face.mNumVertices; i++)
|
||||
{
|
||||
LLVector4a& pos = vol_face.mPositions[i];
|
||||
@@ -285,24 +290,18 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
|
||||
}
|
||||
for (U32 k=0; k<4; ++k)
|
||||
{
|
||||
S32 joint_index = idx[k];
|
||||
// FIXME could precompute these matMuls.
|
||||
LLMatrix4a inv_bind;
|
||||
inv_bind.loadu(skin->mInvBindMatrix[joint_index]);
|
||||
LLMatrix4a mat;
|
||||
mat.setMul(bind_shape, inv_bind);
|
||||
LLVector4a pos_joint_space;
|
||||
mat.affineTransform(pos, pos_joint_space);
|
||||
S32 joint_index = idx[k];
|
||||
if (wght[k] > 0.0f)
|
||||
{
|
||||
S32 joint_num = skin->mJointNums[joint_index];
|
||||
if (joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS)
|
||||
{
|
||||
rig_info_tab[joint_num].setIsRiggedTo(true);
|
||||
LLVector4a final_pos;
|
||||
final_pos.setMul(pos_joint_space, wght[k]);
|
||||
LLVector4a pos_joint_space;
|
||||
matrixPalette[joint_index].affineTransform(pos, pos_joint_space);
|
||||
pos_joint_space.mul(wght[k]);
|
||||
LLVector4a *extents = rig_info_tab[joint_num].getRiggedExtents();
|
||||
update_min_max(extents[0], extents[1], final_pos);
|
||||
update_min_max(extents[0], extents[1], pos_joint_space);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1943,6 +1943,10 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
|
||||
gGL.diffuseColor4f(0,1,0.5,1);
|
||||
}
|
||||
}
|
||||
else if (drawable->getVObj()->asAvatar())
|
||||
{
|
||||
gGL.diffuseColor4f(.5, 0, 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gGL.diffuseColor4f(1,0,1,1); // magenta
|
||||
|
||||
@@ -1922,7 +1922,7 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
|
||||
}
|
||||
|
||||
// Stretch bounding box by rigged mesh joint boxes
|
||||
if (box_detail>=3)
|
||||
if (box_detail>=3 && gMeshRepo.meshRezEnabled())
|
||||
{
|
||||
updateRiggingInfo();
|
||||
for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++)
|
||||
@@ -6922,21 +6922,11 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL
|
||||
}
|
||||
|
||||
LLVOVolume *vobj = dynamic_cast<LLVOVolume*>(vo);
|
||||
bool pelvisGotSet = false;
|
||||
|
||||
if (!vobj)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (vobj->isMesh() &&
|
||||
((vobj->getVolume() && !vobj->getVolume()->isMeshAssetLoaded()) || !gMeshRepo.meshRezEnabled()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
const LLMeshSkinInfo* pSkinData = vobj->getSkinInfo();
|
||||
|
||||
if ( vobj && vobj->isMesh() && pSkinData )
|
||||
if (vobj && vobj->isRiggedMesh() &&
|
||||
vobj->getVolume() && vobj->getVolume()->isMeshAssetLoaded() && gMeshRepo.meshRezEnabled())
|
||||
{
|
||||
bool pelvisGotSet = false;
|
||||
const LLMeshSkinInfo* pSkinData = vobj->getSkinInfo();
|
||||
const U32 bindCnt = pSkinData->mAlternateBindMatrix.size();
|
||||
const U32 jointCnt = pSkinData->mJointNames.size();
|
||||
if ((bindCnt > 0) && (bindCnt != jointCnt))
|
||||
@@ -7002,12 +6992,11 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL
|
||||
onActiveOverrideMeshesChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Rebuild body data if we altered joints/pelvis
|
||||
if ( pelvisGotSet )
|
||||
{
|
||||
postPelvisSetRecalc();
|
||||
//Rebuild body data if we altered joints/pelvis
|
||||
if (pelvisGotSet)
|
||||
{
|
||||
postPelvisSetRecalc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10458,7 +10447,7 @@ void LLVOAvatar::updateRiggingInfo()
|
||||
for (std::vector<LLVOVolume*>::iterator it = volumes.begin(); it != volumes.end(); ++it)
|
||||
{
|
||||
LLVOVolume *vol = *it;
|
||||
if (vol->isMesh() && vol->getVolume())
|
||||
if (vol->isRiggedMesh() && vol->getVolume() && vol->getVolume()->isMeshAssetLoaded())
|
||||
{
|
||||
const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID();
|
||||
S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD);
|
||||
|
||||
Reference in New Issue
Block a user