Glow/shrink avatars when killed, send kill message when we move between

domains, locations, etc.
This commit is contained in:
Andrzej Kapolka 2013-11-22 16:23:40 -08:00
parent 092515e199
commit 083800dc59
7 changed files with 47 additions and 9 deletions

View file

@ -1972,6 +1972,21 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::
}
node->unlock();
}
// simulate avatar fades
for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) {
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) {
delete avatar;
_avatarFades.erase(fade--);
} else {
avatar->simulate(deltaTime, NULL);
}
}
}
void Application::updateMouseRay(float deltaTime, glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection) {
@ -3841,6 +3856,12 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) {
node->unlock();
}
// render avatar fades
Glower glower;
for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) {
(*fade)->render(false, Menu::getInstance()->isOptionChecked(MenuOption::AvatarAsBalls));
}
}
// Render my own Avatar
@ -4286,8 +4307,17 @@ void Application::nodeKilled(Node* node) {
_voxelServerSceneStats.erase(nodeUUID);
}
_voxelSceneStatsLock.unlock();
} else if (node->getLinkedData() == _lookatTargetAvatar) {
_lookatTargetAvatar = NULL;
} else if (node->getType() == NODE_TYPE_AGENT) {
Avatar* avatar = static_cast<Avatar*>(node->getLinkedData());
if (avatar == _lookatTargetAvatar) {
_lookatTargetAvatar = NULL;
}
// take over the avatar in order to fade it out
node->setLinkedData(NULL);
_avatarFades.push_back(avatar);
}
}

View file

@ -471,6 +471,7 @@ private:
QReadWriteLock _voxelSceneStatsLock;
std::vector<VoxelFade> _voxelFades;
std::vector<Avatar*> _avatarFades;
};
#endif /* defined(__interface__Application__) */

View file

@ -173,6 +173,9 @@ void DataServerClient::processSendFromDataServer(unsigned char* packetData, int
if (coordinateItems.size() == 3) {
// send a node kill request, indicating to other clients that they should play the "disappeared" effect
NodeList::getInstance()->sendKillNode(&NODE_TYPE_AVATAR_MIXER, 1);
qDebug() << "Changing domain to" << valueList[i].toLocal8Bit().constData() <<
"and position to" << valueList[i + 1].toLocal8Bit().constData() <<
"to go to" << userString << "\n";

View file

@ -914,6 +914,9 @@ void Menu::goToDomain() {
newHostname = domainDialog.textValue();
}
// send a node kill request, indicating to other clients that they should play the "disappeared" effect
NodeList::getInstance()->sendKillNode(&NODE_TYPE_AVATAR_MIXER, 1);
// give our nodeList the new domain-server hostname
NodeList::getInstance()->setDomainHostname(domainDialog.textValue());
}
@ -953,8 +956,11 @@ void Menu::goToLocation() {
glm::vec3 newAvatarPos(x, y, z);
if (newAvatarPos != avatarPos) {
// send a node kill request, indicating to other clients that they should play the "disappeared" effect
NodeList::getInstance()->sendKillNode(&NODE_TYPE_AVATAR_MIXER, 1);
qDebug("Going To Location: %f, %f, %f...\n", x, y, z);
myAvatar->setPosition(newAvatarPos);
myAvatar->setPosition(newAvatarPos);
}
}
}

View file

@ -1271,7 +1271,3 @@ void MyAvatar::setOrientation(const glm::quat& orientation) {
_bodyYaw = eulerAngles.y;
_bodyRoll = eulerAngles.z;
}
void MyAvatar::setNewScale(const float scale) {
_newScale = scale;
}

View file

@ -30,12 +30,10 @@ public:
void setLeanScale(float scale) { _leanScale = scale; }
void setGravity(glm::vec3 gravity);
void setOrientation(const glm::quat& orientation);
void setNewScale(const float scale);
void setWantCollisionsOn(bool wantCollisionsOn) { _isCollisionsOn = wantCollisionsOn; }
void setMoveTarget(const glm::vec3 moveTarget);
// getters
float getNewScale() const { return _newScale; }
float getSpeed() const { return _speed; }
AvatarMode getMode() const { return _mode; }
float getLeanScale() const { return _leanScale; }

View file

@ -75,6 +75,10 @@ public:
float getBodyRoll() const { return _bodyRoll; }
void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; }
// Scale
float getNewScale() const { return _newScale; }
void setNewScale(float newScale) { _newScale = newScale; }
// Hand State
void setHandState(char s) { _handState = s; }
char getHandState() const { return _handState; }