mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:09:52 +02:00
fix for avatar scale bug, closes #1506
This commit is contained in:
parent
0e25c85eef
commit
3f2c6504a6
4 changed files with 11 additions and 11 deletions
|
@ -2128,8 +2128,8 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::
|
||||||
Avatar* avatar = *fade;
|
Avatar* avatar = *fade;
|
||||||
const float SHRINK_RATE = 0.9f;
|
const float SHRINK_RATE = 0.9f;
|
||||||
avatar->setNewScale(avatar->getNewScale() * SHRINK_RATE);
|
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;
|
delete avatar;
|
||||||
_avatarFades.erase(fade--);
|
_avatarFades.erase(fade--);
|
||||||
|
|
||||||
|
|
|
@ -439,14 +439,14 @@ void Avatar::goHome() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::increaseSize() {
|
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);
|
_newScale *= (1.f + SCALING_RATIO);
|
||||||
qDebug("Changed scale to %f\n", _newScale);
|
qDebug("Changed scale to %f\n", _newScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Avatar::decreaseSize() {
|
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);
|
_newScale *= (1.f - SCALING_RATIO);
|
||||||
qDebug("Changed scale to %f\n", _newScale);
|
qDebug("Changed scale to %f\n", _newScale);
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,10 +297,10 @@ int AvatarData::parseData(unsigned char* sourceBuffer, int numBytes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AvatarData::setNewScale(float newScale) {
|
void AvatarData::setNewScale(float newScale) {
|
||||||
if (newScale > MAX_SCALE) {
|
if (newScale > MAX_AVATAR_SCALE) {
|
||||||
newScale = MAX_SCALE;
|
newScale = MAX_AVATAR_SCALE;
|
||||||
} else if (newScale < MIN_SCALE) {
|
} else if (newScale < MIN_AVATAR_SCALE) {
|
||||||
newScale = MIN_SCALE;
|
newScale = MIN_AVATAR_SCALE;
|
||||||
}
|
}
|
||||||
_newScale = newScale;
|
_newScale = newScale;
|
||||||
qDebug() << "Changed scale to " << _newScale << "\n";
|
qDebug() << "Changed scale to " << _newScale << "\n";
|
||||||
|
|
|
@ -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_FACESHIFT_CONNECTED = 4; // 5th bit
|
||||||
const int IS_CHAT_CIRCLING_ENABLED = 5;
|
const int IS_CHAT_CIRCLING_ENABLED = 5;
|
||||||
|
|
||||||
static const float MAX_SCALE = 1000.f;
|
static const float MAX_AVATAR_SCALE = 1000.f;
|
||||||
static const float MIN_SCALE = .005f;
|
static const float MIN_AVATAR_SCALE = .005f;
|
||||||
|
|
||||||
const float MAX_AUDIO_LOUDNESS = 1000.0; // close enough for mouth animation
|
const float MAX_AUDIO_LOUDNESS = 1000.0; // close enough for mouth animation
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ public:
|
||||||
|
|
||||||
// Scale
|
// Scale
|
||||||
float getNewScale() const { return _newScale; }
|
float getNewScale() const { return _newScale; }
|
||||||
void setNewScale(float);
|
void setNewScale(float newScale);
|
||||||
|
|
||||||
// Hand State
|
// Hand State
|
||||||
void setHandState(char s) { _handState = s; }
|
void setHandState(char s) { _handState = s; }
|
||||||
|
|
Loading…
Reference in a new issue