History

merge branch qt5 with upstream/master

Stephen Birarda committed 13 years ago

Commit 08b94d72 parents 5f26bbd 31a1e3e12 files · +350 −143Browse files

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

Unified · Split

interface/src/Application.cpp+51−7
@@ -203,6 +203,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 202 unmodified lines
203 _mouseVoxelScale(1.0f / 1024.0f),203 _mouseVoxelScale(1.0f / 1024.0f),
204 _justEditedVoxel(false),204 _justEditedVoxel(false),
205 _isLookingAtOtherAvatar(false),205 _isLookingAtOtherAvatar(false),
206 _lookatIndicatorScale(1.0f),
206 _paintOn(false),207 _paintOn(false),
207 _dominantColor(0),208 _dominantColor(0),
208 _perfStatsOn(false),209 _perfStatsOn(false),
@@ -1854,6 +1855,11 @@ void Application::initMenu() { · 1645 unmodified lines
1854 (_simulateLeapHand = debugMenu->addAction("Simulate Leap Hand"))->setCheckable(true);1855 (_simulateLeapHand = debugMenu->addAction("Simulate Leap Hand"))->setCheckable(true);
1855 (_testRaveGlove = debugMenu->addAction("Test RaveGlove"))->setCheckable(true);1856 (_testRaveGlove = debugMenu->addAction("Test RaveGlove"))->setCheckable(true);
1856 1857
1858 QMenu* audioDebugMenu = debugMenu->addMenu("Audio Debugging Tools");
1859 audioDebugMenu->addAction("Listen Mode Normal", this, SLOT(setListenModeNormal()), Qt::CTRL | Qt::Key_1);
1860 audioDebugMenu->addAction("Listen Mode Point/Radius", this, SLOT(setListenModePoint()), Qt::CTRL | Qt::Key_2);
1861 audioDebugMenu->addAction("Listen Mode Single Source", this, SLOT(setListenModeSingleSource()), Qt::CTRL | Qt::Key_3);
1862
1857 QMenu* settingsMenu = menuBar->addMenu("Settings");1863 QMenu* settingsMenu = menuBar->addMenu("Settings");
1858 (_settingsAutosave = settingsMenu->addAction("Autosave"))->setCheckable(true);1864 (_settingsAutosave = settingsMenu->addAction("Autosave"))->setCheckable(true);
1859 _settingsAutosave->setChecked(true);1865 _settingsAutosave->setChecked(true);
@@ -1865,6 +1871,30 @@ void Application::initMenu() { · 5 unmodified lines
1865 _networkAccessManager = new QNetworkAccessManager(this);1871 _networkAccessManager = new QNetworkAccessManager(this);
1866}1872}
1867 1873
1874void Application::setListenModeNormal() {
1875 _audio.setListenMode(AudioRingBuffer::NORMAL);
1876}
1877
1878void Application::setListenModePoint() {
1879 _audio.setListenMode(AudioRingBuffer::OMNI_DIRECTIONAL_POINT);
1880 _audio.setListenRadius(1.0);
1881}
1882
1883void Application::setListenModeSingleSource() {
1884 _audio.setListenMode(AudioRingBuffer::SELECTED_SOURCES);
1885 _audio.clearListenSources();
1886
1887 glm::vec3 mouseRayOrigin = _myAvatar.getMouseRayOrigin();
1888 glm::vec3 mouseRayDirection = _myAvatar.getMouseRayDirection();
1889 glm::vec3 eyePositionIgnored;
1890 uint16_t nodeID;
1891
1892 if (isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePositionIgnored, nodeID)) {
1893 _audio.addListenSource(nodeID);
1894 }
1895}
1896
1897
1868void Application::updateFrustumRenderModeAction() {1898void Application::updateFrustumRenderModeAction() {
1869 switch (_frustumDrawingMode) {1899 switch (_frustumDrawingMode) {
1870 default:1900 default:
@@ -1953,7 +1983,13 @@ const float MAX_AVATAR_EDIT_VELOCITY = 1.0f; · 82 unmodified lines
1953const float MAX_VOXEL_EDIT_DISTANCE = 20.0f;1983const float MAX_VOXEL_EDIT_DISTANCE = 20.0f;
1954const float HEAD_SPHERE_RADIUS = 0.07;1984const float HEAD_SPHERE_RADIUS = 0.07;
1955 1985
1956bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, glm::vec3& eyePosition) {1986
1987static uint16_t DEFAULT_NODE_ID_REF = 1;
1988
1989
1990bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection,
1991 glm::vec3& eyePosition, uint16_t& nodeID = DEFAULT_NODE_ID_REF) {
1992
1957 NodeList* nodeList = NodeList::getInstance();1993 NodeList* nodeList = NodeList::getInstance();
1958 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {1994 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
1959 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {1995 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
@@ -1961,7 +1997,9 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 1 unmodified line
1961 glm::vec3 headPosition = avatar->getHead().getPosition();1997 glm::vec3 headPosition = avatar->getHead().getPosition();
1962 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {1998 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {
1963 eyePosition = avatar->getHead().getEyeLevelPosition();1999 eyePosition = avatar->getHead().getEyeLevelPosition();
2000 _lookatIndicatorScale = avatar->getScale();
1964 _lookatOtherPosition = headPosition;2001 _lookatOtherPosition = headPosition;
2002 nodeID = avatar->getOwningNode()->getNodeID();
1965 return true;2003 return true;
1966 }2004 }
1967 }2005 }
@@ -1971,11 +2009,13 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 3 unmodified lines
1971 2009
1972void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) {2010void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) {
1973 2011
1974 const float DISTANCE_FROM_HEAD_SPHERE = 0.1f;2012 const float DISTANCE_FROM_HEAD_SPHERE = 0.1f * _lookatIndicatorScale;
2013 const float INDICATOR_RADIUS = 0.1f * _lookatIndicatorScale;
1975 const float YELLOW[] = { 1.0f, 1.0f, 0.0f };2014 const float YELLOW[] = { 1.0f, 1.0f, 0.0f };
2015 const int NUM_SEGMENTS = 30;
1976 glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z);2016 glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z);
1977 glColor3f(YELLOW[0], YELLOW[1], YELLOW[2]);2017 glColor3f(YELLOW[0], YELLOW[1], YELLOW[2]);
1978 renderCircle(haloOrigin, 0.1f, glm::vec3(0.0f, 1.0f, 0.0f), 30);2018 renderCircle(haloOrigin, INDICATOR_RADIUS, IDENTITY_UP, NUM_SEGMENTS);
1979}2019}
1980 2020
1981void Application::update(float deltaTime) {2021void Application::update(float deltaTime) {
@@ -2005,7 +2045,9 @@ void Application::update(float deltaTime) { · 23 unmodified lines
2005 2045
2006 // Set where I am looking based on my mouse ray (so that other people can see)2046 // Set where I am looking based on my mouse ray (so that other people can see)
2007 glm::vec3 eyePosition;2047 glm::vec3 eyePosition;
2008 if ((_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition))) {2048
2049 _isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition);
2050 if (_isLookingAtOtherAvatar) {
2009 // If the mouse is over another avatar's head...2051 // If the mouse is over another avatar's head...
2010 glm::vec3 myLookAtFromMouse(eyePosition);2052 glm::vec3 myLookAtFromMouse(eyePosition);
2011 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);2053 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
@@ -2022,7 +2064,7 @@ void Application::update(float deltaTime) { · 10 unmodified lines
2022 glm::vec3 front = orientation * IDENTITY_FRONT;2064 glm::vec3 front = orientation * IDENTITY_FRONT;
2023 glm::vec3 up = orientation * IDENTITY_UP;2065 glm::vec3 up = orientation * IDENTITY_UP;
2024 glm::vec3 towardVoxel = getMouseVoxelWorldCoordinates(_mouseVoxelDragging)2066 glm::vec3 towardVoxel = getMouseVoxelWorldCoordinates(_mouseVoxelDragging)
2025 - _myAvatar.getCameraPosition(); // is this an error? getCameraPosition dne2067 - _myAvatar.getCameraPosition();
2026 towardVoxel = front * glm::length(towardVoxel);2068 towardVoxel = front * glm::length(towardVoxel);
2027 glm::vec3 lateralToVoxel = glm::cross(up, glm::normalize(towardVoxel)) * glm::length(towardVoxel);2069 glm::vec3 lateralToVoxel = glm::cross(up, glm::normalize(towardVoxel)) * glm::length(towardVoxel);
2028 _voxelThrust = glm::vec3(0, 0, 0);2070 _voxelThrust = glm::vec3(0, 0, 0);
@@ -2270,7 +2312,9 @@ void Application::updateAvatar(float deltaTime) { · 241 unmodified lines
2270 _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);2312 _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);
2271 2313
2272 glm::vec3 eyePosition;2314 glm::vec3 eyePosition;
2273 if ((_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition))) {2315
2316 _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition);
2317 if (_isLookingAtOtherAvatar) {
2274 glm::vec3 myLookAtFromMouse(eyePosition);2318 glm::vec3 myLookAtFromMouse(eyePosition);
2275 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);2319 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
2276 }2320 }
@@ -2298,7 +2342,7 @@ void Application::updateAvatar(float deltaTime) { · 21 unmodified lines
2298 // actually need to calculate the view frustum planes to send these details 2342 // actually need to calculate the view frustum planes to send these details
2299 // to the server.2343 // to the server.
2300 loadViewFrustum(_myCamera, _viewFrustum);2344 loadViewFrustum(_myCamera, _viewFrustum);
2301 _myAvatar.setCameraPosition(_viewFrustum.getPosition()); // setCameraPosition() dne2345 _myAvatar.setCameraPosition(_viewFrustum.getPosition());
2302 _myAvatar.setCameraOrientation(_viewFrustum.getOrientation());2346 _myAvatar.setCameraOrientation(_viewFrustum.getOrientation());
2303 _myAvatar.setCameraFov(_viewFrustum.getFieldOfView());2347 _myAvatar.setCameraFov(_viewFrustum.getFieldOfView());
2304 _myAvatar.setCameraAspectRatio(_viewFrustum.getAspectRatio());2348 _myAvatar.setCameraAspectRatio(_viewFrustum.getAspectRatio());

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