Fixes for SH-4321. Also removed some unnecessary transform updates, and unused joint resetting code

master
prep@lindenlab.com 2013-08-06 16:44:01 -05:00
parent a1fadad9c0
commit 8b612cab39
4 changed files with 27 additions and 39 deletions

View File

@ -248,20 +248,18 @@ void LLJoint::setPosition( const LLVector3& pos )
// setPosition()
//--------------------------------------------------------------------
void LLJoint::setDefaultFromCurrentXform( void )
{
{
mDefaultXform = mXform;
touch(ALL_DIRTY);
}
//--------------------------------------------------------------------
// storeCurrentXform()
//--------------------------------------------------------------------
void LLJoint::storeCurrentXform( const LLVector3& pos )
{
{
mOldXform = mXform;
mResetAfterRestoreOldXform = true;
setPosition( pos );
touch(ALL_DIRTY);
}
@ -277,10 +275,9 @@ void LLJoint::storeScaleForReset( const LLVector3& scale )
//--------------------------------------------------------------------
void LLJoint::restoreOldXform( void )
{
mXform = mOldXform;
mXform.setScaleChildOffset( mOldXform.getScaleChildOffset() );
mXform = mDefaultXform;
mResetAfterRestoreOldXform = false;
mDirtyFlags = ALL_DIRTY;
mDirtyFlags = ALL_DIRTY;
}
//--------------------------------------------------------------------
// getWorldPosition()
@ -298,8 +295,6 @@ LLVector3 LLJoint::getLastWorldPosition()
{
return mXform.getWorldPosition();
}
//--------------------------------------------------------------------
// setWorldPosition()
//--------------------------------------------------------------------

View File

@ -196,6 +196,7 @@ public:
//If the old transform flag has been set, then the reset logic in avatar needs to be aware(test) of it
const BOOL doesJointNeedToBeReset( void ) const { return mResetAfterRestoreOldXform; }
void setJointResetFlag( bool val ) { mResetAfterRestoreOldXform = val; }
};
#endif // LL_LLJOINT_H

View File

@ -1294,6 +1294,8 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax)
mImpostorOffset = LLVector3(pos_group.getF32ptr())-getRenderPosition();
mDrawable->setPositionGroup(pos_group);
}
}
void LLVOAvatar::getSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
@ -3510,6 +3512,9 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
//mesh vertices need to be reskinned
mNeedsSkin = TRUE;
return TRUE;
}
//-----------------------------------------------------------------------------
@ -4927,28 +4932,6 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name )
return jointp;
}
//-----------------------------------------------------------------------------
// resetSpecificJointPosition
//-----------------------------------------------------------------------------
void LLVOAvatar::resetSpecificJointPosition( const std::string& name )
{
LLJoint* pJoint = mRoot->findJoint( name );
if ( pJoint && pJoint->doesJointNeedToBeReset() )
{
pJoint->restoreOldXform();
pJoint->setId( LLUUID::null );
//If we're reseting the pelvis position make sure not to apply offset
if ( name == "mPelvis" )
{
mHasPelvisOffset = false;
}
}
else
{
llinfos<<"Did not find "<< name.c_str()<<llendl;
}
}
//-----------------------------------------------------------------------------
// resetJointPositionsToDefault
//-----------------------------------------------------------------------------
void LLVOAvatar::resetJointPositionsToDefault( void )
@ -4956,20 +4939,30 @@ void LLVOAvatar::resetJointPositionsToDefault( void )
//Subsequent joints are relative to pelvis
avatar_joint_list_t::iterator iter = mSkeleton.begin();
avatar_joint_list_t::iterator end = mSkeleton.end();
LLJoint* pJointPelvis = getJoint("mPelvis");
for (; iter != end; ++iter)
{
LLJoint* pJoint = (*iter);
if ( pJoint && pJoint->doesJointNeedToBeReset() )
//Reset joints except for pelvis
if ( pJoint && pJoint != pJointPelvis && pJoint->doesJointNeedToBeReset() )
{
pJoint->setId( LLUUID::null );
pJoint->restoreOldXform();
}
}
else
if ( pJoint && pJoint == pJointPelvis && pJoint->doesJointNeedToBeReset() )
{
pJoint->setId( LLUUID::null );
pJoint->setPosition( LLVector3( 0.0f, 0.0f, 0.0f) );
pJoint->setJointResetFlag( false );
}
}
//make sure we don't apply the joint offset
mHasPelvisOffset = false;
mPelvisFixup = mLastPelvisFixup;
postPelvisSetRecalc();
}
//-----------------------------------------------------------------------------
@ -5125,7 +5118,7 @@ BOOL LLVOAvatar::loadSkeletonNode ()
{
attachment->setOriginalPosition(info->mPosition);
}
if (info->mHasRotation)
{
LLQuaternion rotation;
@ -5195,7 +5188,6 @@ void LLVOAvatar::updateVisualParams()
dirtyMesh();
updateHeadOffset();
}
//-----------------------------------------------------------------------------
// isActive()
//-----------------------------------------------------------------------------
@ -5534,6 +5526,7 @@ void LLVOAvatar::lazyAttach()
void LLVOAvatar::resetHUDAttachments()
{
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end();
++iter)

View File

@ -200,7 +200,6 @@ public:
virtual LLJoint* getJoint(const std::string &name);
void resetJointPositionsToDefault( void );
void resetSpecificJointPosition( const std::string& name );
/*virtual*/ const LLUUID& getID() const;
/*virtual*/ void addDebugText(const std::string& text);
@ -209,7 +208,7 @@ public:
/*virtual*/ F32 getPixelArea() const;
/*virtual*/ LLVector3d getPosGlobalFromAgent(const LLVector3 &position);
/*virtual*/ LLVector3 getPosAgentFromGlobal(const LLVector3d &position);
virtual void updateVisualParams();
virtual void updateVisualParams();
/** Inherited