Alchemy llcharacter and llcommon merge pass.

This commit is contained in:
Shyotl
2017-03-31 02:08:03 -05:00
parent f95be54bd5
commit 1230748ef5
61 changed files with 301 additions and 304 deletions

View File

@@ -46,7 +46,7 @@ LLUUID const ANIM_AGENT_BLOW_KISS ("db84829b-462c-ee83-1e27-9bbee66b
LLUUID const ANIM_AGENT_BORED ("b906c4ba-703b-1940-32a3-0c7f7d791510");
LLUUID const ANIM_AGENT_BOW ("82e99230-c906-1403-4d9c-3889dd98daba");
LLUUID const ANIM_AGENT_BRUSH ("349a3801-54f9-bf2c-3bd0-1ac89772af01");
LLUUID const ANIM_AGENT_BUSY ("efcf670c-2d18-8128-973a-034ebc806b67");
LLUUID const ANIM_AGENT_DO_NOT_DISTURB ("efcf670c-2d18-8128-973a-034ebc806b67");
LLUUID const ANIM_AGENT_CLAP ("9b0c1c4e-8ac7-7969-1494-28c874c4f668");
LLUUID const ANIM_AGENT_COURTBOW ("9ba1c942-08be-e43a-fb29-16ad440efc50");
LLUUID const ANIM_AGENT_CROUCH ("201f3fdf-cb1f-dbec-201f-7333e328ae7c");
@@ -211,7 +211,7 @@ LLAnimationLibrary::LLAnimationLibrary() :
mAnimMap[ANIM_AGENT_BORED]= mAnimStringTable.addString("express_bored");
mAnimMap[ANIM_AGENT_BOW]= mAnimStringTable.addString("bow");
mAnimMap[ANIM_AGENT_BRUSH]= mAnimStringTable.addString("brush");
mAnimMap[ANIM_AGENT_BUSY]= mAnimStringTable.addString("busy");
mAnimMap[ANIM_AGENT_DO_NOT_DISTURB]= mAnimStringTable.addString("busy");
mAnimMap[ANIM_AGENT_CLAP]= mAnimStringTable.addString("clap");
mAnimMap[ANIM_AGENT_COURTBOW]= mAnimStringTable.addString("courtbow");
mAnimMap[ANIM_AGENT_CROUCH]= mAnimStringTable.addString("crouch");

View File

@@ -56,7 +56,7 @@ extern const LLUUID ANIM_AGENT_BLOW_KISS;
extern const LLUUID ANIM_AGENT_BORED;
extern const LLUUID ANIM_AGENT_BOW;
extern const LLUUID ANIM_AGENT_BRUSH;
extern const LLUUID ANIM_AGENT_BUSY;
extern const LLUUID ANIM_AGENT_DO_NOT_DISTURB;
extern const LLUUID ANIM_AGENT_CLAP;
extern const LLUUID ANIM_AGENT_COURTBOW;
extern const LLUUID ANIM_AGENT_CROUCH;

View File

@@ -80,13 +80,14 @@ LLHeadRotMotion::LLHeadRotMotion(LLUUID const& id, LLMotionController* controlle
AIMaskedMotion(id, controller, ANIM_AGENT_HEAD_ROT),
mCharacter(NULL),
mTorsoJoint(NULL),
mHeadJoint(NULL)
mHeadJoint(NULL),
mRootJoint(NULL),
mPelvisJoint(NULL),
mHeadState(new LLJointState),
mTorsoState(new LLJointState),
mNeckState(new LLJointState)
{
mName = "head_rot";
mTorsoState = new LLJointState;
mNeckState = new LLJointState;
mHeadState = new LLJointState;
}
@@ -388,7 +389,7 @@ void LLEyeMotion::adjustEyeTarget(LLVector3* targetPos, LLJointState& left_eye_s
// calculate vergence
F32 interocular_dist = (left_eye_state.getJoint()->getWorldPosition() - right_eye_state.getJoint()->getWorldPosition()).magVec();
vergence = -atan2((interocular_dist / 2.f), lookAtDistance);
llclamp(vergence, -F_PI_BY_TWO, 0.f);
vergence = llclamp(vergence, -F_PI_BY_TWO, 0.f);
}
else
{

View File

@@ -70,15 +70,15 @@ protected:
public:
// Constructor
LLJointState()
: mUsage(0)
, mJoint(NULL)
: mJoint(NULL)
, mUsage(0)
, mWeight(0.f)
, mPriority(LLJoint::USE_MOTION_PRIORITY)
{}
LLJointState(LLJoint* joint)
: mUsage(0)
, mJoint(joint)
: mJoint(joint)
, mUsage(0)
, mWeight(0.f)
, mPriority(LLJoint::USE_MOTION_PRIORITY)
{}

View File

@@ -447,7 +447,9 @@ void LLKeyframeMotion::JointMotion::update(LLJointState* joint_state, F32 time,
//-----------------------------------------------------------------------------
LLKeyframeMotion::LLKeyframeMotion(const LLUUID &id, LLMotionController* controller)
: LLMotion(id, controller),
mJointMotionList(NULL),
mPelvisp(NULL),
mCharacter(NULL),
mLastSkeletonSerialNum(0),
mLastUpdateTime(0.f),
mLastLoopedTime(0.f),
@@ -1101,11 +1103,11 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8
if (constraint->mSharedData->mChainLength != 0 &&
dist_vec_squared(root_pos, target_pos) * 0.95f > constraint->mTotalLength * constraint->mTotalLength)
{
constraint->mWeight = lerp(constraint->mWeight, 0.f, LLSmoothInterpolation::getInterpolant(0.1f));
constraint->mWeight = LLSmoothInterpolation::lerp(constraint->mWeight, 0.f, 0.1f);
}
else
{
constraint->mWeight = lerp(constraint->mWeight, 1.f, LLSmoothInterpolation::getInterpolant(0.3f));
constraint->mWeight = LLSmoothInterpolation::lerp(constraint->mWeight, 1.f, 0.3f);
}
F32 weight = constraint->mWeight * ((shared_data->mEaseOutStopTime == 0.f) ? 1.f :
@@ -1783,14 +1785,13 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
for(S32 i = 0; i < num_constraints; ++i)
{
// read in constraint data
JointConstraintSharedData* constraintp = new JointConstraintSharedData;
auto constraintp = new JointConstraintSharedData;
std::unique_ptr<JointConstraintSharedData> watcher(constraintp);
U8 byte = 0;
if (!dp.unpackU8(byte, "chain_length"))
{
LL_WARNS() << "can't read constraint chain length" << LL_ENDL;
delete constraintp;
return FALSE;
}
constraintp->mChainLength = (S32) byte;
@@ -1798,21 +1799,18 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if((U32)constraintp->mChainLength > mJointMotionList->getNumJointMotions())
{
LL_WARNS() << "invalid constraint chain length" << LL_ENDL;
delete constraintp;
return FALSE;
}
if (!dp.unpackU8(byte, "constraint_type"))
{
LL_WARNS() << "can't read constraint type" << LL_ENDL;
delete constraintp;
return FALSE;
}
if( byte >= NUM_CONSTRAINT_TYPES )
{
LL_WARNS() << "invalid constraint type" << LL_ENDL;
delete constraintp;
return FALSE;
}
constraintp->mConstraintType = (EConstraintType)byte;
@@ -1822,7 +1820,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if (!dp.unpackBinaryDataFixed(bin_data, BIN_DATA_LENGTH, "source_volume"))
{
LL_WARNS() << "can't read source volume name" << LL_ENDL;
delete constraintp;
return FALSE;
}
@@ -1834,7 +1831,6 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
if(constraintp->mSourceConstraintVolume == -1)
{
LL_WARNS() << "can't get source constraint volume" << LL_ENDL;
delete constraintp;
return FALSE;
}
// </edit>
@@ -1924,12 +1920,12 @@ BOOL LLKeyframeMotion::deserialize(LLDataPacker& dp)
return FALSE;
}
constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; // note: mChainLength is size-limited - comes from a byte
if (singu_new_joint_motion_list)
{
mJointMotionList->mConstraints.push_front(watcher.release());
}
constraintp->mJointStateIndices = new S32[constraintp->mChainLength + 1]; // note: mChainLength is size-limited - comes from a byte
LLJoint* joint = mCharacter->findCollisionVolume(constraintp->mSourceConstraintVolume);
// get joint to which this collision volume is attached
@@ -2168,7 +2164,7 @@ void LLKeyframeMotion::setEmote(const LLUUID& emote_id)
}
else
{
mJointMotionList->mEmoteName = "";
mJointMotionList->mEmoteName.clear();
}
}

View File

@@ -140,14 +140,18 @@ BOOL LLKeyframeWalkMotion::onUpdate(F32 time, U8* joint_mask)
//-----------------------------------------------------------------------------
LLWalkAdjustMotion::LLWalkAdjustMotion(LLUUID const& id, LLMotionController* controller) :
AIMaskedMotion(id, controller, ANIM_AGENT_WALK_ADJUST),
mCharacter(NULL),
mLastTime(0.f),
mAnimSpeed(0.f),
mAdjustedSpeed(0.f),
mRelativeDir(0.f),
mAnkleOffset(0.f)
mAnkleOffset(0.f),
mLeftAnkleJoint(NULL),
mRightAnkleJoint(NULL),
mPelvisJoint(NULL),
mPelvisState(new LLJointState)
{
mName = "walk_adjust";
mPelvisState = new LLJointState;
}
//-----------------------------------------------------------------------------
@@ -287,7 +291,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
F32 desired_speed_multiplier = llclamp(speed / foot_speed, min_speed_multiplier, ANIM_SPEED_MAX);
// blend towards new speed adjustment value
F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLSmoothInterpolation::getInterpolant(SPEED_ADJUST_TIME_CONSTANT));
F32 new_speed_adjust = LLSmoothInterpolation::lerp(mAdjustedSpeed, desired_speed_multiplier, SPEED_ADJUST_TIME_CONSTANT);
// limit that rate at which the speed adjustment changes
F32 speedDelta = llclamp(new_speed_adjust - mAdjustedSpeed, -SPEED_ADJUST_MAX_SEC * delta_time, SPEED_ADJUST_MAX_SEC * delta_time);
@@ -305,7 +309,7 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
{ // standing/turning
// damp out speed adjustment to 0
mAnimSpeed = lerp(mAnimSpeed, 1.f, LLSmoothInterpolation::getInterpolant(0.2f));
mAnimSpeed = LLSmoothInterpolation::lerp(mAnimSpeed, 1.f, 0.2f);
//mPelvisOffset = lerp(mPelvisOffset, LLVector3::zero, LLSmoothInterpolation::getInterpolant(0.2f));
}
@@ -333,6 +337,7 @@ void LLWalkAdjustMotion::onDeactivate()
//-----------------------------------------------------------------------------
LLFlyAdjustMotion::LLFlyAdjustMotion(LLUUID const& id, LLMotionController* controller)
: AIMaskedMotion(id, controller, ANIM_AGENT_FLY_ADJUST),
mCharacter(NULL),
mRoll(0.f)
{
mName = "fly_adjust";
@@ -384,7 +389,7 @@ BOOL LLFlyAdjustMotion::onUpdate(F32 time, U8* joint_mask)
F32 target_roll = llclamp(ang_vel.mV[VZ], -4.f, 4.f) * roll_factor;
// roll is critically damped interpolation between current roll and angular velocity-derived target roll
mRoll = lerp(mRoll, target_roll, LLSmoothInterpolation::getInterpolant(0.1f));
mRoll = LLSmoothInterpolation::lerp(mRoll, target_roll, U32Milliseconds(100));
LLQuaternion roll(mRoll, LLVector3(0.f, 0.f, 1.f));
mPelvisState->setRotation(roll);

View File

@@ -83,7 +83,7 @@ LLMotionRegistry::~LLMotionRegistry()
BOOL LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor constructor )
{
// LL_INFOS() << "Registering motion: " << name << LL_ENDL;
return mMotionTable.insert(std::make_pair(id,constructor)).second;
return mMotionTable.emplace(id, constructor).second;
}
//-----------------------------------------------------------------------------
@@ -582,9 +582,7 @@ static LLTrace::BlockTimerStatHandle FTM_MOTION_ON_UPDATE("Motion onUpdate");
void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type)
{
BOOL update_result = TRUE;
U8 last_joint_signature[LL_CHARACTER_MAX_ANIMATED_JOINTS];
memset(&last_joint_signature, 0, sizeof(U8) * LL_CHARACTER_MAX_ANIMATED_JOINTS);
U8 last_joint_signature[LL_CHARACTER_MAX_ANIMATED_JOINTS] = {0};
// iterate through active motions in chronological order
for (motion_list_t::iterator iter = mActiveMotions.begin();

View File

@@ -180,34 +180,34 @@ BOOL LLMultiGesture::deserialize(LLDataPacker& dp)
{
case STEP_ANIMATION:
{
LLGestureStepAnimation* step = new LLGestureStepAnimation();
std::unique_ptr<LLGestureStep> step(new LLGestureStepAnimation());
BOOL ok = step->deserialize(dp);
if (!ok) return FALSE;
mSteps.push_back(step);
mSteps.push_back(step.release());
break;
}
case STEP_SOUND:
{
LLGestureStepSound* step = new LLGestureStepSound();
std::unique_ptr<LLGestureStep> step(new LLGestureStepSound());
BOOL ok = step->deserialize(dp);
if (!ok) return FALSE;
mSteps.push_back(step);
mSteps.push_back(step.release());
break;
}
case STEP_CHAT:
{
LLGestureStepChat* step = new LLGestureStepChat();
std::unique_ptr<LLGestureStep> step(new LLGestureStepChat());
BOOL ok = step->deserialize(dp);
if (!ok) return FALSE;
mSteps.push_back(step);
mSteps.push_back(step.release());
break;
}
case STEP_WAIT:
{
LLGestureStepWait* step = new LLGestureStepWait();
std::unique_ptr<LLGestureStep> step(new LLGestureStepWait());
BOOL ok = step->deserialize(dp);
if (!ok) return FALSE;
mSteps.push_back(step);
mSteps.push_back(step.release());
break;
}
default: