Showing the changes to interface/src/Application.cpp (1 of 16 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), |
| @@ -1147,6 +1150,21 @@ void Application::bandwidthDetailsClosed() { · 967 unmodified lines | |||
| 1147 | delete dlg; | 1150 | delete dlg; |
| 1148 | } | 1151 | } |
| 1149 | 1152 | ||
| 1153 | void Application::voxelStatsDetails() { | ||
| 1154 | if (!_voxelStatsDialog) { | ||
| 1155 | _voxelStatsDialog = new VoxelStatsDialog(_glWidget, &_voxelSceneStats); | ||
| 1156 | connect(_voxelStatsDialog, SIGNAL(closed()), SLOT(voxelStatsDetailsClosed())); | ||
| 1157 | _voxelStatsDialog->show(); | ||
| 1158 | } | ||
| 1159 | _voxelStatsDialog->raise(); | ||
| 1160 | } | ||
| 1161 | |||
| 1162 | void Application::voxelStatsDetailsClosed() { | ||
| 1163 | QDialog* dlg = _voxelStatsDialog; | ||
| 1164 | _voxelStatsDialog = NULL; | ||
| 1165 | delete dlg; | ||
| 1166 | } | ||
| 1167 | |||
| 1150 | void Application::editPreferences() { | 1168 | void Application::editPreferences() { |
| 1151 | QDialog dialog(_glWidget); | 1169 | QDialog dialog(_glWidget); |
| 1152 | dialog.setWindowTitle("Interface Preferences"); | 1170 | dialog.setWindowTitle("Interface Preferences"); |
| @@ -1751,6 +1769,7 @@ void Application::initMenu() { · 598 unmodified lines | |||
| 1751 | (_bandwidthDisplayOn = toolsMenu->addAction("Bandwidth Display"))->setCheckable(true); | 1769 | (_bandwidthDisplayOn = toolsMenu->addAction("Bandwidth Display"))->setCheckable(true); |
| 1752 | _bandwidthDisplayOn->setChecked(true); | 1770 | _bandwidthDisplayOn->setChecked(true); |
| 1753 | toolsMenu->addAction("Bandwidth Details", this, SLOT(bandwidthDetails())); | 1771 | toolsMenu->addAction("Bandwidth Details", this, SLOT(bandwidthDetails())); |
| 1772 | toolsMenu->addAction("Voxel Stats Details", this, SLOT(voxelStatsDetails())); | ||
| 1754 | 1773 | ||
| 1755 | 1774 | ||
| 1756 | QMenu* voxelMenu = menuBar->addMenu("Voxels"); | 1775 | QMenu* voxelMenu = menuBar->addMenu("Voxels"); |
| @@ -2226,6 +2245,9 @@ void Application::update(float deltaTime) { · 469 unmodified lines | |||
| 2226 | if (_bandwidthDialog) { | 2245 | if (_bandwidthDialog) { |
| 2227 | _bandwidthDialog->update(); | 2246 | _bandwidthDialog->update(); |
| 2228 | } | 2247 | } |
| 2248 | if (_voxelStatsDialog) { | ||
| 2249 | _voxelStatsDialog->update(); | ||
| 2250 | } | ||
| 2229 | 2251 | ||
| 2230 | // Update audio stats for procedural sounds | 2252 | // Update audio stats for procedural sounds |
| 2231 | #ifndef _WIN32 | 2253 | #ifndef _WIN32 |
| @@ -2880,27 +2902,19 @@ void Application::displayStats() { · 648 unmodified lines | |||
| 2880 | drawtext(10, statsVerticalOffset + 230, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | 2902 | drawtext(10, statsVerticalOffset + 230, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); |
| 2881 | 2903 | ||
| 2882 | voxelStats.str(""); | 2904 | voxelStats.str(""); |
| 2883 | voxelStats << "Voxels Created: " << _voxels.getVoxelsCreated() / 1000.f << "K (" << _voxels.getVoxelsCreatedPerSecondAverage() / 1000.f | 2905 | char* voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_VOXELS); |
| 2884 | << "Kps) "; | 2906 | voxelStats << "Voxels Sent from Server: " << voxelDetails; |
| 2885 | drawtext(10, statsVerticalOffset + 250, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | 2907 | drawtext(10, statsVerticalOffset + 250, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); |
| 2886 | 2908 | ||
| 2887 | voxelStats.str(""); | 2909 | voxelStats.str(""); |
| 2888 | voxelStats << "Voxels Colored: " << _voxels.getVoxelsColored() / 1000.f << "K (" << _voxels.getVoxelsColoredPerSecondAverage() / 1000.f | 2910 | voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ELAPSED); |
| 2889 | << "Kps) "; | 2911 | voxelStats << "Scene Send Time from Server: " << voxelDetails; |
| 2890 | drawtext(10, statsVerticalOffset + 270, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | 2912 | drawtext(10, statsVerticalOffset + 270, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); |
| 2891 | |||
| 2892 | voxelStats.str(""); | ||
| 2893 | voxelStats << "Voxel Bits Read: " << _voxels.getVoxelsBytesRead() * 8.f / 1000000.f | ||
| 2894 | << "M (" << _voxels.getVoxelsBytesReadPerSecondAverage() * 8.f / 1000000.f << " Mbps)"; | ||
| 2895 | drawtext(10, statsVerticalOffset + 290,0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | ||
| 2896 | 2913 | ||
| 2897 | voxelStats.str(""); | 2914 | voxelStats.str(""); |
| 2898 | float voxelsBytesPerColored = _voxels.getVoxelsColored() | 2915 | voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ENCODE); |
| 2899 | ? ((float) _voxels.getVoxelsBytesRead() / _voxels.getVoxelsColored()) | 2916 | voxelStats << "Encode Time on Server: " << voxelDetails; |
| 2900 | : 0; | 2917 | drawtext(10, statsVerticalOffset + 290, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); |
| 2901 | |||
| 2902 | voxelStats << "Voxels Bits per Colored: " << voxelsBytesPerColored * 8; | ||
| 2903 | drawtext(10, statsVerticalOffset + 310, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str()); | ||
| 2904 | 2918 | ||
| 2905 | Node *avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); | 2919 | Node *avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); |
| 2906 | char avatarMixerStats[200]; | 2920 | char avatarMixerStats[200]; |
| @@ -3455,16 +3469,37 @@ void* Application::networkReceive(void* args) { · 548 unmodified lines | |||
| 3455 | case PACKET_TYPE_VOXEL_DATA_MONOCHROME: | 3469 | case PACKET_TYPE_VOXEL_DATA_MONOCHROME: |
| 3456 | case PACKET_TYPE_Z_COMMAND: | 3470 | case PACKET_TYPE_Z_COMMAND: |
| 3457 | case PACKET_TYPE_ERASE_VOXEL: | 3471 | case PACKET_TYPE_ERASE_VOXEL: |
| 3472 | case PACKET_TYPE_VOXEL_STATS: | ||
| 3458 | case PACKET_TYPE_ENVIRONMENT_DATA: { | 3473 | case PACKET_TYPE_ENVIRONMENT_DATA: { |
| 3474 | |||
| 3475 | unsigned char* messageData = app->_incomingPacket; | ||
| 3476 | ssize_t messageLength = bytesReceived; | ||
| 3477 | |||
| 3478 | // note: PACKET_TYPE_VOXEL_STATS can have PACKET_TYPE_VOXEL_DATA or PACKET_TYPE_VOXEL_DATA_MONOCHROME | ||
| 3479 | // immediately following them inside the same packet. So, we process the PACKET_TYPE_VOXEL_STATS first | ||
| 3480 | // then process any remaining bytes as if it was another packet | ||
| 3481 | if (messageData[0] == PACKET_TYPE_VOXEL_STATS) { | ||
| 3482 | int statsMessageLength = app->_voxelSceneStats.unpackFromMessage(messageData, messageLength); | ||
| 3483 | if (messageLength > statsMessageLength) { | ||
| 3484 | messageData += statsMessageLength; | ||
| 3485 | messageLength -= statsMessageLength; | ||
| 3486 | if (!packetVersionMatch(messageData)) { | ||
| 3487 | break; // bail since piggyback data doesn't match our versioning | ||
| 3488 | } | ||
| 3489 | } else { | ||
| 3490 | break; // bail since no piggyback data | ||
| 3491 | } | ||
| 3492 | } // fall through to piggyback message | ||
| 3493 | |||
| 3459 | if (app->_renderVoxels->isChecked()) { | 3494 | if (app->_renderVoxels->isChecked()) { |
| 3460 | Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); | 3495 | Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); |
| 3461 | if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) { | 3496 | if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) { |
| 3462 | voxelServer->lock(); | 3497 | voxelServer->lock(); |
| 3463 | 3498 | ||
| 3464 | if (app->_incomingPacket[0] == PACKET_TYPE_ENVIRONMENT_DATA) { | 3499 | if (messageData[0] == PACKET_TYPE_ENVIRONMENT_DATA) { |
| 3465 | app->_environment.parseData(&senderAddress, app->_incomingPacket, bytesReceived); | 3500 | app->_environment.parseData(&senderAddress, messageData, messageLength); |
| 3466 | } else { | 3501 | } else { |
| 3467 | app->_voxels.parseData(app->_incomingPacket, bytesReceived); | 3502 | app->_voxels.parseData(messageData, messageLength); |
| 3468 | } | 3503 | } |
| 3469 | 3504 | ||
| 3470 | voxelServer->unlock(); | 3505 | voxelServer->unlock(); |