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
203203 _mouseVoxelScale(1.0f / 1024.0f),
204204 _justEditedVoxel(false),
205205 _isLookingAtOtherAvatar(false),
206+ _lookatIndicatorScale(1.0f),
206207 _paintOn(false),
207208 _dominantColor(0),
208209 _perfStatsOn(false),
@@ -1854,6 +1855,11 @@ void Application::initMenu() { · 1645 unmodified lines
18541855 (_simulateLeapHand = debugMenu->addAction("Simulate Leap Hand"))->setCheckable(true);
18551856 (_testRaveGlove = debugMenu->addAction("Test RaveGlove"))->setCheckable(true);
18561857
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+
18571863 QMenu* settingsMenu = menuBar->addMenu("Settings");
18581864 (_settingsAutosave = settingsMenu->addAction("Autosave"))->setCheckable(true);
18591865 _settingsAutosave->setChecked(true);
@@ -1865,6 +1871,30 @@ void Application::initMenu() { · 5 unmodified lines
18651871 _networkAccessManager = new QNetworkAccessManager(this);
18661872 }
18671873
1874+void Application::setListenModeNormal() {
1875+ _audio.setListenMode(AudioRingBuffer::NORMAL);
1876+}
1877+
1878+void Application::setListenModePoint() {
1879+ _audio.setListenMode(AudioRingBuffer::OMNI_DIRECTIONAL_POINT);
1880+ _audio.setListenRadius(1.0);
1881+}
1882+
1883+void 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+
18681898 void Application::updateFrustumRenderModeAction() {
18691899 switch (_frustumDrawingMode) {
18701900 default:
@@ -1953,7 +1983,13 @@ const float MAX_AVATAR_EDIT_VELOCITY = 1.0f; · 82 unmodified lines
19531983 const float MAX_VOXEL_EDIT_DISTANCE = 20.0f;
19541984 const float HEAD_SPHERE_RADIUS = 0.07;
19551985
1956−bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, glm::vec3& eyePosition) {
1986+
1987+static uint16_t DEFAULT_NODE_ID_REF = 1;
1988+
1989+
1990+bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection,
1991+ glm::vec3& eyePosition, uint16_t& nodeID = DEFAULT_NODE_ID_REF) {
1992+
19571993 NodeList* nodeList = NodeList::getInstance();
19581994 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
19591995 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
19611997 glm::vec3 headPosition = avatar->getHead().getPosition();
19621998 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {
19631999 eyePosition = avatar->getHead().getEyeLevelPosition();
2000+ _lookatIndicatorScale = avatar->getScale();
19642001 _lookatOtherPosition = headPosition;
2002+ nodeID = avatar->getOwningNode()->getNodeID();
19652003 return true;
19662004 }
19672005 }
@@ -1971,11 +2009,13 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 3 unmodified lines
19712009
19722010 void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) {
19732011
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;
19752014 const float YELLOW[] = { 1.0f, 1.0f, 0.0f };
2015+ const int NUM_SEGMENTS = 30;
19762016 glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z);
19772017 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);
19792019 }
19802020
19812021 void Application::update(float deltaTime) {
@@ -2005,7 +2045,9 @@ void Application::update(float deltaTime) { · 23 unmodified lines
20052045
20062046 // Set where I am looking based on my mouse ray (so that other people can see)
20072047 glm::vec3 eyePosition;
2008− if ((_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition))) {
2048+
2049+ _isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition);
2050+ if (_isLookingAtOtherAvatar) {
20092051 // If the mouse is over another avatar's head...
20102052 glm::vec3 myLookAtFromMouse(eyePosition);
20112053 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
@@ -2022,7 +2064,7 @@ void Application::update(float deltaTime) { · 10 unmodified lines
20222064 glm::vec3 front = orientation * IDENTITY_FRONT;
20232065 glm::vec3 up = orientation * IDENTITY_UP;
20242066 glm::vec3 towardVoxel = getMouseVoxelWorldCoordinates(_mouseVoxelDragging)
2025− - _myAvatar.getCameraPosition(); // is this an error? getCameraPosition dne
2067+ - _myAvatar.getCameraPosition();
20262068 towardVoxel = front * glm::length(towardVoxel);
20272069 glm::vec3 lateralToVoxel = glm::cross(up, glm::normalize(towardVoxel)) * glm::length(towardVoxel);
20282070 _voxelThrust = glm::vec3(0, 0, 0);
@@ -2270,7 +2312,9 @@ void Application::updateAvatar(float deltaTime) { · 241 unmodified lines
22702312 _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);
22712313
22722314 glm::vec3 eyePosition;
2273− if ((_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition))) {
2315+
2316+ _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition);
2317+ if (_isLookingAtOtherAvatar) {
22742318 glm::vec3 myLookAtFromMouse(eyePosition);
22752319 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
22762320 }
@@ -2298,7 +2342,7 @@ void Application::updateAvatar(float deltaTime) { · 21 unmodified lines
22982342 // actually need to calculate the view frustum planes to send these details
22992343 // to the server.
23002344 loadViewFrustum(_myCamera, _viewFrustum);
2301− _myAvatar.setCameraPosition(_viewFrustum.getPosition()); // setCameraPosition() dne
2345+ _myAvatar.setCameraPosition(_viewFrustum.getPosition());
23022346 _myAvatar.setCameraOrientation(_viewFrustum.getOrientation());
23032347 _myAvatar.setCameraFov(_viewFrustum.getFieldOfView());
23042348 _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