History

dry up code

ZappoMan committed 13 years ago

Commit eb8c5651 parent 9507cd82 files · +20 −17Browse files

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

Unified · Split

interface/src/Application.cpp+17−16
@@ -1864,20 +1864,13 @@ void Application::setListenModeSingleSource() { · 1863 unmodified lines
18641864 _audio.setListenMode(AudioRingBuffer::SELECTED_SOURCES);
18651865 _audio.clearListenSources();
18661866
1867− NodeList* nodeList = NodeList::getInstance();
1868− for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
1869− if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
1870− Avatar* avatar = (Avatar *) node->getLinkedData();
1871− glm::vec3 headPosition = avatar->getHead().getPosition();
1872− glm::vec3 mouseRayOrigin = _myAvatar.getMouseRayOrigin();
1873− glm::vec3 mouseRayDirection = _myAvatar.getMouseRayDirection();
1874− const float HEAD_SPHERE_RADIUS = 0.07;
1867+ glm::vec3 mouseRayOrigin = _myAvatar.getMouseRayOrigin();
1868+ glm::vec3 mouseRayDirection = _myAvatar.getMouseRayDirection();
1869+ glm::vec3 eyePositionIgnored;
1870+ uint16_t nodeID;
18751871
1876− if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {
1877− int sourceID = avatar->getOwningNode()->getNodeID();
1878− _audio.addListenSource(sourceID);
1879− }
1880− }
1872+ if (isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePositionIgnored, nodeID)) {
1873+ _audio.addListenSource(nodeID);
18811874 }
18821875 }
18831876
@@ -1970,7 +1963,10 @@ const float MAX_AVATAR_EDIT_VELOCITY = 1.0f; · 86 unmodified lines
19701963 const float MAX_VOXEL_EDIT_DISTANCE = 20.0f;
19711964 const float HEAD_SPHERE_RADIUS = 0.07;
19721965
1973−bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, glm::vec3& eyePosition) {
1966+
1967+bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection,
1968+ glm::vec3& eyePosition, uint16_t& nodeID) {
1969+
19741970 NodeList* nodeList = NodeList::getInstance();
19751971 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
19761972 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
@@ -1979,6 +1975,7 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 2 unmodified lines
19791975 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {
19801976 eyePosition = avatar->getHead().getEyeLevelPosition();
19811977 _lookatOtherPosition = headPosition;
1978+ nodeID = avatar->getOwningNode()->getNodeID();
19821979 return true;
19831980 }
19841981 }
@@ -2022,7 +2019,9 @@ void Application::update(float deltaTime) { · 37 unmodified lines
20222019
20232020 // Set where I am looking based on my mouse ray (so that other people can see)
20242021 glm::vec3 eyePosition;
2025− if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition)) {
2022+ uint16_t ignored;
2023+ _isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, ignored);
2024+ if (_isLookingAtOtherAvatar) {
20262025 // If the mouse is over another avatar's head...
20272026 glm::vec3 myLookAtFromMouse(eyePosition);
20282027 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
@@ -2284,7 +2283,9 @@ void Application::updateAvatar(float deltaTime) { · 255 unmodified lines
22842283 _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);
22852284
22862285 glm::vec3 eyePosition;
2287− if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition)) {
2286+ uint16_t ignored;
2287+ _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition, ignored);
2288+ if (_isLookingAtOtherAvatar) {
22882289 glm::vec3 myLookAtFromMouse(eyePosition);
22892290 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
22902291 }

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