fix for avatar scale bug, closes #1506

This commit is contained in:
Stephen Birarda 2014-01-13 12:27:47 -08:00
parent 0e25c85eef
commit 3f2c6504a6
4 changed files with 11 additions and 11 deletions

View file

@ -2128,8 +2128,8 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::
Avatar* avatar = *fade;
const float SHRINK_RATE = 0.9f;
avatar->setNewScale(avatar->getNewScale() * SHRINK_RATE);
const float MINIMUM_SCALE = 0.001f;
if (avatar->getNewScale() < MINIMUM_SCALE) {
if (avatar->getNewScale() < MIN_AVATAR_SCALE) {
delete avatar;
_avatarFades.erase(fade--);

View file

@ -439,14 +439,14 @@ void Avatar::goHome() {
}
void Avatar::increaseSize() {
if ((1.f + SCALING_RATIO) * _newScale < MAX_SCALE) {
if ((1.f + SCALING_RATIO) * _newScale < MAX_AVATAR_SCALE) {
_newScale *= (1.f + SCALING_RATIO);
qDebug("Changed scale to %f\n", _newScale);
}
}
void Avatar::decreaseSize() {
if (MIN_SCALE < (1.f - SCALING_RATIO) * _newScale) {
if (MIN_AVATAR_SCALE < (1.f - SCALING_RATIO) * _newScale) {
_newScale *= (1.f - SCALING_RATIO);
qDebug("Changed scale to %f\n", _newScale);
}

View file

@ -297,10 +297,10 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
}
void AvatarData::setNewScale(float newScale) {
if (newScale > MAX_SCALE) {
newScale = MAX_SCALE;
} else if (newScale < MIN_SCALE) {
newScale = MIN_SCALE;
if (newScale > MAX_AVATAR_SCALE) {
newScale = MAX_AVATAR_SCALE;
} else if (newScale < MIN_AVATAR_SCALE) {
newScale = MIN_AVATAR_SCALE;
}
_newScale = newScale;
qDebug() << "Changed scale to " << _newScale << "\n";

View file

@ -32,8 +32,8 @@ const int HAND_STATE_START_BIT = 2; // 3rd and 4th bits
const int IS_FACESHIFT_CONNECTED = 4; // 5th bit
const int IS_CHAT_CIRCLING_ENABLED = 5;
static const float MAX_SCALE = 1000.f;
static const float MIN_SCALE = .005f;
static const float MAX_AVATAR_SCALE = 1000.f;
static const float MIN_AVATAR_SCALE = .005f;
const float MAX_AUDIO_LOUDNESS = 1000.0; // close enough for mouth animation
@ -83,7 +83,7 @@ public:
// Scale
float getNewScale() const { return _newScale; }
void setNewScale(float);
void setNewScale(float newScale);
// Hand State
void setHandState(char s) { _handState = s; }