Showing the changes to interface/src/Application.cpp (1 of 67 files). Show all
Unified · Split
| @@ -58,6 +58,7 @@ · 57 unmodified lines | |||
| 58 | #include <VoxelSceneStats.h> | 58 | #include <VoxelSceneStats.h> |
| 59 | 59 | ||
| 60 | #include "Application.h" | 60 | #include "Application.h" |
| 61 | #include "DataServerClient.h" | ||
| 61 | #include "LogDisplay.h" | 62 | #include "LogDisplay.h" |
| 62 | #include "Menu.h" | 63 | #include "Menu.h" |
| 63 | #include "Swatch.h" | 64 | #include "Swatch.h" |
| @@ -101,6 +102,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 37 unmodified lines | |||
| 101 | _voxelImporter(_window), | 102 | _voxelImporter(_window), |
| 102 | _wantToKillLocalVoxels(false), | 103 | _wantToKillLocalVoxels(false), |
| 103 | _audioScope(256, 200, true), | 104 | _audioScope(256, 200, true), |
| 105 | _profile(QString()), | ||
| 104 | _mouseX(0), | 106 | _mouseX(0), |
| 105 | _mouseY(0), | 107 | _mouseY(0), |
| 106 | _touchAvgX(0.0f), | 108 | _touchAvgX(0.0f), |
| @@ -180,10 +182,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 73 unmodified lines | |||
| 180 | 182 | ||
| 181 | _settings = new QSettings(this); | 183 | _settings = new QSettings(this); |
| 182 | 184 | ||
| 183 | // check if there is a saved domain server hostname | 185 | // call Menu getInstance static method to set up the menu |
| 184 | // this must be done now instead of with the other setting checks to allow manual override with | 186 | _window->setMenuBar(Menu::getInstance()); |
| 185 | // --domain or --local options | ||
| 186 | NodeList::getInstance()->loadData(_settings); | ||
| 187 | 187 | ||
| 188 | // Check to see if the user passed in a command line option for loading a local | 188 | // Check to see if the user passed in a command line option for loading a local |
| 189 | // Voxel File. | 189 | // Voxel File. |
| @@ -205,9 +205,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 15 unmodified lines | |||
| 205 | NodeList::getInstance()->startSilentNodeRemovalThread(); | 205 | NodeList::getInstance()->startSilentNodeRemovalThread(); |
| 206 | 206 | ||
| 207 | _window->setCentralWidget(_glWidget); | 207 | _window->setCentralWidget(_glWidget); |
| 208 | |||
| 209 | // call Menu getInstance static method to set up the menu | ||
| 210 | _window->setMenuBar(Menu::getInstance()); | ||
| 211 | 208 | ||
| 212 | _networkAccessManager = new QNetworkAccessManager(this); | 209 | _networkAccessManager = new QNetworkAccessManager(this); |
| 213 | QNetworkDiskCache* cache = new QNetworkDiskCache(_networkAccessManager); | 210 | QNetworkDiskCache* cache = new QNetworkDiskCache(_networkAccessManager); |
| @@ -242,7 +239,6 @@ Application::~Application() { · 28 unmodified lines | |||
| 242 | 239 | ||
| 243 | delete _oculusProgram; | 240 | delete _oculusProgram; |
| 244 | delete _settings; | 241 | delete _settings; |
| 245 | delete _networkAccessManager; | ||
| 246 | delete _followMode; | 242 | delete _followMode; |
| 247 | delete _glWidget; | 243 | delete _glWidget; |
| 248 | } | 244 | } |
| @@ -324,13 +320,22 @@ void Application::initializeGL() { · 75 unmodified lines | |||
| 324 | } | 320 | } |
| 325 | 321 | ||
| 326 | void Application::paintGL() { | 322 | void Application::paintGL() { |
| 327 | PerfStat("display"); | 323 | PerformanceWarning::setSuppressShortTimings(Menu::getInstance()->isOptionChecked(MenuOption::SuppressShortTimings)); |
| 324 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::paintGL()"); | ||
| 328 | 325 | ||
| 329 | glEnable(GL_LINE_SMOOTH); | 326 | glEnable(GL_LINE_SMOOTH); |
| 330 | 327 | ||
| 331 | if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { | 328 | if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 332 | _myCamera.setTightness (100.0f); | 329 | _myCamera.setTightness (100.0f); |
| 333 | _myCamera.setTargetPosition(_myAvatar.getUprightHeadPosition()); | 330 | glm::vec3 targetPosition = _myAvatar.getUprightHeadPosition(); |
| 331 | if (_myAvatar.getHead().getBlendFace().isActive()) { | ||
| 332 | // make sure we're aligned to the blend face eyes | ||
| 333 | glm::vec3 leftEyePosition, rightEyePosition; | ||
| 334 | if (_myAvatar.getHead().getBlendFace().getEyePositions(leftEyePosition, rightEyePosition, true)) { | ||
| 335 | targetPosition = (leftEyePosition + rightEyePosition) * 0.5f; | ||
| 336 | } | ||
| 337 | } | ||
| 338 | _myCamera.setTargetPosition(targetPosition); | ||
| 334 | _myCamera.setTargetRotation(_myAvatar.getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f))); | 339 | _myCamera.setTargetRotation(_myAvatar.getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PIf, 0.0f))); |
| 335 | 340 | ||
| 336 | } else if (OculusManager::isConnected()) { | 341 | } else if (OculusManager::isConnected()) { |
| @@ -342,7 +347,7 @@ void Application::paintGL() { · 5 unmodified lines | |||
| 342 | 347 | ||
| 343 | } else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { | 348 | } else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) { |
| 344 | _myCamera.setTightness(0.0f); // In first person, camera follows head exactly without delay | 349 | _myCamera.setTightness(0.0f); // In first person, camera follows head exactly without delay |
| 345 | _myCamera.setTargetPosition(_myAvatar.getUprightEyeLevelPosition()); | 350 | _myCamera.setTargetPosition(_myAvatar.getEyeLevelPosition()); |
| 346 | _myCamera.setTargetRotation(_myAvatar.getHead().getCameraOrientation()); | 351 | _myCamera.setTargetRotation(_myAvatar.getHead().getCameraOrientation()); |
| 347 | 352 | ||
| 348 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { | 353 | } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) { |
| @@ -445,6 +450,12 @@ void Application::updateProjectionMatrix() { · 96 unmodified lines | |||
| 445 | glMatrixMode(GL_MODELVIEW); | 450 | glMatrixMode(GL_MODELVIEW); |
| 446 | } | 451 | } |
| 447 | 452 | ||
| 453 | void Application::resetProfile(const QString& username) { | ||
| 454 | // call the destructor on the old profile and construct a new one | ||
| 455 | (&_profile)->~Profile(); | ||
| 456 | new (&_profile) Profile(username); | ||
| 457 | } | ||
| 458 | |||
| 448 | void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_t dataBytes, | 459 | void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_t dataBytes, |
| 449 | const char* nodeTypes, int numNodeTypes) { | 460 | const char* nodeTypes, int numNodeTypes) { |
| 450 | Application* self = getInstance(); | 461 | Application* self = getInstance(); |
| @@ -1153,6 +1164,9 @@ void Application::timer() { · 702 unmodified lines | |||
| 1153 | 1164 | ||
| 1154 | // ask the node list to check in with the domain server | 1165 | // ask the node list to check in with the domain server |
| 1155 | NodeList::getInstance()->sendDomainServerCheckIn(); | 1166 | NodeList::getInstance()->sendDomainServerCheckIn(); |
| 1167 | |||
| 1168 | // give the MyAvatar object position to the Profile so it can propagate to the data-server | ||
| 1169 | _profile.updatePosition(_myAvatar.getPosition()); | ||
| 1156 | } | 1170 | } |
| 1157 | 1171 | ||
| 1158 | static glm::vec3 getFaceVector(BoxFace face) { | 1172 | static glm::vec3 getFaceVector(BoxFace face) { |
| @@ -1186,6 +1200,7 @@ void Application::idle() { · 27 unmodified lines | |||
| 1186 | 1200 | ||
| 1187 | double timeSinceLastUpdate = diffclock(&_lastTimeUpdated, &check); | 1201 | double timeSinceLastUpdate = diffclock(&_lastTimeUpdated, &check); |
| 1188 | if (timeSinceLastUpdate > IDLE_SIMULATE_MSECS) { | 1202 | if (timeSinceLastUpdate > IDLE_SIMULATE_MSECS) { |
| 1203 | |||
| 1189 | const float BIGGEST_DELTA_TIME_SECS = 0.25f; | 1204 | const float BIGGEST_DELTA_TIME_SECS = 0.25f; |
| 1190 | update(glm::clamp((float)timeSinceLastUpdate / 1000.f, 0.f, BIGGEST_DELTA_TIME_SECS)); | 1205 | update(glm::clamp((float)timeSinceLastUpdate / 1000.f, 0.f, BIGGEST_DELTA_TIME_SECS)); |
| 1191 | _glWidget->updateGL(); | 1206 | _glWidget->updateGL(); |
| @@ -1254,13 +1269,14 @@ void Application::processAvatarURLsMessage(unsigned char* packetData, size_t dat · 62 unmodified lines | |||
| 1254 | return; | 1269 | return; |
| 1255 | } | 1270 | } |
| 1256 | QDataStream in(QByteArray((char*)packetData, dataBytes)); | 1271 | QDataStream in(QByteArray((char*)packetData, dataBytes)); |
| 1257 | QUrl voxelURL, faceURL; | 1272 | QUrl voxelURL; |
| 1258 | in >> voxelURL; | 1273 | in >> voxelURL; |
| 1259 | in >> faceURL; | ||
| 1260 | 1274 | ||
| 1261 | // invoke the set URL functions on the simulate/render thread | 1275 | // invoke the set URL functions on the simulate/render thread |
| 1262 | QMetaObject::invokeMethod(avatar->getVoxels(), "setVoxelURL", Q_ARG(QUrl, voxelURL)); | 1276 | QMetaObject::invokeMethod(avatar->getVoxels(), "setVoxelURL", Q_ARG(QUrl, voxelURL)); |
| 1263 | QMetaObject::invokeMethod(&avatar->getHead().getBlendFace(), "setModelURL", Q_ARG(QUrl, faceURL)); | 1277 | |
| 1278 | // use this timing to as the data-server for an updated mesh for this avatar (if we have UUID) | ||
| 1279 | DataServerClient::getValueForKeyAndUUID(DataServerKey::FaceMeshURL, avatar->getUUID()); | ||
| 1264 | } | 1280 | } |
| 1265 | 1281 | ||
| 1266 | void Application::processAvatarFaceVideoMessage(unsigned char* packetData, size_t dataBytes) { | 1282 | void Application::processAvatarFaceVideoMessage(unsigned char* packetData, size_t dataBytes) { |
| @@ -1587,15 +1603,21 @@ void Application::init() { · 320 unmodified lines | |||
| 1587 | _audio.setJitterBufferSamples(Menu::getInstance()->getAudioJitterBufferSamples()); | 1603 | _audio.setJitterBufferSamples(Menu::getInstance()->getAudioJitterBufferSamples()); |
| 1588 | } | 1604 | } |
| 1589 | qDebug("Loaded settings.\n"); | 1605 | qDebug("Loaded settings.\n"); |
| 1606 | |||
| 1607 | if (!_profile.getUsername().isEmpty()) { | ||
| 1608 | // we have a username for this avatar, ask the data-server for the mesh URL for this avatar | ||
| 1609 | DataServerClient::getClientValueForKey(DataServerKey::FaceMeshURL); | ||
| 1610 | } | ||
| 1590 | 1611 | ||
| 1591 | // Set up VoxelSystem after loading preferences so we can get the desired max voxel count | 1612 | // Set up VoxelSystem after loading preferences so we can get the desired max voxel count |
| 1592 | _voxels.setMaxVoxels(Menu::getInstance()->getMaxVoxels()); | 1613 | _voxels.setMaxVoxels(Menu::getInstance()->getMaxVoxels()); |
| 1593 | _voxels.setUseVoxelShader(Menu::getInstance()->isOptionChecked(MenuOption::UseVoxelShader)); | 1614 | _voxels.setUseVoxelShader(Menu::getInstance()->isOptionChecked(MenuOption::UseVoxelShader)); |
| 1615 | _voxels.setVoxelsAsPoints(Menu::getInstance()->isOptionChecked(MenuOption::VoxelsAsPoints)); | ||
| 1594 | _voxels.setUseFastVoxelPipeline(Menu::getInstance()->isOptionChecked(MenuOption::FastVoxelPipeline)); | 1616 | _voxels.setUseFastVoxelPipeline(Menu::getInstance()->isOptionChecked(MenuOption::FastVoxelPipeline)); |
| 1595 | _voxels.init(); | 1617 | _voxels.init(); |
| 1596 | 1618 | ||
| 1597 | 1619 | ||
| 1598 | Avatar::sendAvatarURLsMessage(_myAvatar.getVoxels()->getVoxelURL(), _myAvatar.getHead().getBlendFace().getModelURL()); | 1620 | Avatar::sendAvatarURLsMessage(_myAvatar.getVoxels()->getVoxelURL()); |
| 1599 | 1621 | ||
| 1600 | _palette.init(_glWidget->width(), _glWidget->height()); | 1622 | _palette.init(_glWidget->width(), _glWidget->height()); |
| 1601 | _palette.addAction(Menu::getInstance()->getActionForOption(MenuOption::VoxelAddMode), 0, 0); | 1623 | _palette.addAction(Menu::getInstance()->getActionForOption(MenuOption::VoxelAddMode), 0, 0); |
| @@ -1639,9 +1661,9 @@ Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, con · 37 unmodified lines | |||
| 1639 | glm::vec3 headPosition = avatar->getHead().getPosition(); | 1661 | glm::vec3 headPosition = avatar->getHead().getPosition(); |
| 1640 | float distance; | 1662 | float distance; |
| 1641 | if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, | 1663 | if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, |
| 1642 | HEAD_SPHERE_RADIUS * avatar->getScale(), distance)) { | 1664 | HEAD_SPHERE_RADIUS * avatar->getHead().getScale(), distance)) { |
| 1643 | eyePosition = avatar->getHead().getEyePosition(); | 1665 | eyePosition = avatar->getHead().getEyePosition(); |
| 1644 | _lookatIndicatorScale = avatar->getScale(); | 1666 | _lookatIndicatorScale = avatar->getHead().getScale(); |
| 1645 | _lookatOtherPosition = headPosition; | 1667 | _lookatOtherPosition = headPosition; |
| 1646 | nodeID = avatar->getOwningNode()->getNodeID(); | 1668 | nodeID = avatar->getOwningNode()->getNodeID(); |
| 1647 | return avatar; | 1669 | return avatar; |
| @@ -1782,8 +1804,8 @@ void Application::update(float deltaTime) { · 134 unmodified lines | |||
| 1782 | _faceshift.getEstimatedEyePitch(), _faceshift.getEstimatedEyeYaw(), 0.0f))) * glm::vec3(0.0f, 0.0f, -1.0f); | 1804 | _faceshift.getEstimatedEyePitch(), _faceshift.getEstimatedEyeYaw(), 0.0f))) * glm::vec3(0.0f, 0.0f, -1.0f); |
| 1783 | } | 1805 | } |
| 1784 | 1806 | ||
| 1785 | updateLookatTargetAvatar(lookAtRayOrigin, lookAtRayDirection, lookAtSpot); | 1807 | updateLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, lookAtSpot); |
| 1786 | if (_lookatTargetAvatar) { | 1808 | if (_lookatTargetAvatar && !_faceshift.isActive()) { |
| 1787 | // If the mouse is over another avatar's head... | 1809 | // If the mouse is over another avatar's head... |
| 1788 | _myAvatar.getHead().setLookAtPosition(lookAtSpot); | 1810 | _myAvatar.getHead().setLookAtPosition(lookAtSpot); |
| 1789 | } else if (_isHoverVoxel && !_faceshift.isActive()) { | 1811 | } else if (_isHoverVoxel && !_faceshift.isActive()) { |
| @@ -1975,6 +1997,11 @@ void Application::update(float deltaTime) { · 185 unmodified lines | |||
| 1975 | _myAvatar.simulate(deltaTime, NULL); | 1997 | _myAvatar.simulate(deltaTime, NULL); |
| 1976 | } | 1998 | } |
| 1977 | 1999 | ||
| 2000 | // Simulate particle cloud movements | ||
| 2001 | if (Menu::getInstance()->isOptionChecked(MenuOption::ParticleCloud)) { | ||
| 2002 | _cloud.simulate(deltaTime); | ||
| 2003 | } | ||
| 2004 | |||
| 1978 | // no transmitter drive implies transmitter pick | 2005 | // no transmitter drive implies transmitter pick |
| 1979 | if (!Menu::getInstance()->isOptionChecked(MenuOption::TransmitterDrive) && _myTransmitter.isConnected()) { | 2006 | if (!Menu::getInstance()->isOptionChecked(MenuOption::TransmitterDrive) && _myTransmitter.isConnected()) { |
| 1980 | _transmitterPickStart = _myAvatar.getSkeleton().joint[AVATAR_JOINT_CHEST].position; | 2007 | _transmitterPickStart = _myAvatar.getSkeleton().joint[AVATAR_JOINT_CHEST].position; |
| @@ -2032,7 +2059,7 @@ void Application::update(float deltaTime) { · 51 unmodified lines | |||
| 2032 | if (_faceshift.isActive()) { | 2059 | if (_faceshift.isActive()) { |
| 2033 | const float EYE_OFFSET_SCALE = 0.025f; | 2060 | const float EYE_OFFSET_SCALE = 0.025f; |
| 2034 | glm::vec3 position = _faceshift.getHeadTranslation() * EYE_OFFSET_SCALE; | 2061 | glm::vec3 position = _faceshift.getHeadTranslation() * EYE_OFFSET_SCALE; |
| 2035 | _myCamera.setEyeOffsetPosition(glm::vec3(position.x * xSign, position.y, position.z)); | 2062 | _myCamera.setEyeOffsetPosition(glm::vec3(position.x * xSign, position.y, -position.z)); |
| 2036 | updateProjectionMatrix(); | 2063 | updateProjectionMatrix(); |
| 2037 | 2064 | ||
| 2038 | } else if (_webcam.isActive()) { | 2065 | } else if (_webcam.isActive()) { |
| @@ -2071,8 +2098,7 @@ void Application::updateAvatar(float deltaTime) { · 32 unmodified lines | |||
| 2071 | _yawFromTouch = 0.f; | 2098 | _yawFromTouch = 0.f; |
| 2072 | 2099 | ||
| 2073 | // Update my avatar's state from gyros and/or webcam | 2100 | // Update my avatar's state from gyros and/or webcam |
| 2074 | _myAvatar.updateFromGyrosAndOrWebcam(Menu::getInstance()->isOptionChecked(MenuOption::GyroLook), | 2101 | _myAvatar.updateFromGyrosAndOrWebcam(_pitchFromTouch, Menu::getInstance()->isOptionChecked(MenuOption::TurnWithHead)); |
| 2075 | _pitchFromTouch); | ||
| 2076 | 2102 | ||
| 2077 | // Update head mouse from faceshift if active | 2103 | // Update head mouse from faceshift if active |
| 2078 | if (_faceshift.isActive()) { | 2104 | if (_faceshift.isActive()) { |
| @@ -2172,8 +2198,7 @@ void Application::updateAvatar(float deltaTime) { · 93 unmodified lines | |||
| 2172 | // once in a while, send my urls | 2198 | // once in a while, send my urls |
| 2173 | const float AVATAR_URLS_SEND_INTERVAL = 1.0f; // seconds | 2199 | const float AVATAR_URLS_SEND_INTERVAL = 1.0f; // seconds |
| 2174 | if (shouldDo(AVATAR_URLS_SEND_INTERVAL, deltaTime)) { | 2200 | if (shouldDo(AVATAR_URLS_SEND_INTERVAL, deltaTime)) { |
| 2175 | Avatar::sendAvatarURLsMessage(_myAvatar.getVoxels()->getVoxelURL(), | 2201 | Avatar::sendAvatarURLsMessage(_myAvatar.getVoxels()->getVoxelURL()); |
| 2176 | _myAvatar.getHead().getBlendFace().getModelURL()); | ||
| 2177 | } | 2202 | } |
| 2178 | } | 2203 | } |
| 2179 | } | 2204 | } |
| @@ -2386,6 +2411,7 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom · 206 unmodified lines | |||
| 2386 | } | 2411 | } |
| 2387 | 2412 | ||
| 2388 | void Application::displaySide(Camera& whichCamera) { | 2413 | void Application::displaySide(Camera& whichCamera) { |
| 2414 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displaySide()"); | ||
| 2389 | // transform by eye offset | 2415 | // transform by eye offset |
| 2390 | 2416 | ||
| 2391 | // flip x if in mirror mode (also requires reversing winding order for backface culling) | 2417 | // flip x if in mirror mode (also requires reversing winding order for backface culling) |
| @@ -2417,6 +2443,8 @@ void Application::displaySide(Camera& whichCamera) { · 25 unmodified lines | |||
| 2417 | setupWorldLight(whichCamera); | 2443 | setupWorldLight(whichCamera); |
| 2418 | 2444 | ||
| 2419 | if (Menu::getInstance()->isOptionChecked(MenuOption::Stars)) { | 2445 | if (Menu::getInstance()->isOptionChecked(MenuOption::Stars)) { |
| 2446 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2447 | "Application::displaySide() ... stars..."); | ||
| 2420 | if (!_stars.getFileLoaded()) { | 2448 | if (!_stars.getFileLoaded()) { |
| 2421 | _stars.readInput(STAR_FILE, STAR_CACHE_FILE, 0); | 2449 | _stars.readInput(STAR_FILE, STAR_CACHE_FILE, 0); |
| 2422 | } | 2450 | } |
| @@ -2442,6 +2470,8 @@ void Application::displaySide(Camera& whichCamera) { · 19 unmodified lines | |||
| 2442 | 2470 | ||
| 2443 | // draw the sky dome | 2471 | // draw the sky dome |
| 2444 | if (Menu::getInstance()->isOptionChecked(MenuOption::Atmosphere)) { | 2472 | if (Menu::getInstance()->isOptionChecked(MenuOption::Atmosphere)) { |
| 2473 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2474 | "Application::displaySide() ... atmosphere..."); | ||
| 2445 | _environment.renderAtmospheres(whichCamera); | 2475 | _environment.renderAtmospheres(whichCamera); |
| 2446 | } | 2476 | } |
| 2447 | 2477 | ||
| @@ -2464,6 +2494,9 @@ void Application::displaySide(Camera& whichCamera) { · 16 unmodified lines | |||
| 2464 | 2494 | ||
| 2465 | //draw a grid ground plane.... | 2495 | //draw a grid ground plane.... |
| 2466 | if (Menu::getInstance()->isOptionChecked(MenuOption::GroundPlane)) { | 2496 | if (Menu::getInstance()->isOptionChecked(MenuOption::GroundPlane)) { |
| 2497 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2498 | "Application::displaySide() ... ground plane..."); | ||
| 2499 | |||
| 2467 | // draw grass plane with fog | 2500 | // draw grass plane with fog |
| 2468 | glEnable(GL_FOG); | 2501 | glEnable(GL_FOG); |
| 2469 | glEnable(GL_NORMALIZE); | 2502 | glEnable(GL_NORMALIZE); |
| @@ -2484,17 +2517,29 @@ void Application::displaySide(Camera& whichCamera) { · 14 unmodified lines | |||
| 2484 | glDisable(GL_NORMALIZE); | 2517 | glDisable(GL_NORMALIZE); |
| 2485 | 2518 | ||
| 2486 | //renderGroundPlaneGrid(EDGE_SIZE_GROUND_PLANE, _audio.getCollisionSoundMagnitude()); | 2519 | //renderGroundPlaneGrid(EDGE_SIZE_GROUND_PLANE, _audio.getCollisionSoundMagnitude()); |
| 2487 | } | 2520 | } |
| 2521 | // Draw Cloud Particles | ||
| 2522 | if (Menu::getInstance()->isOptionChecked(MenuOption::ParticleCloud)) { | ||
| 2523 | _cloud.render(); | ||
| 2524 | } | ||
| 2488 | // Draw voxels | 2525 | // Draw voxels |
| 2489 | if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { | 2526 | if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { |
| 2490 | _voxels.render(Menu::getInstance()->isOptionChecked(MenuOption::VoxelTextures)); | 2527 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2528 | "Application::displaySide() ... voxels..."); | ||
| 2529 | if (!Menu::getInstance()->isOptionChecked(MenuOption::DontRenderVoxels)) { | ||
| 2530 | _voxels.render(Menu::getInstance()->isOptionChecked(MenuOption::VoxelTextures)); | ||
| 2531 | } | ||
| 2491 | } | 2532 | } |
| 2492 | 2533 | ||
| 2534 | |||
| 2493 | // restore default, white specular | 2535 | // restore default, white specular |
| 2494 | glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR); | 2536 | glMaterialfv(GL_FRONT, GL_SPECULAR, WHITE_SPECULAR_COLOR); |
| 2495 | 2537 | ||
| 2496 | // indicate what we'll be adding/removing in mouse mode, if anything | 2538 | // indicate what we'll be adding/removing in mouse mode, if anything |
| 2497 | if (_mouseVoxel.s != 0) { | 2539 | if (_mouseVoxel.s != 0) { |
| 2540 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2541 | "Application::displaySide() ... voxels TOOLS UX..."); | ||
| 2542 | |||
| 2498 | glDisable(GL_LIGHTING); | 2543 | glDisable(GL_LIGHTING); |
| 2499 | glPushMatrix(); | 2544 | glPushMatrix(); |
| 2500 | glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE); | 2545 | glScalef(TREE_SCALE, TREE_SCALE, TREE_SCALE); |
| @@ -2540,6 +2585,9 @@ void Application::displaySide(Camera& whichCamera) { · 39 unmodified lines | |||
| 2540 | } | 2585 | } |
| 2541 | 2586 | ||
| 2542 | if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode) && _pasteMode) { | 2587 | if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode) && _pasteMode) { |
| 2588 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2589 | "Application::displaySide() ... PASTE Preview..."); | ||
| 2590 | |||
| 2543 | glPushMatrix(); | 2591 | glPushMatrix(); |
| 2544 | glTranslatef(_mouseVoxel.x * TREE_SCALE, | 2592 | glTranslatef(_mouseVoxel.x * TREE_SCALE, |
| 2545 | _mouseVoxel.y * TREE_SCALE, | 2593 | _mouseVoxel.y * TREE_SCALE, |
| @@ -2555,6 +2603,10 @@ void Application::displaySide(Camera& whichCamera) { · 9 unmodified lines | |||
| 2555 | _myAvatar.renderScreenTint(SCREEN_TINT_BEFORE_AVATARS, whichCamera); | 2603 | _myAvatar.renderScreenTint(SCREEN_TINT_BEFORE_AVATARS, whichCamera); |
| 2556 | 2604 | ||
| 2557 | if (Menu::getInstance()->isOptionChecked(MenuOption::Avatars)) { | 2605 | if (Menu::getInstance()->isOptionChecked(MenuOption::Avatars)) { |
| 2606 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2607 | "Application::displaySide() ... Avatars..."); | ||
| 2608 | |||
| 2609 | |||
| 2558 | // Render avatars of other nodes | 2610 | // Render avatars of other nodes |
| 2559 | NodeList* nodeList = NodeList::getInstance(); | 2611 | NodeList* nodeList = NodeList::getInstance(); |
| 2560 | 2612 | ||
| @@ -2599,16 +2651,22 @@ void Application::displaySide(Camera& whichCamera) { · 38 unmodified lines | |||
| 2599 | 2651 | ||
| 2600 | // render the ambient occlusion effect if enabled | 2652 | // render the ambient occlusion effect if enabled |
| 2601 | if (Menu::getInstance()->isOptionChecked(MenuOption::AmbientOcclusion)) { | 2653 | if (Menu::getInstance()->isOptionChecked(MenuOption::AmbientOcclusion)) { |
| 2654 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2655 | "Application::displaySide() ... AmbientOcclusion..."); | ||
| 2602 | _ambientOcclusionEffect.render(); | 2656 | _ambientOcclusionEffect.render(); |
| 2603 | } | 2657 | } |
| 2604 | 2658 | ||
| 2605 | // brad's frustum for debugging | 2659 | // brad's frustum for debugging |
| 2606 | if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayFrustum)) { | 2660 | if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayFrustum)) { |
| 2661 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2662 | "Application::displaySide() ... renderViewFrustum..."); | ||
| 2607 | renderViewFrustum(_viewFrustum); | 2663 | renderViewFrustum(_viewFrustum); |
| 2608 | } | 2664 | } |
| 2609 | 2665 | ||
| 2610 | // render voxel fades if they exist | 2666 | // render voxel fades if they exist |
| 2611 | if (_voxelFades.size() > 0) { | 2667 | if (_voxelFades.size() > 0) { |
| 2668 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2669 | "Application::displaySide() ... voxel fades..."); | ||
| 2612 | for(std::vector<VoxelFade>::iterator fade = _voxelFades.begin(); fade != _voxelFades.end();) { | 2670 | for(std::vector<VoxelFade>::iterator fade = _voxelFades.begin(); fade != _voxelFades.end();) { |
| 2613 | fade->render(); | 2671 | fade->render(); |
| 2614 | if(fade->isDone()) { | 2672 | if(fade->isDone()) { |
| @@ -2618,11 +2676,18 @@ void Application::displaySide(Camera& whichCamera) { · 3 unmodified lines | |||
| 2618 | } | 2676 | } |
| 2619 | } | 2677 | } |
| 2620 | } | 2678 | } |
| 2621 | 2679 | ||
| 2622 | renderFollowIndicator(); | 2680 | { |
| 2681 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2682 | "Application::displaySide() ... renderFollowIndicator..."); | ||
| 2683 | renderFollowIndicator(); | ||
| 2684 | } | ||
| 2623 | 2685 | ||
| 2624 | // render transmitter pick ray, if non-empty | 2686 | // render transmitter pick ray, if non-empty |
| 2625 | if (_transmitterPickStart != _transmitterPickEnd) { | 2687 | if (_transmitterPickStart != _transmitterPickEnd) { |
| 2688 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | ||
| 2689 | "Application::displaySide() ... transmitter pick ray..."); | ||
| 2690 | |||
| 2626 | Glower glower; | 2691 | Glower glower; |
| 2627 | const float TRANSMITTER_PICK_COLOR[] = { 1.0f, 1.0f, 0.0f }; | 2692 | const float TRANSMITTER_PICK_COLOR[] = { 1.0f, 1.0f, 0.0f }; |
| 2628 | glColor3fv(TRANSMITTER_PICK_COLOR); | 2693 | glColor3fv(TRANSMITTER_PICK_COLOR); |
| @@ -2644,6 +2709,8 @@ void Application::displaySide(Camera& whichCamera) { · 15 unmodified lines | |||
| 2644 | } | 2709 | } |
| 2645 | 2710 | ||
| 2646 | void Application::displayOverlay() { | 2711 | void Application::displayOverlay() { |
| 2712 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::displayOverlay()"); | ||
| 2713 | |||
| 2647 | // Render 2D overlay: I/O level bar graphs and text | 2714 | // Render 2D overlay: I/O level bar graphs and text |
| 2648 | glMatrixMode(GL_PROJECTION); | 2715 | glMatrixMode(GL_PROJECTION); |
| 2649 | glPushMatrix(); | 2716 | glPushMatrix(); |
| @@ -3461,9 +3528,16 @@ void Application::attachNewHeadToNode(Node* newNode) { · 811 unmodified lines | |||
| 3461 | void Application::domainChanged(QString domain) { | 3528 | void Application::domainChanged(QString domain) { |
| 3462 | qDebug("Application title set to: %s.\n", domain.toStdString().c_str()); | 3529 | qDebug("Application title set to: %s.\n", domain.toStdString().c_str()); |
| 3463 | _window->setWindowTitle(domain); | 3530 | _window->setWindowTitle(domain); |
| 3531 | |||
| 3532 | // update the user's last domain in their Profile (which will propagate to data-server) | ||
| 3533 | _profile.updateDomain(domain); | ||
| 3534 | |||
| 3535 | // reset the environment so that we don't erroneously end up with multiple | ||
| 3536 | _environment.resetToDefault(); | ||
| 3464 | } | 3537 | } |
| 3465 | 3538 | ||
| 3466 | void Application::nodeAdded(Node* node) { | 3539 | void Application::nodeAdded(Node* node) { |
| 3540 | |||
| 3467 | } | 3541 | } |
| 3468 | 3542 | ||
| 3469 | void Application::nodeKilled(Node* node) { | 3543 | void Application::nodeKilled(Node* node) { |
| @@ -3574,6 +3648,12 @@ void* Application::networkReceive(void* args) { · 104 unmodified lines | |||
| 3574 | case PACKET_TYPE_AVATAR_FACE_VIDEO: | 3648 | case PACKET_TYPE_AVATAR_FACE_VIDEO: |
| 3575 | processAvatarFaceVideoMessage(app->_incomingPacket, bytesReceived); | 3649 | processAvatarFaceVideoMessage(app->_incomingPacket, bytesReceived); |
| 3576 | break; | 3650 | break; |
| 3651 | case PACKET_TYPE_DATA_SERVER_GET: | ||
| 3652 | case PACKET_TYPE_DATA_SERVER_PUT: | ||
| 3653 | case PACKET_TYPE_DATA_SERVER_SEND: | ||
| 3654 | case PACKET_TYPE_DATA_SERVER_CONFIRM: | ||
| 3655 | DataServerClient::processMessageFromDataServer(app->_incomingPacket, bytesReceived); | ||
| 3656 | break; | ||
| 3577 | default: | 3657 | default: |
| 3578 | NodeList::getInstance()->processNodeData(&senderAddress, app->_incomingPacket, bytesReceived); | 3658 | NodeList::getInstance()->processNodeData(&senderAddress, app->_incomingPacket, bytesReceived); |
| 3579 | break; | 3659 | break; |