summaryrefslogtreecommitdiff
path: root/indra/newview/llphysicsmotion.cpp
diff options
context:
space:
mode:
authorWilliam Todd Stinson <stinson@lindenlab.com>2012-09-10 10:37:02 -0700
committerWilliam Todd Stinson <stinson@lindenlab.com>2012-09-10 10:37:02 -0700
commita766e26db46c7c054bae1021470dbe365f2a3cb3 (patch)
tree93ffd22d902bef8d44e81b6989dcb2966beba2fc /indra/newview/llphysicsmotion.cpp
parentdab915c1d2a2d08363944de8ac4362fbe162bea0 (diff)
Backing out the changes contributing to DRTVWR-167 and DRTVWR-179 from the repository.
Diffstat (limited to 'indra/newview/llphysicsmotion.cpp')
-rw-r--r--indra/newview/llphysicsmotion.cpp77
1 files changed, 15 insertions, 62 deletions
diff --git a/indra/newview/llphysicsmotion.cpp b/indra/newview/llphysicsmotion.cpp
index cb6989c9dd..e124916c48 100644
--- a/indra/newview/llphysicsmotion.cpp
+++ b/indra/newview/llphysicsmotion.cpp
@@ -67,19 +67,6 @@ inline F64 llsgn(const F64 a)
class LLPhysicsMotion
{
public:
- typedef enum
- {
- SMOOTHING = 0,
- MASS,
- GRAVITY,
- SPRING,
- GAIN,
- DAMPING,
- DRAG,
- MAX_EFFECT,
- NUM_PARAMS
- } eParamName;
-
/*
param_driver_name: The param that controls the params that are being affected by the physics.
joint_name: The joint that the body part is attached to. The joint is
@@ -111,11 +98,6 @@ public:
mPositionLastUpdate_local(0)
{
mJointState = new LLJointState;
-
- for (U32 i = 0; i < NUM_PARAMS; ++i)
- {
- mParamCache[i] = NULL;
- }
}
BOOL initialize();
@@ -129,43 +111,16 @@ public:
return mJointState;
}
protected:
-
- F32 getParamValue(eParamName param)
- {
- static std::string controller_key[] =
- {
- "Smoothing",
- "Mass",
- "Gravity",
- "Spring",
- "Gain",
- "Damping",
- "Drag",
- "MaxEffect"
- };
-
- if (!mParamCache[param])
- {
- const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key[param]);
+ F32 getParamValue(const std::string& controller_key)
+ {
+ const controller_map_t::const_iterator& entry = mParamControllers.find(controller_key);
if (entry == mParamControllers.end())
{
- return sDefaultController[controller_key[param]];
+ return sDefaultController[controller_key];
}
const std::string& param_name = (*entry).second.c_str();
- mParamCache[param] = mCharacter->getVisualParam(param_name.c_str());
- }
-
- if (mParamCache[param])
- {
- return mParamCache[param]->getWeight();
- }
- else
- {
- return sDefaultController[controller_key[param]];
- }
- }
-
-
+ return mCharacter->getVisualParamWeight(param_name.c_str());
+ }
void setParamValue(LLViewerVisualParam *param,
const F32 new_value_local,
F32 behavior_maxeffect);
@@ -195,8 +150,6 @@ private:
F32 mLastTime;
- LLVisualParam* mParamCache[NUM_PARAMS];
-
static default_controller_map_t sDefaultController;
};
@@ -474,6 +427,7 @@ BOOL LLPhysicsMotionController::onUpdate(F32 time, U8* joint_mask)
return TRUE;
}
+
// Return TRUE if character has to update visual params.
BOOL LLPhysicsMotion::onUpdate(F32 time)
{
@@ -517,16 +471,15 @@ BOOL LLPhysicsMotion::onUpdate(F32 time)
LLJoint *joint = mJointState->getJoint();
- const F32 behavior_mass = getParamValue(MASS);
- const F32 behavior_gravity = getParamValue(GRAVITY);
- const F32 behavior_spring = getParamValue(SPRING);
- const F32 behavior_gain = getParamValue(GAIN);
- const F32 behavior_damping = getParamValue(DAMPING);
- const F32 behavior_drag = getParamValue(DRAG);
- F32 behavior_maxeffect = getParamValue(MAX_EFFECT);
-
- const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts.
+ const F32 behavior_mass = getParamValue("Mass");
+ const F32 behavior_gravity = getParamValue("Gravity");
+ const F32 behavior_spring = getParamValue("Spring");
+ const F32 behavior_gain = getParamValue("Gain");
+ const F32 behavior_damping = getParamValue("Damping");
+ const F32 behavior_drag = getParamValue("Drag");
+ const BOOL physics_test = FALSE; // Enable this to simulate bouncing on all parts.
+ F32 behavior_maxeffect = getParamValue("MaxEffect");
if (physics_test)
behavior_maxeffect = 1.0f;