Emerald physics cleanup. Removed unused cruft. Disabling by default since it never worked (although it does now if set to enabled).

This commit is contained in:
Shyotl
2012-06-18 14:50:39 -05:00
parent b5535c9cc4
commit a3e6e96869
11 changed files with 42 additions and 230 deletions

View File

@@ -56,8 +56,7 @@ LLCharacter::LLCharacter()
mPreferredPelvisHeight( 0.f ),
mSex( SEX_FEMALE ),
mAppearanceSerialNum( 0 ),
mSkeletonSerialNum( 0 ),
mInAppearance( false )
mSkeletonSerialNum( 0 )
{
llassert_always(sAllowInstancesChange) ;
sInstances.push_back(this);

View File

@@ -268,10 +268,6 @@ public:
ESex getSex() const { return mSex; }
void setSex( ESex sex ) { mSex = sex; }
// set appearance flag
void setAppearanceFlag( bool flag ) { mInAppearance = flag; }
bool getAppearanceFlag() { return mInAppearance; }
U32 getAppearanceSerialNum() const { return mAppearanceSerialNum; }
void setAppearanceSerialNum( U32 num ) { mAppearanceSerialNum = num; }
@@ -293,8 +289,6 @@ protected:
U32 mSkeletonSerialNum;
LLAnimPauseRequest mPauseRequest;
BOOL mInAppearance;
private:
// visual parameter stuff
typedef std::map<S32, LLVisualParam *> visual_param_index_map_t;

View File

@@ -510,20 +510,6 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask)
vergence_quat.transQuat();
right_eye_rot = vergence_quat * eye_jitter_rot * right_eye_rot;
//if in appearance, set the eyes straight forward
if(mCharacter->getAppearanceFlag()) // no idea why this variable is reversed
{
LLVector3 forward(1.f, 0.0, 0.0);
LLVector3 left;
LLVector3 up;
left.setVec(forward % forward);
up.setVec(forward % left);
target_eye_rot = LLQuaternion(forward, left, up);
mLeftEyeState->setRotation( target_eye_rot );
mRightEyeState->setRotation( target_eye_rot );
return TRUE;
}
mLeftEyeState->setRotation( left_eye_rot );
mRightEyeState->setRotation( right_eye_rot );

View File

@@ -806,17 +806,6 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>EmeraldUseProperArc</key>
<map>
<key>Comment</key>
<string>Enables/Disables a fixed ARC counter</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>EmeraldBoobMass</key>
<map>
<key>Comment</key>
@@ -848,17 +837,6 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>EmeraldBreastSportsBra</key>
<map>
<key>Comment</key>
<string>allows disabling the physics for 1 av, in case their outfit looks wrong with it on</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>EmeraldBoobVelMax</key>

View File

@@ -33,8 +33,6 @@ std::ostream &operator<<(std::ostream &os, const EmeraldBoobState &v)
os << "frameDuration: " << v.frameDuration << std::endl;
os << "chestDisplacement: " << v.chestDisplacement << std::endl;
os << "localChestDisplacement: " << v.localChestDisplacement << std::endl;
os << "displacementForce: " << v.displacementForce << std::endl;
os << "mysteryValue: " << v.mysteryValue << std::endl;
os << "Number of bounceStates: " << v.bounceStates.size() << std::endl;
return os;
}
@@ -45,8 +43,6 @@ std::ostream &operator<<(std::ostream &os, const EmeraldBoobInputs &v)
os << "chestPosition: " << v.chestPosition << std::endl;
os << "chestRotation: " << v.chestRotation << std::endl;
os << "elapsedTime: " << v.elapsedTime << std::endl;
os << "appearanceFlag: " << v.appearanceFlag << std::endl;
os << "appearanceAnimating: " << v.appearanceAnimating << std::endl;
return os;
}
@@ -80,27 +76,11 @@ EmeraldBoobState EmeraldBoobUtils::idleUpdate(const EmeraldGlobalBoobConfig &con
F32 avatarLocalMass = 0.0f;
F32 partMod = 1.f;
if(!config.enabled || inputs.appearanceFlag || inputs.appearanceAnimating)
if(!config.enabled)
return newState;
if(inputs.type == 0)
{
newState.boobGrav = localConfig.actualBoobGrav;
avatarLocalMass = (llclamp(localConfig.boobSize, 0.0f, 0.5f) / 0.5f);
}
if(inputs.type == 1)
{
newState.boobGrav = localConfig.actualButtGrav;
partMod = 1.5f;
avatarLocalMass = llclamp(localConfig.actualButtGrav, 0.0f, 0.5f) / 0.5f;
}
if(inputs.type == 2)
{
newState.boobGrav = localConfig.actualFatGrav;
partMod = 1.3f;
avatarLocalMass = localConfig.actualFatGrav;
}
newState.boobGrav = localConfig.actualBoobGrav;
avatarLocalMass = (llclamp(localConfig.boobSize, 0.0f, 0.5f) / 0.5f);
newState.elapsedTime = inputs.elapsedTime;
// seemed to create incorrect amounts of velocity when FPS varied
@@ -119,9 +99,10 @@ EmeraldBoobState EmeraldBoobUtils::idleUpdate(const EmeraldGlobalBoobConfig &con
boobVel = newState.localChestDisplacement.mV[VZ];
boobVel += newState.localChestDisplacement[VX] * config.XYInfluence;
boobVel += newState.localChestDisplacement.mV[VY] * config.XYInfluence;
boobVel *= newState.frameDuration * 0.3f * 100.f;
boobVel = llclamp(boobVel, -config.velMax, config.velMax);
if(fabs(boobVel) <= config.velMax * config.velMin * newState.frameDuration * 100.f)
boobVel *= newState.frameDuration * 0.3f * 100.f;
if(fabs(boobVel) <= config.velMin * newState.frameDuration * 100.f)
boobVel = 0.0f;
else
{
@@ -135,26 +116,6 @@ EmeraldBoobState EmeraldBoobUtils::idleUpdate(const EmeraldGlobalBoobConfig &con
}
}
/*if(fabs(newState.localChestDisplacement.length()) >= 0.f) {
LLVector3 displacementInfluence = newState.localChestDisplacement;
displacementInfluence *= LLVector3(0.3f, 0.3f, 1.0f);
F32 clampedDisplacementInfluenceLength = llclamp(displacementInfluence.length(), 0.0f, config.velMax);
if(displacementInfluence[VZ]<0.f)
clampedDisplacementInfluenceLength= -clampedDisplacementInfluenceLength;
EmeraldBoobBounceState bounceState;
bounceState.bounceStart = inputs.elapsedTime;
bounceState.bounceStartFrameDuration = newState.frameDuration;
bounceState.bounceStartAmplitude = clampedDisplacementInfluenceLength;
if(fabs(bounceState.bounceStartAmplitude) < config.velMin * config.velMax)
bounceState.bounceStartAmplitude = 0.0f;
else
{
bounceState.bounceStartAmplitude *= config.mass;
bounceStates.push_front(bounceState);
}
}
*/
F32 totalNewAmplitude = 0.0f;
//std::cout << "Beginning bounce State processing at time " << inputs.elapsedTime << std::endl;
while(!bounceStates.empty()) {
@@ -170,15 +131,6 @@ EmeraldBoobState EmeraldBoobUtils::idleUpdate(const EmeraldGlobalBoobConfig &con
}
totalNewAmplitude+=newAmplitude;
}
//std::cout << "Total new amplitude: " << totalNewAmplitude << std::endl;
/*
if(inputs.type == 0)
newState.boobGrav = localConfig.actualBoobGrav + totalNewAmplitude;
if(inputs.type == 1)
newState.boobGrav = localConfig.actualButtGrav + totalNewAmplitude;
if(inputs.type == 2)
newState.boobGrav = localConfig.actualFatGrav + totalNewAmplitude;
*/
newState.boobGrav = totalNewAmplitude;

View File

@@ -32,19 +32,6 @@ struct EmeraldGlobalBoobConfig
XYInfluence(0.3f)
{
}
bool operator==(const EmeraldGlobalBoobConfig &other) const
{
return
enabled == other.enabled &&
mass == other.mass &&
zMax == other.zMax &&
velMax == other.velMax &&
velMin == other.velMin &&
zInfluence == other.zInfluence &&
XYInfluence == other.XYInfluence &&
friction == other.friction;
}
};
std::ostream &operator<<(std::ostream &os, const EmeraldGlobalBoobConfig &v);
@@ -52,14 +39,10 @@ std::ostream &operator<<(std::ostream &os, const EmeraldGlobalBoobConfig &v);
struct EmeraldAvatarLocalBoobConfig
{
F32 actualBoobGrav;
F32 actualButtGrav;
F32 actualFatGrav;
F32 boobSize;
EmeraldAvatarLocalBoobConfig()
: actualBoobGrav(0.0f),
actualButtGrav(0.0f),
actualFatGrav(0.0f),
boobSize(0.0f)
{
}
@@ -68,8 +51,6 @@ struct EmeraldAvatarLocalBoobConfig
{
return
actualBoobGrav == other.actualBoobGrav &&
actualButtGrav == other.actualButtGrav &&
actualFatGrav == other.actualFatGrav &&
boobSize == other.boobSize;
}
@@ -88,8 +69,6 @@ struct EmeraldBoobState
F32 frameDuration;
LLVector3 chestDisplacement;
LLVector3 localChestDisplacement;
LLVector3 displacementForce;
F32 mysteryValue;
std::list<EmeraldBoobBounceState> bounceStates;
EmeraldBoobState()
@@ -99,9 +78,7 @@ struct EmeraldBoobState
elapsedTime(0.0f),
frameDuration(0.0f),
chestDisplacement(0.0f,0.0f,0.0f),
localChestDisplacement(0.0f,0.0f,0.0f),
displacementForce(0.0f,0.0f,0.0f),
mysteryValue(0.0f)
localChestDisplacement(0.0f,0.0f,0.0f)
{
}
@@ -115,8 +92,6 @@ struct EmeraldBoobState
frameDuration == other.frameDuration &&
chestDisplacement == other.chestDisplacement &&
localChestDisplacement == other.localChestDisplacement &&
displacementForce == other.displacementForce &&
mysteryValue == other.mysteryValue &&
bounceStates == other.bounceStates;
}
};
@@ -128,17 +103,11 @@ struct EmeraldBoobInputs
LLVector3 chestPosition;
LLQuaternion chestRotation;
F32 elapsedTime;
bool appearanceFlag;
bool appearanceAnimating;
S32 type;
EmeraldBoobInputs()
: chestPosition(0.0f,0.0f,0.0f),
chestRotation(0.0f,0.0f,0.0f,1.0f),
elapsedTime(0.0f),
appearanceFlag(false),
appearanceAnimating(false),
type(0)
elapsedTime(0.0f)
{
}
@@ -147,10 +116,7 @@ struct EmeraldBoobInputs
return
chestPosition == other.chestPosition &&
chestRotation == other.chestRotation &&
elapsedTime == other.elapsedTime &&
appearanceFlag == other.appearanceFlag &&
appearanceAnimating == other.appearanceAnimating &&
type == other.type;
elapsedTime == other.elapsedTime;
}
};

View File

@@ -510,8 +510,7 @@ BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
}
mCharacter->updateVisualParams();
}
if(physics_unsupported) //Only use emerald physics if avatarphysiscs is really off, or the client doesn't seem to support new physics.
((LLVOAvatar*)mCharacter)->idleUpdateBoobEffect(); //Fall back to emerald physics
((LLVOAvatar*)mCharacter)->idleUpdateBoobEffect(); //Emerald physics will fix params it altered if wearable physics are disabled.
return TRUE;
}

View File

@@ -208,6 +208,9 @@ const S32 MAX_BUBBLE_CHAT_UTTERANCES = 12;
const F32 CHAT_FADE_TIME = 8.0;
const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f;
const U32 EMERALD_BOOB_SIZE_PARAM = 105;
const U32 EMERALD_BOOB_GRAVITY_PARAM = 507;
const LLColor4 DUMMY_COLOR = LLColor4(0.5,0.5,0.5,1.0);
//Singu note: FADE and ALWAYS are swapped around from LL's source to match our preference panel.
@@ -1799,7 +1802,7 @@ void LLVOAvatar::initInstance(void)
sBoobConfig.mass = EmeraldBoobUtils::convertMass(gSavedSettings.getF32("EmeraldBoobMass"));
sBoobConfig.hardness = EmeraldBoobUtils::convertHardness(gSavedSettings.getF32("EmeraldBoobHardness"));
sBoobConfig.velMax = EmeraldBoobUtils::convertVelMax(gSavedSettings.getF32("EmeraldBoobVelMax"));
sBoobConfig.velMin = EmeraldBoobUtils::convertVelMin(gSavedSettings.getF32("EmeraldBoobVelMin"));
sBoobConfig.velMin = EmeraldBoobUtils::convertVelMin(gSavedSettings.getF32("EmeraldBoobVelMin"))*sBoobConfig.velMax;
sBoobConfig.friction = EmeraldBoobUtils::convertFriction(gSavedSettings.getF32("EmeraldBoobFriction"));
sBoobConfig.enabled = gSavedSettings.getBOOL("EmeraldBreastPhysicsToggle");
sBoobConfig.XYInfluence = gSavedSettings.getF32("EmeraldBoobXYInfluence");
@@ -3260,30 +3263,29 @@ void LLVOAvatar::idleUpdateBoobEffect()
if(mFirstSetActualBoobGravRan)
{
// should probably be moved somewhere where it is only called when boobsize changes
LLVisualParam *param;
static const LLCachedControl<bool> avatar_physics("AvatarPhysics",false);
EmeraldBoobState newBoobState;
// BOOBS
param = getVisualParam(105); //boob size
mLocalBoobConfig.boobSize = param->getCurrentWeight();
EmeraldBoobInputs boobInputs;
boobInputs.type = 0;
boobInputs.chestPosition = mChestp->getWorldPosition();
boobInputs.chestRotation = mChestp->getWorldRotation();
boobInputs.elapsedTime = mBoobBounceTimer.getElapsedTimeF32();
boobInputs.appearanceFlag = getAppearanceFlag();
if(!avatar_physics || (!isSelf() && !mSupportsPhysics))
{
mLocalBoobConfig.boobSize = getVisualParam(EMERALD_BOOB_SIZE_PARAM)->getCurrentWeight();
EmeraldBoobInputs boobInputs;
boobInputs.chestPosition = mChestp->getWorldPosition();
boobInputs.chestRotation = mChestp->getWorldRotation();
boobInputs.elapsedTime = mBoobBounceTimer.getElapsedTimeF32();
newBoobState = EmeraldBoobUtils::idleUpdate(sBoobConfig, mLocalBoobConfig, mBoobState, boobInputs);
}
EmeraldBoobState newBoobState = EmeraldBoobUtils::idleUpdate(sBoobConfig, mLocalBoobConfig, mBoobState, boobInputs);
if(mBoobState.boobGrav != newBoobState.boobGrav)
{
LLVisualParam *param;
param = getVisualParam(507);
ESex avatar_sex = getSex();
LLVisualParam *param = getVisualParam(EMERALD_BOOB_GRAVITY_PARAM);
param->stopAnimating(FALSE);
param->setWeight(llclamp(newBoobState.boobGrav+getActualBoobGrav(), -1.5f, 2.f), FALSE);
param->apply(avatar_sex);
param->apply(getSex());
updateVisualParams();
}
@@ -8354,23 +8356,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys )
{
mSupportsPhysics = true;
}
else if(param->getID() == 507 && newWeight != getActualBoobGrav())
else if(param->getID() == EMERALD_BOOB_GRAVITY_PARAM && newWeight != getActualBoobGrav())
{
llwarns << "Boob Grav SET to " << newWeight << " for " << getFullname() << llendl;
setActualBoobGrav(newWeight);
}
/*if(param->getID() == 795 && newWeight != getActualButtGrav())
{
llwarns << "Butt Grav SET to " << newWeight << " for " << getFullname() << llendl;
setActualButtGrav(newWeight);
}
if(param->getID() == 157 && newWeight != getActualFatGrav())
{
llwarns << "Fat Grav SET to " << newWeight << " for " << getFullname() << llendl;
setActualFatGrav(newWeight);
}
*/
if (is_first_appearance_message || (param->getWeight() != newWeight))
{

View File

@@ -923,6 +923,9 @@ private:
BOOL mStepOnLand;
U8 mStepMaterial;
LLVector3 mStepObjectVelocity;
public:
bool mSupportsPhysics; //Client supports v2 wearable physics. Disable emerald physics.
//--------------------------------------------------------------------
// Emerald legacy boob bounce
@@ -944,10 +947,7 @@ private:
LLFrameTimer mBoobBounceTimer;
EmeraldAvatarLocalBoobConfig mLocalBoobConfig;
EmeraldBoobState mBoobState;
public:
bool mSupportsPhysics; //Client supports v2 wearable physics. Disable emerald physics.
/** Physics
** **
*******************************************************************************/
@@ -1237,4 +1237,6 @@ private:
extern const F32 SELF_ADDITIONAL_PRI;
extern const S32 MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL;
extern const U32 EMERALD_BOOB_SIZE_PARAM; //"Breast Size"
extern const U32 EMERALD_BOOB_GRAVITY_PARAM; //"Breast_Gravity"
#endif // LL_VO_AVATAR_H

View File

@@ -657,6 +657,11 @@ BOOL LLVOAvatarSelf::setParamWeight(LLViewerVisualParam *param, F32 weight, BOOL
}
}
if(param->getID() == EMERALD_BOOB_GRAVITY_PARAM && weight != getActualBoobGrav())
{
setActualBoobGrav(weight);
}
return LLCharacter::setVisualParamWeight(param,weight,upload_bake);
}

View File

@@ -584,28 +584,6 @@ BOOL LLWearable::isDirty() const
U8 a = F32_to_U8( saved_weight, param->getMinWeight(), param->getMaxWeight() );
U8 b = F32_to_U8( current_weight, param->getMinWeight(), param->getMaxWeight() );
if(gAgentAvatarp->getAppearanceFlag() == true)
{
//boob
if(param->getID() == 507)
{
if( is_in_map(mVisualParamIndexMap, param->getID() ) )
current_weight = mVisualParamIndexMap.find(param->getID())->second->getWeight();
else
current_weight = gAgentAvatarp->getActualBoobGrav();
current_weight = llclamp( current_weight, param->getMinWeight(), param->getMaxWeight() );
b = F32_to_U8( current_weight, param->getMinWeight(), param->getMaxWeight() );
}
}
else
{
//boob
if(param->getID() == 507)
{
a = F32_to_U8( gAgentAvatarp->getActualBoobGrav(), param->getMinWeight(), param->getMaxWeight() );
}
}
if( a != b )
{
//llwarns << "param ID " << param->getID() << " was changed." << llendl;
@@ -699,10 +677,6 @@ void LLWearable::writeToAvatar()
S32 param_id = param->getID();
F32 weight = getVisualParamWeight(param_id);
//ZOMG: When switching shapes from inventory
if(param_id == 507)
gAgentAvatarp->setActualBoobGrav(weight);
gAgentAvatarp->setVisualParamWeight( param_id, weight, FALSE );
}
}
@@ -800,21 +774,6 @@ void LLWearable::copyDataFrom(const LLWearable* src)
{
S32 id = param->getID();
F32 weight = src->getVisualParamWeight(id);
//llwarns << "------------------------------" << llendl;
//llwarns << "copydatafrom" << llendl;
//llwarns << "------------------------------" << llendl;
//if(id == 507)
//{
// llwarns << "weight = " << weight << llendl;
// llwarns << "actual = " << avatar->getActualBoobGrav() << llendl;
// llwarns << "mVisualParamMap[id] = " << mVisualParamMap[id] << llendl;
//}
//pretty sure right
if(id == 507)
gAgentAvatarp->setActualBoobGrav(weight);
mSavedVisualParamMap[id] = weight;
}
}
@@ -1200,23 +1159,6 @@ void LLWearable::pullCrossWearableValues()
{
if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (param->isTweakable()) )
{
//pretty sure is right
if(param->getID() == 507)
avatar->setActualBoobGrav(param->getWeight());
//if(param->getID() == 151)
// avatar->setActualButtGrav(param->getWeight());
//if(param->getID() == 157)
// avatar->setActualFatGrav(param->getWeight());
//if(param->getID() == 507)
//{
// llwarns << "current = " << avatar->getActualBoobGrav() << llendl;
// llwarns << "param weight = " << param->getWeight() << llendl;
//}
mVisualParamMap[param->getID()] = param->getWeight();
}
}