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
1864 _audio.setListenMode(AudioRingBuffer::SELECTED_SOURCES);1864 _audio.setListenMode(AudioRingBuffer::SELECTED_SOURCES);
1865 _audio.clearListenSources();1865 _audio.clearListenSources();
1866 1866
1867 NodeList* nodeList = NodeList::getInstance();1867 glm::vec3 mouseRayOrigin = _myAvatar.getMouseRayOrigin();
1868 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {1868 glm::vec3 mouseRayDirection = _myAvatar.getMouseRayDirection();
1869 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {1869 glm::vec3 eyePositionIgnored;
1870 Avatar* avatar = (Avatar *) node->getLinkedData();1870 uint16_t nodeID;
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;
1875 1871
1876 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {1872 if (isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePositionIgnored, nodeID)) {
1877 int sourceID = avatar->getOwningNode()->getNodeID();1873 _audio.addListenSource(nodeID);
1878 _audio.addListenSource(sourceID);
1879 }
1880 }
1881 }1874 }
1882}1875}
1883 1876
@@ -1970,7 +1963,10 @@ const float MAX_AVATAR_EDIT_VELOCITY = 1.0f; · 86 unmodified lines
1970const float MAX_VOXEL_EDIT_DISTANCE = 20.0f;1963const float MAX_VOXEL_EDIT_DISTANCE = 20.0f;
1971const float HEAD_SPHERE_RADIUS = 0.07;1964const float HEAD_SPHERE_RADIUS = 0.07;
1972 1965
1973bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, glm::vec3& eyePosition) {1966
1967bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection,
1968 glm::vec3& eyePosition, uint16_t& nodeID) {
1969
1974 NodeList* nodeList = NodeList::getInstance();1970 NodeList* nodeList = NodeList::getInstance();
1975 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {1971 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
1976 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {1972 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
1979 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {1975 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {
1980 eyePosition = avatar->getHead().getEyeLevelPosition();1976 eyePosition = avatar->getHead().getEyeLevelPosition();
1981 _lookatOtherPosition = headPosition;1977 _lookatOtherPosition = headPosition;
1978 nodeID = avatar->getOwningNode()->getNodeID();
1982 return true;1979 return true;
1983 }1980 }
1984 }1981 }
@@ -2022,7 +2019,9 @@ void Application::update(float deltaTime) { · 37 unmodified lines
2022 2019
2023 // Set where I am looking based on my mouse ray (so that other people can see)2020 // Set where I am looking based on my mouse ray (so that other people can see)
2024 glm::vec3 eyePosition;2021 glm::vec3 eyePosition;
2025 if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition)) {2022 uint16_t ignored;
2023 _isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, ignored);
2024 if (_isLookingAtOtherAvatar) {
2026 // If the mouse is over another avatar's head...2025 // If the mouse is over another avatar's head...
2027 glm::vec3 myLookAtFromMouse(eyePosition);2026 glm::vec3 myLookAtFromMouse(eyePosition);
2028 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);2027 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
@@ -2284,7 +2283,9 @@ void Application::updateAvatar(float deltaTime) { · 255 unmodified lines
2284 _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);2283 _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);
2285 2284
2286 glm::vec3 eyePosition;2285 glm::vec3 eyePosition;
2287 if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition)) {2286 uint16_t ignored;
2287 _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition, ignored);
2288 if (_isLookingAtOtherAvatar) {
2288 glm::vec3 myLookAtFromMouse(eyePosition);2289 glm::vec3 myLookAtFromMouse(eyePosition);
2289 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);2290 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
2290 }2291 }

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