Showing the changes to interface/src/Application.cpp (1 of 26 files). Show all
Unified · Split
| @@ -56,6 +56,8 @@ · 55 unmodified lines | |||
| 56 | #include <PairingHandler.h> | 56 | #include <PairingHandler.h> |
| 57 | #include <PerfStat.h> | 57 | #include <PerfStat.h> |
| 58 | 58 | ||
| 59 | #include <VoxelSceneStats.h> | ||
| 60 | |||
| 59 | #include "Application.h" | 61 | #include "Application.h" |
| 60 | #include "InterfaceConfig.h" | 62 | #include "InterfaceConfig.h" |
| 61 | #include "LogDisplay.h" | 63 | #include "LogDisplay.h" |
| @@ -174,6 +176,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 112 unmodified lines | |||
| 174 | _window(new QMainWindow(desktop())), | 176 | _window(new QMainWindow(desktop())), |
| 175 | _glWidget(new GLCanvas()), | 177 | _glWidget(new GLCanvas()), |
| 176 | _bandwidthDialog(NULL), | 178 | _bandwidthDialog(NULL), |
| 179 | _voxelStatsDialog(NULL), | ||
| 177 | _displayLevels(false), | 180 | _displayLevels(false), |
| 178 | _frameCount(0), | 181 | _frameCount(0), |
| 179 | _fps(120.0f), | 182 | _fps(120.0f), |
| @@ -200,6 +203,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 20 unmodified lines | |||
| 200 | _mouseVoxelScale(1.0f / 1024.0f), | 203 | _mouseVoxelScale(1.0f / 1024.0f), |
| 201 | _justEditedVoxel(false), | 204 | _justEditedVoxel(false), |
| 202 | _isLookingAtOtherAvatar(false), | 205 | _isLookingAtOtherAvatar(false), |
| 206 | _lookatIndicatorScale(1.0f), | ||
| 203 | _paintOn(false), | 207 | _paintOn(false), |
| 204 | _dominantColor(0), | 208 | _dominantColor(0), |
| 205 | _perfStatsOn(false), | 209 | _perfStatsOn(false), |
| @@ -1154,6 +1158,21 @@ void Application::bandwidthDetailsClosed() { · 948 unmodified lines | |||
| 1154 | delete dlg; | 1158 | delete dlg; |
| 1155 | } | 1159 | } |
| 1156 | 1160 | ||
| 1161 | void Application::voxelStatsDetails() { | ||
| 1162 | if (!_voxelStatsDialog) { | ||
| 1163 | _voxelStatsDialog = new VoxelStatsDialog(_glWidget, &_voxelSceneStats); | ||
| 1164 | connect(_voxelStatsDialog, SIGNAL(closed()), SLOT(voxelStatsDetailsClosed())); | ||
| 1165 | _voxelStatsDialog->show(); | ||
| 1166 | } | ||
| 1167 | _voxelStatsDialog->raise(); | ||
| 1168 | } | ||
| 1169 | |||
| 1170 | void Application::voxelStatsDetailsClosed() { | ||
| 1171 | QDialog* dlg = _voxelStatsDialog; | ||
| 1172 | _voxelStatsDialog = NULL; | ||
| 1173 | delete dlg; | ||
| 1174 | } | ||
| 1175 | |||
| 1157 | void Application::editPreferences() { | 1176 | void Application::editPreferences() { |
| 1158 | QDialog dialog(_glWidget); | 1177 | QDialog dialog(_glWidget); |
| 1159 | dialog.setWindowTitle("Interface Preferences"); | 1178 | dialog.setWindowTitle("Interface Preferences"); |
| @@ -1758,6 +1777,7 @@ void Application::initMenu() { · 598 unmodified lines | |||
| 1758 | (_bandwidthDisplayOn = toolsMenu->addAction("Bandwidth Display"))->setCheckable(true); | 1777 | (_bandwidthDisplayOn = toolsMenu->addAction("Bandwidth Display"))->setCheckable(true); |
| 1759 | _bandwidthDisplayOn->setChecked(true); | 1778 | _bandwidthDisplayOn->setChecked(true); |
| 1760 | toolsMenu->addAction("Bandwidth Details", this, SLOT(bandwidthDetails())); | 1779 | toolsMenu->addAction("Bandwidth Details", this, SLOT(bandwidthDetails())); |
| 1780 | toolsMenu->addAction("Voxel Stats Details", this, SLOT(voxelStatsDetails())); | ||
| 1761 | 1781 | ||
| 1762 | 1782 | ||
| 1763 | QMenu* voxelMenu = menuBar->addMenu("Voxels"); | 1783 | QMenu* voxelMenu = menuBar->addMenu("Voxels"); |
| @@ -1842,6 +1862,11 @@ void Application::initMenu() { · 78 unmodified lines | |||
| 1842 | (_simulateLeapHand = debugMenu->addAction("Simulate Leap Hand"))->setCheckable(true); | 1862 | (_simulateLeapHand = debugMenu->addAction("Simulate Leap Hand"))->setCheckable(true); |
| 1843 | (_testRaveGlove = debugMenu->addAction("Test RaveGlove"))->setCheckable(true); | 1863 | (_testRaveGlove = debugMenu->addAction("Test RaveGlove"))->setCheckable(true); |
| 1844 | 1864 | ||
| 1865 | QMenu* audioDebugMenu = debugMenu->addMenu("Audio Debugging Tools"); | ||
| 1866 | audioDebugMenu->addAction("Listen Mode Normal", this, SLOT(setListenModeNormal()), Qt::CTRL | Qt::Key_1); | ||
| 1867 | audioDebugMenu->addAction("Listen Mode Point/Radius", this, SLOT(setListenModePoint()), Qt::CTRL | Qt::Key_2); | ||
| 1868 | audioDebugMenu->addAction("Listen Mode Single Source", this, SLOT(setListenModeSingleSource()), Qt::CTRL | Qt::Key_3); | ||
| 1869 | |||
| 1845 | QMenu* settingsMenu = menuBar->addMenu("Settings"); | 1870 | QMenu* settingsMenu = menuBar->addMenu("Settings"); |
| 1846 | (_settingsAutosave = settingsMenu->addAction("Autosave"))->setCheckable(true); | 1871 | (_settingsAutosave = settingsMenu->addAction("Autosave"))->setCheckable(true); |
| 1847 | _settingsAutosave->setChecked(true); | 1872 | _settingsAutosave->setChecked(true); |
| @@ -1853,6 +1878,30 @@ void Application::initMenu() { · 5 unmodified lines | |||
| 1853 | _networkAccessManager = new QNetworkAccessManager(this); | 1878 | _networkAccessManager = new QNetworkAccessManager(this); |
| 1854 | } | 1879 | } |
| 1855 | 1880 | ||
| 1881 | void Application::setListenModeNormal() { | ||
| 1882 | _audio.setListenMode(AudioRingBuffer::NORMAL); | ||
| 1883 | } | ||
| 1884 | |||
| 1885 | void Application::setListenModePoint() { | ||
| 1886 | _audio.setListenMode(AudioRingBuffer::OMNI_DIRECTIONAL_POINT); | ||
| 1887 | _audio.setListenRadius(1.0); | ||
| 1888 | } | ||
| 1889 | |||
| 1890 | void Application::setListenModeSingleSource() { | ||
| 1891 | _audio.setListenMode(AudioRingBuffer::SELECTED_SOURCES); | ||
| 1892 | _audio.clearListenSources(); | ||
| 1893 | |||
| 1894 | glm::vec3 mouseRayOrigin = _myAvatar.getMouseRayOrigin(); | ||
| 1895 | glm::vec3 mouseRayDirection = _myAvatar.getMouseRayDirection(); | ||
| 1896 | glm::vec3 eyePositionIgnored; | ||
| 1897 | uint16_t nodeID; | ||
| 1898 | |||
| 1899 | if (isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePositionIgnored, nodeID)) { | ||
| 1900 | _audio.addListenSource(nodeID); | ||
| 1901 | } | ||
| 1902 | } | ||
| 1903 | |||
| 1904 | |||
| 1856 | void Application::updateFrustumRenderModeAction() { | 1905 | void Application::updateFrustumRenderModeAction() { |
| 1857 | switch (_frustumDrawingMode) { | 1906 | switch (_frustumDrawingMode) { |
| 1858 | default: | 1907 | default: |
| @@ -1941,7 +1990,10 @@ const float MAX_AVATAR_EDIT_VELOCITY = 1.0f; · 82 unmodified lines | |||
| 1941 | const float MAX_VOXEL_EDIT_DISTANCE = 20.0f; | 1990 | const float MAX_VOXEL_EDIT_DISTANCE = 20.0f; |
| 1942 | const float HEAD_SPHERE_RADIUS = 0.07; | 1991 | const float HEAD_SPHERE_RADIUS = 0.07; |
| 1943 | 1992 | ||
| 1944 | bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, glm::vec3& eyePosition) { | 1993 | |
| 1994 | bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, | ||
| 1995 | glm::vec3& eyePosition, uint16_t& nodeID) { | ||
| 1996 | |||
| 1945 | NodeList* nodeList = NodeList::getInstance(); | 1997 | NodeList* nodeList = NodeList::getInstance(); |
| 1946 | for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | 1998 | for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { |
| 1947 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { | 1999 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { |
| @@ -1949,7 +2001,9 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 1 unmodified line | |||
| 1949 | glm::vec3 headPosition = avatar->getHead().getPosition(); | 2001 | glm::vec3 headPosition = avatar->getHead().getPosition(); |
| 1950 | if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) { | 2002 | if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) { |
| 1951 | eyePosition = avatar->getHead().getEyeLevelPosition(); | 2003 | eyePosition = avatar->getHead().getEyeLevelPosition(); |
| 2004 | _lookatIndicatorScale = avatar->getScale(); | ||
| 1952 | _lookatOtherPosition = headPosition; | 2005 | _lookatOtherPosition = headPosition; |
| 2006 | nodeID = avatar->getOwningNode()->getNodeID(); | ||
| 1953 | return true; | 2007 | return true; |
| 1954 | } | 2008 | } |
| 1955 | } | 2009 | } |
| @@ -1959,11 +2013,13 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 3 unmodified lines | |||
| 1959 | 2013 | ||
| 1960 | void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) { | 2014 | void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) { |
| 1961 | 2015 | ||
| 1962 | const float DISTANCE_FROM_HEAD_SPHERE = 0.1f; | 2016 | const float DISTANCE_FROM_HEAD_SPHERE = 0.1f * _lookatIndicatorScale; |
| 2017 | const float INDICATOR_RADIUS = 0.1f * _lookatIndicatorScale; | ||
| 1963 | const float YELLOW[] = { 1.0f, 1.0f, 0.0f }; | 2018 | const float YELLOW[] = { 1.0f, 1.0f, 0.0f }; |
| 2019 | const int NUM_SEGMENTS = 30; | ||
| 1964 | glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z); | 2020 | glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z); |
| 1965 | glColor3f(YELLOW[0], YELLOW[1], YELLOW[2]); | 2021 | glColor3f(YELLOW[0], YELLOW[1], YELLOW[2]); |
| 1966 | renderCircle(haloOrigin, 0.1f, glm::vec3(0.0f, 1.0f, 0.0f), 30); | 2022 | renderCircle(haloOrigin, INDICATOR_RADIUS, IDENTITY_UP, NUM_SEGMENTS); |
| 1967 | } | 2023 | } |
| 1968 | 2024 | ||
| 1969 | void Application::update(float deltaTime) { | 2025 | void Application::update(float deltaTime) { |
| @@ -1993,7 +2049,9 @@ void Application::update(float deltaTime) { · 23 unmodified lines | |||
| 1993 | 2049 | ||
| 1994 | // Set where I am looking based on my mouse ray (so that other people can see) | 2050 | // Set where I am looking based on my mouse ray (so that other people can see) |
| 1995 | glm::vec3 eyePosition; | 2051 | glm::vec3 eyePosition; |
| 1996 | if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition)) { | 2052 | uint16_t ignored; |
| 2053 | _isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, ignored); | ||
| 2054 | if (_isLookingAtOtherAvatar) { | ||
| 1997 | // If the mouse is over another avatar's head... | 2055 | // If the mouse is over another avatar's head... |
| 1998 | glm::vec3 myLookAtFromMouse(eyePosition); | 2056 | glm::vec3 myLookAtFromMouse(eyePosition); |
| 1999 | _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); | 2057 | _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); |
| @@ -2010,7 +2068,7 @@ void Application::update(float deltaTime) { · 10 unmodified lines | |||
| 2010 | glm::vec3 front = orientation * IDENTITY_FRONT; | 2068 | glm::vec3 front = orientation * IDENTITY_FRONT; |
| 2011 | glm::vec3 up = orientation * IDENTITY_UP; | 2069 | glm::vec3 up = orientation * IDENTITY_UP; |
| 2012 | glm::vec3 towardVoxel = getMouseVoxelWorldCoordinates(_mouseVoxelDragging) | 2070 | glm::vec3 towardVoxel = getMouseVoxelWorldCoordinates(_mouseVoxelDragging) |
| 2013 | - _myAvatar.getCameraPosition(); // is this an error? getCameraPosition dne | 2071 | - _myAvatar.getCameraPosition(); |
| 2014 | towardVoxel = front * glm::length(towardVoxel); | 2072 | towardVoxel = front * glm::length(towardVoxel); |
| 2015 | glm::vec3 lateralToVoxel = glm::cross(up, glm::normalize(towardVoxel)) * glm::length(towardVoxel); | 2073 | glm::vec3 lateralToVoxel = glm::cross(up, glm::normalize(towardVoxel)) * glm::length(towardVoxel); |
| 2016 | _voxelThrust = glm::vec3(0, 0, 0); | 2074 | _voxelThrust = glm::vec3(0, 0, 0); |
| @@ -2198,6 +2256,9 @@ void Application::update(float deltaTime) { · 181 unmodified lines | |||
| 2198 | if (_bandwidthDialog) { | 2256 | if (_bandwidthDialog) { |
| 2199 | _bandwidthDialog->update(); | 2257 | _bandwidthDialog->update(); |
| 2200 | } | 2258 | } |
| 2259 | if (_voxelStatsDialog) { | ||
| 2260 | _voxelStatsDialog->update(); | ||
| 2261 | } | ||
| 2201 | 2262 | ||
| 2202 | // Update audio stats for procedural sounds | 2263 | // Update audio stats for procedural sounds |
| 2203 | #ifndef _WIN32 | 2264 | #ifndef _WIN32 |
| @@ -2255,7 +2316,9 @@ void Application::updateAvatar(float deltaTime) { · 51 unmodified lines | |||
| 2255 | _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection); | 2316 | _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection); |
| 2256 | 2317 | ||
| 2257 | glm::vec3 eyePosition; | 2318 | glm::vec3 eyePosition; |
| 2258 | if (_isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition)) { | 2319 | uint16_t ignored; |
| 2320 | _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition, ignored); | ||
| 2321 | if (_isLookingAtOtherAvatar) { | ||
| 2259 | glm::vec3 myLookAtFromMouse(eyePosition); | 2322 | glm::vec3 myLookAtFromMouse(eyePosition); |
| 2260 | _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); | 2323 | _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse); |
| 2261 | } | 2324 | } |
| @@ -2283,7 +2346,7 @@ void Application::updateAvatar(float deltaTime) { · 21 unmodified lines | |||
| 2283 | // actually need to calculate the view frustum planes to send these details | 2346 | // actually need to calculate the view frustum planes to send these details |
| 2284 | // to the server. | 2347 | // to the server. |
| 2285 | loadViewFrustum(_myCamera, _viewFrustum); | 2348 | loadViewFrustum(_myCamera, _viewFrustum); |
| 2286 | _myAvatar.setCameraPosition(_viewFrustum.getPosition()); // setCameraPosition() dne | 2349 | _myAvatar.setCameraPosition(_viewFrustum.getPosition()); |
| 2287 | _myAvatar.setCameraOrientation(_viewFrustum.getOrientation()); | 2350 | _myAvatar.setCameraOrientation(_viewFrustum.getOrientation()); |
| 2288 | _myAvatar.setCameraFov(_viewFrustum.getFieldOfView()); | 2351 | _myAvatar.setCameraFov(_viewFrustum.getFieldOfView()); |
| 2289 | _myAvatar.setCameraAspectRatio(_viewFrustum.getAspectRatio()); | 2352 | _myAvatar.setCameraAspectRatio(_viewFrustum.getAspectRatio()); |
| @@ -2854,27 +2917,19 @@ void Application::displayStats() { · 564 unmodified lines | |||
| 2854 | drawtext(10, statsVerticalOffset + 230, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | 2917 | drawtext(10, statsVerticalOffset + 230, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); |
| 2855 | 2918 | ||
| 2856 | voxelStats.str(""); | 2919 | voxelStats.str(""); |
| 2857 | voxelStats << "Voxels Created: " << _voxels.getVoxelsCreated() / 1000.f << "K (" << _voxels.getVoxelsCreatedPerSecondAverage() / 1000.f | 2920 | char* voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_VOXELS); |
| 2858 | << "Kps) "; | 2921 | voxelStats << "Voxels Sent from Server: " << voxelDetails; |
| 2859 | drawtext(10, statsVerticalOffset + 250, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | 2922 | drawtext(10, statsVerticalOffset + 250, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); |
| 2860 | 2923 | ||
| 2861 | voxelStats.str(""); | 2924 | voxelStats.str(""); |
| 2862 | voxelStats << "Voxels Colored: " << _voxels.getVoxelsColored() / 1000.f << "K (" << _voxels.getVoxelsColoredPerSecondAverage() / 1000.f | 2925 | voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ELAPSED); |
| 2863 | << "Kps) "; | 2926 | voxelStats << "Scene Send Time from Server: " << voxelDetails; |
| 2864 | drawtext(10, statsVerticalOffset + 270, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | 2927 | drawtext(10, statsVerticalOffset + 270, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); |
| 2865 | |||
| 2866 | voxelStats.str(""); | ||
| 2867 | voxelStats << "Voxel Bits Read: " << _voxels.getVoxelsBytesRead() * 8.f / 1000000.f | ||
| 2868 | << "M (" << _voxels.getVoxelsBytesReadPerSecondAverage() * 8.f / 1000000.f << " Mbps)"; | ||
| 2869 | drawtext(10, statsVerticalOffset + 290,0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | ||
| 2870 | 2928 | ||
| 2871 | voxelStats.str(""); | 2929 | voxelStats.str(""); |
| 2872 | float voxelsBytesPerColored = _voxels.getVoxelsColored() | 2930 | voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ENCODE); |
| 2873 | ? ((float) _voxels.getVoxelsBytesRead() / _voxels.getVoxelsColored()) | 2931 | voxelStats << "Encode Time on Server: " << voxelDetails; |
| 2874 | : 0; | 2932 | drawtext(10, statsVerticalOffset + 290, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); |
| 2875 | |||
| 2876 | voxelStats << "Voxels Bits per Colored: " << voxelsBytesPerColored * 8; | ||
| 2877 | drawtext(10, statsVerticalOffset + 310, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | ||
| 2878 | 2933 | ||
| 2879 | Node *avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); | 2934 | Node *avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); |
| 2880 | char avatarMixerStats[200]; | 2935 | char avatarMixerStats[200]; |
| @@ -3433,16 +3488,37 @@ void* Application::networkReceive(void* args) { · 552 unmodified lines | |||
| 3433 | case PACKET_TYPE_VOXEL_DATA_MONOCHROME: | 3488 | case PACKET_TYPE_VOXEL_DATA_MONOCHROME: |
| 3434 | case PACKET_TYPE_Z_COMMAND: | 3489 | case PACKET_TYPE_Z_COMMAND: |
| 3435 | case PACKET_TYPE_ERASE_VOXEL: | 3490 | case PACKET_TYPE_ERASE_VOXEL: |
| 3491 | case PACKET_TYPE_VOXEL_STATS: | ||
| 3436 | case PACKET_TYPE_ENVIRONMENT_DATA: { | 3492 | case PACKET_TYPE_ENVIRONMENT_DATA: { |
| 3493 | |||
| 3494 | unsigned char* messageData = app->_incomingPacket; | ||
| 3495 | ssize_t messageLength = bytesReceived; | ||
| 3496 | |||
| 3497 | // note: PACKET_TYPE_VOXEL_STATS can have PACKET_TYPE_VOXEL_DATA or PACKET_TYPE_VOXEL_DATA_MONOCHROME | ||
| 3498 | // immediately following them inside the same packet. So, we process the PACKET_TYPE_VOXEL_STATS first | ||
| 3499 | // then process any remaining bytes as if it was another packet | ||
| 3500 | if (messageData[0] == PACKET_TYPE_VOXEL_STATS) { | ||
| 3501 | int statsMessageLength = app->_voxelSceneStats.unpackFromMessage(messageData, messageLength); | ||
| 3502 | if (messageLength > statsMessageLength) { | ||
| 3503 | messageData += statsMessageLength; | ||
| 3504 | messageLength -= statsMessageLength; | ||
| 3505 | if (!packetVersionMatch(messageData)) { | ||
| 3506 | break; // bail since piggyback data doesn't match our versioning | ||
| 3507 | } | ||
| 3508 | } else { | ||
| 3509 | break; // bail since no piggyback data | ||
| 3510 | } | ||
| 3511 | } // fall through to piggyback message | ||
| 3512 | |||
| 3437 | if (app->_renderVoxels->isChecked()) { | 3513 | if (app->_renderVoxels->isChecked()) { |
| 3438 | Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); | 3514 | Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); |
| 3439 | if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) { | 3515 | if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) { |
| 3440 | voxelServer->lock(); | 3516 | voxelServer->lock(); |
| 3441 | 3517 | ||
| 3442 | if (app->_incomingPacket[0] == PACKET_TYPE_ENVIRONMENT_DATA) { | 3518 | if (messageData[0] == PACKET_TYPE_ENVIRONMENT_DATA) { |
| 3443 | app->_environment.parseData(&senderAddress, app->_incomingPacket, bytesReceived); | 3519 | app->_environment.parseData(&senderAddress, messageData, messageLength); |
| 3444 | } else { | 3520 | } else { |
| 3445 | app->_voxels.parseData(app->_incomingPacket, bytesReceived); | 3521 | app->_voxels.parseData(messageData, messageLength); |
| 3446 | } | 3522 | } |
| 3447 | 3523 | ||
| 3448 | voxelServer->unlock(); | 3524 | voxelServer->unlock(); |