cleanup: remove unused Avatar::_mode

The mode, if it is required, should probably eventually live in
AvatarDAta since it will be determined by whatever engine is running the
avatar (script or interface) and then broadcast to the rest of the
world.  When we need it we'll add it back in the right place.
This commit is contained in:
Andrew Meadows 2014-04-23 11:48:42 -07:00
parent f46a5dc966
commit 359c14e319
4 changed files with 3 additions and 29 deletions

View file

@ -47,7 +47,6 @@ Avatar::Avatar() :
AvatarData(),
_skeletonModel(this),
_bodyYawDelta(0.0f),
_mode(AVATAR_MODE_STANDING),
_velocity(0.0f, 0.0f, 0.0f),
_thrust(0.0f, 0.0f, 0.0f),
_leanScale(0.5f),
@ -138,19 +137,11 @@ void Avatar::simulate(float deltaTime) {
head->simulate(deltaTime, false, _shouldRenderBillboard);
}
// use speed and angular velocity to determine walking vs. standing
float speed = glm::length(_velocity);
if (speed + fabs(_bodyYawDelta) > 0.2) {
_mode = AVATAR_MODE_WALKING;
} else {
_mode = AVATAR_MODE_INTERACTING;
}
// update position by velocity, and subtract the change added earlier for gravity
_position += _velocity * deltaTime;
// Zero thrust out now that we've added it to velocity in this frame
_thrust = glm::vec3(0, 0, 0);
_thrust = glm::vec3(0.0f);
// update animation for display name fade in/out
if ( _displayNameTargetAlpha != _displayNameAlpha) {
@ -166,7 +157,7 @@ void Avatar::simulate(float deltaTime) {
// Fading in
_displayNameAlpha = 1 - (1 - _displayNameAlpha) * coef;
}
_displayNameAlpha = abs(_displayNameAlpha - _displayNameTargetAlpha) < 0.01? _displayNameTargetAlpha : _displayNameAlpha;
_displayNameAlpha = abs(_displayNameAlpha - _displayNameTargetAlpha) < 0.01f ? _displayNameTargetAlpha : _displayNameAlpha;
}
}

View file

@ -46,13 +46,6 @@ enum DriveKeys {
MAX_DRIVE_KEYS
};
enum AvatarMode {
AVATAR_MODE_STANDING = 0,
AVATAR_MODE_WALKING,
AVATAR_MODE_INTERACTING,
NUM_AVATAR_MODES
};
enum ScreenTintLayer {
SCREEN_TINT_BEFORE_LANDSCAPE = 0,
SCREEN_TINT_BEFORE_AVATARS,
@ -164,7 +157,6 @@ signals:
protected:
SkeletonModel _skeletonModel;
float _bodyYawDelta;
AvatarMode _mode;
glm::vec3 _velocity;
glm::vec3 _thrust;
float _leanScale;

View file

@ -269,17 +269,9 @@ void MyAvatar::simulate(float deltaTime) {
// update the euler angles
setOrientation(orientation);
const float WALKING_SPEED_THRESHOLD = 0.2f;
// use speed and angular velocity to determine walking vs. standing
float speed = glm::length(_velocity);
if (speed + fabs(_bodyYawDelta) > WALKING_SPEED_THRESHOLD) {
_mode = AVATAR_MODE_WALKING;
} else {
_mode = AVATAR_MODE_INTERACTING;
}
// update moving flag based on speed
const float MOVING_SPEED_THRESHOLD = 0.01f;
float speed = glm::length(_velocity);
_moving = speed > MOVING_SPEED_THRESHOLD;
// If a move target is set, update position explicitly

View file

@ -54,7 +54,6 @@ public:
void setShouldRenderLocally(bool shouldRender) { _shouldRender = shouldRender; }
// getters
AvatarMode getMode() const { return _mode; }
float getLeanScale() const { return _leanScale; }
float getElapsedTimeStopped() const { return _elapsedTimeStopped; }
float getElapsedTimeMoving() const { return _elapsedTimeMoving; }