Showing the changes to interface/src/Application.cpp (1 of 7 files). Show all
Unified · Split
| @@ -1972,6 +1972,21 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm:: · 1971 unmodified lines | ||
| 1972 | 1972 | } |
| 1973 | 1973 | node->unlock(); |
| 1974 | 1974 | } |
| 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 | + } | |
| 1975 | 1990 | } |
| 1976 | 1991 | |
| 1977 | 1992 | 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 | ||
| 3841 | 3856 | |
| 3842 | 3857 | node->unlock(); |
| 3843 | 3858 | } |
| 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 | + } | |
| 3844 | 3865 | } |
| 3845 | 3866 | |
| 3846 | 3867 | // Render my own Avatar |
| @@ -4286,8 +4307,17 @@ void Application::nodeKilled(Node* node) { · 439 unmodified lines | ||
| 4286 | 4307 | _voxelServerSceneStats.erase(nodeUUID); |
| 4287 | 4308 | } |
| 4288 | 4309 | _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); | |
| 4291 | 4321 | } |
| 4292 | 4322 | } |
| 4293 | 4323 | |