History

Glow/shrink avatars when killed, send kill message when we move between domains, locations, etc.

Andrzej Kapolka committed 12 years ago

Commit 083800d1 parent 092515e7 files · +47 −9Browse files

Showing the changes to interface/src/Application.cpp (1 of 7 files). Show all

Unified · Split

interface/src/Application.cpp+32−2
@@ -1972,6 +1972,21 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm:: · 1971 unmodified lines
19721972 }
19731973 node->unlock();
19741974 }
1975+
1976+ // simulate avatar fades
1977+ for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) {
1978+ Avatar* avatar = *fade;
1979+ const float SHRINK_RATE = 0.9f;
1980+ avatar->setNewScale(avatar->getNewScale() * SHRINK_RATE);
1981+ const float MINIMUM_SCALE = 0.001f;
1982+ if (avatar->getNewScale() < MINIMUM_SCALE) {
1983+ delete avatar;
1984+ _avatarFades.erase(fade--);
1985+
1986+ } else {
1987+ avatar->simulate(deltaTime, NULL);
1988+ }
1989+ }
19751990 }
19761991
19771992 void Application::updateMouseRay(float deltaTime, glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection) {
@@ -3841,6 +3856,12 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) { · 1863 unmodified lines
38413856
38423857 node->unlock();
38433858 }
3859+
3860+ // render avatar fades
3861+ Glower glower;
3862+ for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) {
3863+ (*fade)->render(false, Menu::getInstance()->isOptionChecked(MenuOption::AvatarAsBalls));
3864+ }
38443865 }
38453866
38463867 // Render my own Avatar
@@ -4286,8 +4307,17 @@ void Application::nodeKilled(Node* node) { · 439 unmodified lines
42864307 _voxelServerSceneStats.erase(nodeUUID);
42874308 }
42884309 _voxelSceneStatsLock.unlock();
4289− } else if (node->getLinkedData() == _lookatTargetAvatar) {
4290− _lookatTargetAvatar = NULL;
4310+
4311+ } else if (node->getType() == NODE_TYPE_AGENT) {
4312+ Avatar* avatar = static_cast<Avatar*>(node->getLinkedData());
4313+ if (avatar == _lookatTargetAvatar) {
4314+ _lookatTargetAvatar = NULL;
4315+ }
4316+
4317+ // take over the avatar in order to fade it out
4318+ node->setLinkedData(NULL);
4319+
4320+ _avatarFades.push_back(avatar);
42914321 }
42924322 }
42934323

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t