From 7fb872c1d7f31ae6bbeb98930a702e77a17e9a2b Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Sat, 8 Mar 2014 23:53:44 -0800 Subject: [PATCH] remove dead VoxelSceneStats class and clean up Voxel Stats to be OctreeStats --- interface/src/Application.cpp | 36 ++++++------- interface/src/Application.h | 12 ++--- interface/src/Menu.cpp | 26 +++++----- interface/src/Menu.h | 12 ++--- ...lStatsDialog.cpp => OctreeStatsDialog.cpp} | 50 +++++++++---------- ...VoxelStatsDialog.h => OctreeStatsDialog.h} | 18 +++---- 6 files changed, 77 insertions(+), 77 deletions(-) rename interface/src/ui/{VoxelStatsDialog.cpp => OctreeStatsDialog.cpp} (90%) rename interface/src/ui/{VoxelStatsDialog.h => OctreeStatsDialog.h} (78%) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 28285cd7da..a2ab5fcb2a 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -60,7 +60,7 @@ #include #include #include -#include +#include #include #include "Application.h" @@ -1825,9 +1825,9 @@ void Application::updateDialogs(float deltaTime) { bandwidthDialog->update(); } - VoxelStatsDialog* voxelStatsDialog = Menu::getInstance()->getVoxelStatsDialog(); - if (voxelStatsDialog) { - voxelStatsDialog->update(); + OctreeStatsDialog* octreeStatsDialog = Menu::getInstance()->getOctreeStatsDialog(); + if (octreeStatsDialog) { + octreeStatsDialog->update(); } } @@ -2733,9 +2733,9 @@ void Application::displayStats() { unsigned long totalNodes = 0; unsigned long totalInternal = 0; unsigned long totalLeaves = 0; - for(NodeToVoxelSceneStatsIterator i = _octreeServerSceneStats.begin(); i != _octreeServerSceneStats.end(); i++) { + for(NodeToOctreeSceneStatsIterator i = _octreeServerSceneStats.begin(); i != _octreeServerSceneStats.end(); i++) { //const QUuid& uuid = i->first; - VoxelSceneStats& stats = i->second; + OctreeSceneStats& stats = i->second; serverCount++; if (_statsExpanded) { if (serverCount > 1) { @@ -3288,11 +3288,11 @@ void Application::nodeKilled(SharedNodePointer node) { } // also clean up scene stats for that server - _voxelSceneStatsLock.lockForWrite(); + _octreeSceneStatsLock.lockForWrite(); if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) { _octreeServerSceneStats.erase(nodeUUID); } - _voxelSceneStatsLock.unlock(); + _octreeSceneStatsLock.unlock(); } else if (node->getType() == NodeType::ParticleServer) { QUuid nodeUUID = node->getUUID(); @@ -3319,11 +3319,11 @@ void Application::nodeKilled(SharedNodePointer node) { } // also clean up scene stats for that server - _voxelSceneStatsLock.lockForWrite(); + _octreeSceneStatsLock.lockForWrite(); if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) { _octreeServerSceneStats.erase(nodeUUID); } - _voxelSceneStatsLock.unlock(); + _octreeSceneStatsLock.unlock(); } else if (node->getType() == NodeType::AvatarMixer) { // our avatar mixer has gone away - clear the hash of avatars @@ -3338,12 +3338,12 @@ void Application::trackIncomingVoxelPacket(const QByteArray& packet, const Share QUuid nodeUUID = sendingNode->getUUID(); // now that we know the node ID, let's add these stats to the stats for that node... - _voxelSceneStatsLock.lockForWrite(); + _octreeSceneStatsLock.lockForWrite(); if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) { - VoxelSceneStats& stats = _octreeServerSceneStats[nodeUUID]; + OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID]; stats.trackIncomingOctreePacket(packet, wasStatsPacket, sendingNode->getClockSkewUsec()); } - _voxelSceneStatsLock.unlock(); + _octreeSceneStatsLock.unlock(); } } @@ -3353,7 +3353,7 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin // parse the incoming stats datas stick it in a temporary object for now, while we // determine which server it belongs to - VoxelSceneStats temp; + OctreeSceneStats temp; int statsMessageLength = temp.unpackFromMessage(reinterpret_cast(packet.data()), packet.size()); // quick fix for crash... why would voxelServer be NULL? @@ -3361,14 +3361,14 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin QUuid nodeUUID = sendingNode->getUUID(); // now that we know the node ID, let's add these stats to the stats for that node... - _voxelSceneStatsLock.lockForWrite(); + _octreeSceneStatsLock.lockForWrite(); if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) { _octreeServerSceneStats[nodeUUID].unpackFromMessage(reinterpret_cast(packet.data()), packet.size()); } else { _octreeServerSceneStats[nodeUUID] = temp; } - _voxelSceneStatsLock.unlock(); + _octreeSceneStatsLock.unlock(); VoxelPositionSize rootDetails; voxelDetailsForCode(temp.getJurisdictionRoot(), rootDetails); @@ -3397,8 +3397,8 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin } // store jurisdiction details for later use // This is bit of fiddling is because JurisdictionMap assumes it is the owner of the values used to construct it - // but VoxelSceneStats thinks it's just returning a reference to it's contents. So we need to make a copy of the - // details from the VoxelSceneStats to construct the JurisdictionMap + // but OctreeSceneStats thinks it's just returning a reference to it's contents. So we need to make a copy of the + // details from the OctreeSceneStats to construct the JurisdictionMap JurisdictionMap jurisdictionMap; jurisdictionMap.copyContents(temp.getJurisdictionRoot(), temp.getJurisdictionEndNodes()); (*jurisdiction)[nodeUUID] = jurisdictionMap; diff --git a/interface/src/Application.h b/interface/src/Application.h index a93d3d1352..234f264447 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -65,7 +65,7 @@ #include "renderer/VoxelShader.h" #include "ui/BandwidthDialog.h" #include "ui/ChatEntry.h" -#include "ui/VoxelStatsDialog.h" +#include "ui/OctreeStatsDialog.h" #include "ui/RearMirrorTools.h" #include "ui/LodToolsDialog.h" #include "ui/LogDialog.h" @@ -170,9 +170,9 @@ public: BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; } QSettings* getSettings() { return _settings; } QMainWindow* getWindow() { return _window; } - NodeToVoxelSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; } - void lockVoxelSceneStats() { _voxelSceneStatsLock.lockForRead(); } - void unlockVoxelSceneStats() { _voxelSceneStatsLock.unlock(); } + NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; } + void lockOctreeSceneStats() { _octreeSceneStatsLock.lockForRead(); } + void unlockOctreeSceneStats() { _octreeSceneStatsLock.unlock(); } QNetworkAccessManager* getNetworkAccessManager() { return _networkAccessManager; } GeometryCache* getGeometryCache() { return &_geometryCache; } @@ -459,8 +459,8 @@ private: NodeToJurisdictionMap _voxelServerJurisdictions; NodeToJurisdictionMap _particleServerJurisdictions; - NodeToVoxelSceneStats _octreeServerSceneStats; - QReadWriteLock _voxelSceneStatsLock; + NodeToOctreeSceneStats _octreeServerSceneStats; + QReadWriteLock _octreeSceneStatsLock; std::vector _voxelFades; ControllerScriptingInterface _controllerScriptingInterface; diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 0674826342..e4fa0c49e0 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -66,7 +66,7 @@ Menu::Menu() : _faceshiftEyeDeflection(DEFAULT_FACESHIFT_EYE_DEFLECTION), _frustumDrawMode(FRUSTUM_DRAW_MODE_ALL), _viewFrustumOffset(DEFAULT_FRUSTUM_OFFSET), - _voxelStatsDialog(NULL), + _octreeStatsDialog(NULL), _lodToolsDialog(NULL), _maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM), _voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE), @@ -213,7 +213,7 @@ Menu::Menu() : addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Oscilloscope, 0, true); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Bandwidth, 0, true); addActionToQMenuAndActionHash(viewMenu, MenuOption::BandwidthDetails, 0, this, SLOT(bandwidthDetails())); - addActionToQMenuAndActionHash(viewMenu, MenuOption::VoxelStats, 0, this, SLOT(voxelStatsDetails())); + addActionToQMenuAndActionHash(viewMenu, MenuOption::OctreeStats, 0, this, SLOT(octreeStatsDetails())); QMenu* developerMenu = addMenu("Developer"); @@ -341,7 +341,7 @@ Menu::Menu() : Menu::~Menu() { bandwidthDetailsClosed(); - voxelStatsDetailsClosed(); + octreeStatsDetailsClosed(); } void Menu::loadSettings(QSettings* settings) { @@ -1033,20 +1033,20 @@ void Menu::bandwidthDetailsClosed() { } } -void Menu::voxelStatsDetails() { - if (!_voxelStatsDialog) { - _voxelStatsDialog = new VoxelStatsDialog(Application::getInstance()->getGLWidget(), +void Menu::octreeStatsDetails() { + if (!_octreeStatsDialog) { + _octreeStatsDialog = new OctreeStatsDialog(Application::getInstance()->getGLWidget(), Application::getInstance()->getOcteeSceneStats()); - connect(_voxelStatsDialog, SIGNAL(closed()), SLOT(voxelStatsDetailsClosed())); - _voxelStatsDialog->show(); + connect(_octreeStatsDialog, SIGNAL(closed()), SLOT(octreeStatsDetailsClosed())); + _octreeStatsDialog->show(); } - _voxelStatsDialog->raise(); + _octreeStatsDialog->raise(); } -void Menu::voxelStatsDetailsClosed() { - if (_voxelStatsDialog) { - delete _voxelStatsDialog; - _voxelStatsDialog = NULL; +void Menu::octreeStatsDetailsClosed() { + if (_octreeStatsDialog) { + delete _octreeStatsDialog; + _octreeStatsDialog = NULL; } } diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 204b93dd4a..d8a7672972 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -53,7 +53,7 @@ class QSettings; class BandwidthDialog; class LodToolsDialog; class MetavoxelEditor; -class VoxelStatsDialog; +class OctreeStatsDialog; class MenuItemProperties; class Menu : public QMenuBar { @@ -73,7 +73,7 @@ public: BandwidthDialog* getBandwidthDialog() const { return _bandwidthDialog; } FrustumDrawMode getFrustumDrawMode() const { return _frustumDrawMode; } ViewFrustumOffset getViewFrustumOffset() const { return _viewFrustumOffset; } - VoxelStatsDialog* getVoxelStatsDialog() const { return _voxelStatsDialog; } + OctreeStatsDialog* getOctreeStatsDialog() const { return _octreeStatsDialog; } LodToolsDialog* getLodToolsDialog() const { return _lodToolsDialog; } int getMaxVoxels() const { return _maxVoxels; } QAction* getUseVoxelShader() const { return _useVoxelShader; } @@ -111,7 +111,7 @@ public slots: void loginForCurrentDomain(); void bandwidthDetails(); - void voxelStatsDetails(); + void octreeStatsDetails(); void lodTools(); void loadSettings(QSettings* settings = NULL); void saveSettings(QSettings* settings = NULL); @@ -135,7 +135,7 @@ private slots: void goToDomainDialog(); void goToLocation(); void bandwidthDetailsClosed(); - void voxelStatsDetailsClosed(); + void octreeStatsDetailsClosed(); void lodToolsClosed(); void cycleFrustumRenderMode(); void runTests(); @@ -187,7 +187,7 @@ private: FrustumDrawMode _frustumDrawMode; ViewFrustumOffset _viewFrustumOffset; QPointer _MetavoxelEditor; - VoxelStatsDialog* _voxelStatsDialog; + OctreeStatsDialog* _octreeStatsDialog; LodToolsDialog* _lodToolsDialog; int _maxVoxels; float _voxelSizeScale; @@ -286,7 +286,7 @@ namespace MenuOption { const QString Quit = "Quit"; const QString Voxels = "Voxels"; const QString VoxelMode = "Cycle Voxel Mode"; - const QString VoxelStats = "Voxel Stats"; + const QString OctreeStats = "Voxel and Particle Statistics"; const QString VoxelTextures = "Voxel Textures"; } diff --git a/interface/src/ui/VoxelStatsDialog.cpp b/interface/src/ui/OctreeStatsDialog.cpp similarity index 90% rename from interface/src/ui/VoxelStatsDialog.cpp rename to interface/src/ui/OctreeStatsDialog.cpp index 0ac0a2b933..974964da04 100644 --- a/interface/src/ui/VoxelStatsDialog.cpp +++ b/interface/src/ui/OctreeStatsDialog.cpp @@ -1,5 +1,5 @@ // -// VoxelStatsDialog.cpp +// OctreeStatsDialog.cpp // interface // // Created by Brad Hefta-Gaub on 7/19/13. @@ -14,13 +14,13 @@ #include #include -#include +#include #include "Application.h" -#include "ui/VoxelStatsDialog.h" +#include "ui/OctreeStatsDialog.h" -VoxelStatsDialog::VoxelStatsDialog(QWidget* parent, NodeToVoxelSceneStats* model) : +OctreeStatsDialog::OctreeStatsDialog(QWidget* parent, NodeToOctreeSceneStats* model) : QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint), _model(model) { @@ -52,7 +52,7 @@ VoxelStatsDialog::VoxelStatsDialog(QWidget* parent, NodeToVoxelSceneStats* model layout()->setSizeConstraint(QLayout::SetFixedSize); } -void VoxelStatsDialog::RemoveStatItem(int item) { +void OctreeStatsDialog::RemoveStatItem(int item) { QLabel* myLabel = _labels[item]; QWidget* automaticLabel = _form->labelForField(myLabel); _form->removeWidget(myLabel); @@ -62,7 +62,7 @@ void VoxelStatsDialog::RemoveStatItem(int item) { _labels[item] = NULL; } -void VoxelStatsDialog::moreless(const QString& link) { +void OctreeStatsDialog::moreless(const QString& link) { QStringList linkDetails = link.split("-"); const int COMMAND_ITEM = 0; const int SERVER_NUMBER_ITEM = 1; @@ -80,7 +80,7 @@ void VoxelStatsDialog::moreless(const QString& link) { } -int VoxelStatsDialog::AddStatItem(const char* caption, unsigned colorRGBA) { +int OctreeStatsDialog::AddStatItem(const char* caption, unsigned colorRGBA) { char strBuf[64]; const int STATS_LABEL_WIDTH = 600; @@ -109,13 +109,13 @@ int VoxelStatsDialog::AddStatItem(const char* caption, unsigned colorRGBA) { return _statCount; } -VoxelStatsDialog::~VoxelStatsDialog() { +OctreeStatsDialog::~OctreeStatsDialog() { for (int i = 0; i < _statCount; i++) { delete _labels[i]; } } -void VoxelStatsDialog::paintEvent(QPaintEvent* event) { +void OctreeStatsDialog::paintEvent(QPaintEvent* event) { // Update labels @@ -171,11 +171,11 @@ void VoxelStatsDialog::paintEvent(QPaintEvent* event) { unsigned long totalInternal = 0; unsigned long totalLeaves = 0; - Application::getInstance()->lockVoxelSceneStats(); - NodeToVoxelSceneStats* sceneStats = Application::getInstance()->getOcteeSceneStats(); - for(NodeToVoxelSceneStatsIterator i = sceneStats->begin(); i != sceneStats->end(); i++) { + Application::getInstance()->lockOctreeSceneStats(); + NodeToOctreeSceneStats* sceneStats = Application::getInstance()->getOcteeSceneStats(); + for(NodeToOctreeSceneStatsIterator i = sceneStats->begin(); i != sceneStats->end(); i++) { //const QUuid& uuid = i->first; - VoxelSceneStats& stats = i->second; + OctreeSceneStats& stats = i->second; serverCount++; // calculate server node totals @@ -194,7 +194,7 @@ void VoxelStatsDialog::paintEvent(QPaintEvent* event) { sendingMode << "S"; } } - Application::getInstance()->unlockVoxelSceneStats(); + Application::getInstance()->unlockOctreeSceneStats(); sendingMode << " - " << serverCount << " servers"; if (movingServerCount > 0) { sendingMode << " "; @@ -221,7 +221,7 @@ void VoxelStatsDialog::paintEvent(QPaintEvent* event) { this->QDialog::paintEvent(event); } -void VoxelStatsDialog::showAllOctreeServers() { +void OctreeStatsDialog::showAllOctreeServers() { int serverCount = 0; showOctreeServersOfType(serverCount, NodeType::VoxelServer, "Voxel", @@ -239,7 +239,7 @@ void VoxelStatsDialog::showAllOctreeServers() { } } -void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serverType, const char* serverTypeName, +void OctreeStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serverType, const char* serverTypeName, NodeToJurisdictionMap& serverJurisdictions) { QLocale locale(QLocale::English); @@ -303,10 +303,10 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serv // now lookup stats details for this server... if (_extraServerDetails[serverCount-1] != LESS) { - Application::getInstance()->lockVoxelSceneStats(); - NodeToVoxelSceneStats* sceneStats = Application::getInstance()->getOcteeSceneStats(); + Application::getInstance()->lockOctreeSceneStats(); + NodeToOctreeSceneStats* sceneStats = Application::getInstance()->getOcteeSceneStats(); if (sceneStats->find(nodeUUID) != sceneStats->end()) { - VoxelSceneStats& stats = sceneStats->at(nodeUUID); + OctreeSceneStats& stats = sceneStats->at(nodeUUID); switch (_extraServerDetails[serverCount-1]) { case MOST: { @@ -323,9 +323,9 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serv "Encode Time: " << lastFullEncodeString.toLocal8Bit().constData() << " ms " << "Send Time: " << lastFullSendString.toLocal8Bit().constData() << " ms "; - for (int i = 0; i < VoxelSceneStats::ITEM_COUNT; i++) { - VoxelSceneStats::Item item = (VoxelSceneStats::Item)(i); - VoxelSceneStats::ItemInfo& itemInfo = stats.getItemInfo(item); + for (int i = 0; i < OctreeSceneStats::ITEM_COUNT; i++) { + OctreeSceneStats::Item item = (OctreeSceneStats::Item)(i); + OctreeSceneStats::ItemInfo& itemInfo = stats.getItemInfo(item); extraDetails << "
" << itemInfo.caption << " " << stats.getItemValue(item); } } // fall through... since MOST has all of MORE @@ -386,7 +386,7 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serv } break; } } - Application::getInstance()->unlockVoxelSceneStats(); + Application::getInstance()->unlockOctreeSceneStats(); } else { linkDetails << " " << " [more...]"; linkDetails << " " << " [most...]"; @@ -397,12 +397,12 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serv } } -void VoxelStatsDialog::reject() { +void OctreeStatsDialog::reject() { // Just regularly close upon ESC this->QDialog::close(); } -void VoxelStatsDialog::closeEvent(QCloseEvent* event) { +void OctreeStatsDialog::closeEvent(QCloseEvent* event) { this->QDialog::closeEvent(event); emit closed(); } diff --git a/interface/src/ui/VoxelStatsDialog.h b/interface/src/ui/OctreeStatsDialog.h similarity index 78% rename from interface/src/ui/VoxelStatsDialog.h rename to interface/src/ui/OctreeStatsDialog.h index f3a54241b5..ef190e6a52 100644 --- a/interface/src/ui/VoxelStatsDialog.h +++ b/interface/src/ui/OctreeStatsDialog.h @@ -1,30 +1,30 @@ // -// VoxelStatsDialog.h +// OctreeStatsDialog.h // interface // // Created by Brad Hefta-Gaub on 7/19/13. // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. // -#ifndef __hifi__VoxelStatsDialog__ -#define __hifi__VoxelStatsDialog__ +#ifndef __hifi__OctreeStatsDialog__ +#define __hifi__OctreeStatsDialog__ #include #include #include -#include +#include #define MAX_STATS 100 #define MAX_VOXEL_SERVERS 50 #define DEFAULT_COLOR 0 -class VoxelStatsDialog : public QDialog { +class OctreeStatsDialog : public QDialog { Q_OBJECT public: // Sets up the UI - VoxelStatsDialog(QWidget* parent, NodeToVoxelSceneStats* model); - ~VoxelStatsDialog(); + OctreeStatsDialog(QWidget* parent, NodeToOctreeSceneStats* model); + ~OctreeStatsDialog(); signals: void closed(); @@ -53,7 +53,7 @@ private: QFormLayout* _form; QLabel* _labels[MAX_STATS]; - NodeToVoxelSceneStats* _model; + NodeToOctreeSceneStats* _model; int _statCount; int _sendingMode; @@ -66,5 +66,5 @@ private: details _extraServerDetails[MAX_VOXEL_SERVERS]; }; -#endif /* defined(__interface__VoxelStatsDialog__) */ +#endif /* defined(__interface__OctreeStatsDialog__) */