Merge pull request #2245 from ZappoMan/cruft_cleanup

Cruft cleanup
This commit is contained in:
Stephen Birarda 2014-03-11 09:45:40 -07:00
commit 2f95f3b3a2
20 changed files with 127 additions and 173 deletions

View file

@ -15,7 +15,14 @@
OctreeQueryNode::OctreeQueryNode() : OctreeQueryNode::OctreeQueryNode() :
_viewSent(false), _viewSent(false),
_octreePacket(new unsigned char[MAX_PACKET_SIZE]),
_octreePacketAt(_octreePacket),
_octreePacketAvailableBytes(MAX_PACKET_SIZE), _octreePacketAvailableBytes(MAX_PACKET_SIZE),
_octreePacketWaiting(false),
_lastOctreePacket(new unsigned char[MAX_PACKET_SIZE]),
_lastOctreePacketLength(0),
_duplicatePacketCount(0),
_firstSuppressedPacket(usecTimestampNow()),
_maxSearchLevel(1), _maxSearchLevel(1),
_maxLevelReachedInLastSearch(1), _maxLevelReachedInLastSearch(1),
_lastTimeBagEmpty(0), _lastTimeBagEmpty(0),
@ -27,14 +34,9 @@ OctreeQueryNode::OctreeQueryNode() :
_lastClientBoundaryLevelAdjust(0), _lastClientBoundaryLevelAdjust(0),
_lastClientOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE), _lastClientOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
_lodChanged(false), _lodChanged(false),
_lodInitialized(false) _lodInitialized(false),
_sequenceNumber(0)
{ {
_octreePacket = new unsigned char[MAX_PACKET_SIZE];
_octreePacketAt = _octreePacket;
_lastOctreePacket = new unsigned char[MAX_PACKET_SIZE];
_lastOctreePacketLength = 0;
_duplicatePacketCount = 0;
_sequenceNumber = 0;
} }
OctreeQueryNode::~OctreeQueryNode() { OctreeQueryNode::~OctreeQueryNode() {

View file

@ -60,7 +60,7 @@
#include <PerfStat.h> #include <PerfStat.h>
#include <ResourceCache.h> #include <ResourceCache.h>
#include <UUID.h> #include <UUID.h>
#include <VoxelSceneStats.h> #include <OctreeSceneStats.h>
#include <LocalVoxelsList.h> #include <LocalVoxelsList.h>
#include "Application.h" #include "Application.h"
@ -1825,9 +1825,9 @@ void Application::updateDialogs(float deltaTime) {
bandwidthDialog->update(); bandwidthDialog->update();
} }
VoxelStatsDialog* voxelStatsDialog = Menu::getInstance()->getVoxelStatsDialog(); OctreeStatsDialog* octreeStatsDialog = Menu::getInstance()->getOctreeStatsDialog();
if (voxelStatsDialog) { if (octreeStatsDialog) {
voxelStatsDialog->update(); octreeStatsDialog->update();
} }
} }
@ -2733,9 +2733,9 @@ void Application::displayStats() {
unsigned long totalNodes = 0; unsigned long totalNodes = 0;
unsigned long totalInternal = 0; unsigned long totalInternal = 0;
unsigned long totalLeaves = 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; //const QUuid& uuid = i->first;
VoxelSceneStats& stats = i->second; OctreeSceneStats& stats = i->second;
serverCount++; serverCount++;
if (_statsExpanded) { if (_statsExpanded) {
if (serverCount > 1) { if (serverCount > 1) {
@ -3288,11 +3288,11 @@ void Application::nodeKilled(SharedNodePointer node) {
} }
// also clean up scene stats for that server // also clean up scene stats for that server
_voxelSceneStatsLock.lockForWrite(); _octreeSceneStatsLock.lockForWrite();
if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) { if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {
_octreeServerSceneStats.erase(nodeUUID); _octreeServerSceneStats.erase(nodeUUID);
} }
_voxelSceneStatsLock.unlock(); _octreeSceneStatsLock.unlock();
} else if (node->getType() == NodeType::ParticleServer) { } else if (node->getType() == NodeType::ParticleServer) {
QUuid nodeUUID = node->getUUID(); QUuid nodeUUID = node->getUUID();
@ -3319,11 +3319,11 @@ void Application::nodeKilled(SharedNodePointer node) {
} }
// also clean up scene stats for that server // also clean up scene stats for that server
_voxelSceneStatsLock.lockForWrite(); _octreeSceneStatsLock.lockForWrite();
if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) { if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {
_octreeServerSceneStats.erase(nodeUUID); _octreeServerSceneStats.erase(nodeUUID);
} }
_voxelSceneStatsLock.unlock(); _octreeSceneStatsLock.unlock();
} else if (node->getType() == NodeType::AvatarMixer) { } else if (node->getType() == NodeType::AvatarMixer) {
// our avatar mixer has gone away - clear the hash of avatars // 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(); QUuid nodeUUID = sendingNode->getUUID();
// now that we know the node ID, let's add these stats to the stats for that node... // 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()) { if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {
VoxelSceneStats& stats = _octreeServerSceneStats[nodeUUID]; OctreeSceneStats& stats = _octreeServerSceneStats[nodeUUID];
stats.trackIncomingOctreePacket(packet, wasStatsPacket, sendingNode->getClockSkewUsec()); 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 // parse the incoming stats datas stick it in a temporary object for now, while we
// determine which server it belongs to // determine which server it belongs to
VoxelSceneStats temp; OctreeSceneStats temp;
int statsMessageLength = temp.unpackFromMessage(reinterpret_cast<const unsigned char*>(packet.data()), packet.size()); int statsMessageLength = temp.unpackFromMessage(reinterpret_cast<const unsigned char*>(packet.data()), packet.size());
// quick fix for crash... why would voxelServer be NULL? // 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(); QUuid nodeUUID = sendingNode->getUUID();
// now that we know the node ID, let's add these stats to the stats for that node... // 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()) { if (_octreeServerSceneStats.find(nodeUUID) != _octreeServerSceneStats.end()) {
_octreeServerSceneStats[nodeUUID].unpackFromMessage(reinterpret_cast<const unsigned char*>(packet.data()), _octreeServerSceneStats[nodeUUID].unpackFromMessage(reinterpret_cast<const unsigned char*>(packet.data()),
packet.size()); packet.size());
} else { } else {
_octreeServerSceneStats[nodeUUID] = temp; _octreeServerSceneStats[nodeUUID] = temp;
} }
_voxelSceneStatsLock.unlock(); _octreeSceneStatsLock.unlock();
VoxelPositionSize rootDetails; VoxelPositionSize rootDetails;
voxelDetailsForCode(temp.getJurisdictionRoot(), rootDetails); voxelDetailsForCode(temp.getJurisdictionRoot(), rootDetails);
@ -3397,8 +3397,8 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin
} }
// store jurisdiction details for later use // 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 // 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 // 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 VoxelSceneStats to construct the JurisdictionMap // details from the OctreeSceneStats to construct the JurisdictionMap
JurisdictionMap jurisdictionMap; JurisdictionMap jurisdictionMap;
jurisdictionMap.copyContents(temp.getJurisdictionRoot(), temp.getJurisdictionEndNodes()); jurisdictionMap.copyContents(temp.getJurisdictionRoot(), temp.getJurisdictionEndNodes());
(*jurisdiction)[nodeUUID] = jurisdictionMap; (*jurisdiction)[nodeUUID] = jurisdictionMap;

View file

@ -65,7 +65,7 @@
#include "renderer/VoxelShader.h" #include "renderer/VoxelShader.h"
#include "ui/BandwidthDialog.h" #include "ui/BandwidthDialog.h"
#include "ui/ChatEntry.h" #include "ui/ChatEntry.h"
#include "ui/VoxelStatsDialog.h" #include "ui/OctreeStatsDialog.h"
#include "ui/RearMirrorTools.h" #include "ui/RearMirrorTools.h"
#include "ui/LodToolsDialog.h" #include "ui/LodToolsDialog.h"
#include "ui/LogDialog.h" #include "ui/LogDialog.h"
@ -170,9 +170,9 @@ public:
BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; } BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; }
QSettings* getSettings() { return _settings; } QSettings* getSettings() { return _settings; }
QMainWindow* getWindow() { return _window; } QMainWindow* getWindow() { return _window; }
NodeToVoxelSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; } NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
void lockVoxelSceneStats() { _voxelSceneStatsLock.lockForRead(); } void lockOctreeSceneStats() { _octreeSceneStatsLock.lockForRead(); }
void unlockVoxelSceneStats() { _voxelSceneStatsLock.unlock(); } void unlockOctreeSceneStats() { _octreeSceneStatsLock.unlock(); }
QNetworkAccessManager* getNetworkAccessManager() { return _networkAccessManager; } QNetworkAccessManager* getNetworkAccessManager() { return _networkAccessManager; }
GeometryCache* getGeometryCache() { return &_geometryCache; } GeometryCache* getGeometryCache() { return &_geometryCache; }
@ -459,8 +459,8 @@ private:
NodeToJurisdictionMap _voxelServerJurisdictions; NodeToJurisdictionMap _voxelServerJurisdictions;
NodeToJurisdictionMap _particleServerJurisdictions; NodeToJurisdictionMap _particleServerJurisdictions;
NodeToVoxelSceneStats _octreeServerSceneStats; NodeToOctreeSceneStats _octreeServerSceneStats;
QReadWriteLock _voxelSceneStatsLock; QReadWriteLock _octreeSceneStatsLock;
std::vector<VoxelFade> _voxelFades; std::vector<VoxelFade> _voxelFades;
ControllerScriptingInterface _controllerScriptingInterface; ControllerScriptingInterface _controllerScriptingInterface;

View file

@ -66,7 +66,7 @@ Menu::Menu() :
_faceshiftEyeDeflection(DEFAULT_FACESHIFT_EYE_DEFLECTION), _faceshiftEyeDeflection(DEFAULT_FACESHIFT_EYE_DEFLECTION),
_frustumDrawMode(FRUSTUM_DRAW_MODE_ALL), _frustumDrawMode(FRUSTUM_DRAW_MODE_ALL),
_viewFrustumOffset(DEFAULT_FRUSTUM_OFFSET), _viewFrustumOffset(DEFAULT_FRUSTUM_OFFSET),
_voxelStatsDialog(NULL), _octreeStatsDialog(NULL),
_lodToolsDialog(NULL), _lodToolsDialog(NULL),
_maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM), _maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM),
_voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE), _voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
@ -213,7 +213,7 @@ Menu::Menu() :
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Oscilloscope, 0, true); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Oscilloscope, 0, true);
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Bandwidth, 0, true); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Bandwidth, 0, true);
addActionToQMenuAndActionHash(viewMenu, MenuOption::BandwidthDetails, 0, this, SLOT(bandwidthDetails())); 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"); QMenu* developerMenu = addMenu("Developer");
@ -341,7 +341,7 @@ Menu::Menu() :
Menu::~Menu() { Menu::~Menu() {
bandwidthDetailsClosed(); bandwidthDetailsClosed();
voxelStatsDetailsClosed(); octreeStatsDetailsClosed();
} }
void Menu::loadSettings(QSettings* settings) { void Menu::loadSettings(QSettings* settings) {
@ -1033,20 +1033,20 @@ void Menu::bandwidthDetailsClosed() {
} }
} }
void Menu::voxelStatsDetails() { void Menu::octreeStatsDetails() {
if (!_voxelStatsDialog) { if (!_octreeStatsDialog) {
_voxelStatsDialog = new VoxelStatsDialog(Application::getInstance()->getGLWidget(), _octreeStatsDialog = new OctreeStatsDialog(Application::getInstance()->getGLWidget(),
Application::getInstance()->getOcteeSceneStats()); Application::getInstance()->getOcteeSceneStats());
connect(_voxelStatsDialog, SIGNAL(closed()), SLOT(voxelStatsDetailsClosed())); connect(_octreeStatsDialog, SIGNAL(closed()), SLOT(octreeStatsDetailsClosed()));
_voxelStatsDialog->show(); _octreeStatsDialog->show();
} }
_voxelStatsDialog->raise(); _octreeStatsDialog->raise();
} }
void Menu::voxelStatsDetailsClosed() { void Menu::octreeStatsDetailsClosed() {
if (_voxelStatsDialog) { if (_octreeStatsDialog) {
delete _voxelStatsDialog; delete _octreeStatsDialog;
_voxelStatsDialog = NULL; _octreeStatsDialog = NULL;
} }
} }

View file

@ -53,7 +53,7 @@ class QSettings;
class BandwidthDialog; class BandwidthDialog;
class LodToolsDialog; class LodToolsDialog;
class MetavoxelEditor; class MetavoxelEditor;
class VoxelStatsDialog; class OctreeStatsDialog;
class MenuItemProperties; class MenuItemProperties;
class Menu : public QMenuBar { class Menu : public QMenuBar {
@ -73,7 +73,7 @@ public:
BandwidthDialog* getBandwidthDialog() const { return _bandwidthDialog; } BandwidthDialog* getBandwidthDialog() const { return _bandwidthDialog; }
FrustumDrawMode getFrustumDrawMode() const { return _frustumDrawMode; } FrustumDrawMode getFrustumDrawMode() const { return _frustumDrawMode; }
ViewFrustumOffset getViewFrustumOffset() const { return _viewFrustumOffset; } ViewFrustumOffset getViewFrustumOffset() const { return _viewFrustumOffset; }
VoxelStatsDialog* getVoxelStatsDialog() const { return _voxelStatsDialog; } OctreeStatsDialog* getOctreeStatsDialog() const { return _octreeStatsDialog; }
LodToolsDialog* getLodToolsDialog() const { return _lodToolsDialog; } LodToolsDialog* getLodToolsDialog() const { return _lodToolsDialog; }
int getMaxVoxels() const { return _maxVoxels; } int getMaxVoxels() const { return _maxVoxels; }
QAction* getUseVoxelShader() const { return _useVoxelShader; } QAction* getUseVoxelShader() const { return _useVoxelShader; }
@ -111,7 +111,7 @@ public slots:
void loginForCurrentDomain(); void loginForCurrentDomain();
void bandwidthDetails(); void bandwidthDetails();
void voxelStatsDetails(); void octreeStatsDetails();
void lodTools(); void lodTools();
void loadSettings(QSettings* settings = NULL); void loadSettings(QSettings* settings = NULL);
void saveSettings(QSettings* settings = NULL); void saveSettings(QSettings* settings = NULL);
@ -135,7 +135,7 @@ private slots:
void goToDomainDialog(); void goToDomainDialog();
void goToLocation(); void goToLocation();
void bandwidthDetailsClosed(); void bandwidthDetailsClosed();
void voxelStatsDetailsClosed(); void octreeStatsDetailsClosed();
void lodToolsClosed(); void lodToolsClosed();
void cycleFrustumRenderMode(); void cycleFrustumRenderMode();
void runTests(); void runTests();
@ -187,7 +187,7 @@ private:
FrustumDrawMode _frustumDrawMode; FrustumDrawMode _frustumDrawMode;
ViewFrustumOffset _viewFrustumOffset; ViewFrustumOffset _viewFrustumOffset;
QPointer<MetavoxelEditor> _MetavoxelEditor; QPointer<MetavoxelEditor> _MetavoxelEditor;
VoxelStatsDialog* _voxelStatsDialog; OctreeStatsDialog* _octreeStatsDialog;
LodToolsDialog* _lodToolsDialog; LodToolsDialog* _lodToolsDialog;
int _maxVoxels; int _maxVoxels;
float _voxelSizeScale; float _voxelSizeScale;
@ -286,7 +286,7 @@ namespace MenuOption {
const QString Quit = "Quit"; const QString Quit = "Quit";
const QString Voxels = "Voxels"; const QString Voxels = "Voxels";
const QString VoxelMode = "Cycle Voxel Mode"; const QString VoxelMode = "Cycle Voxel Mode";
const QString VoxelStats = "Voxel Stats"; const QString OctreeStats = "Voxel and Particle Statistics";
const QString VoxelTextures = "Voxel Textures"; const QString VoxelTextures = "Voxel Textures";
} }

View file

@ -1,5 +1,5 @@
// //
// VoxelStatsDialog.cpp // OctreeStatsDialog.cpp
// interface // interface
// //
// Created by Brad Hefta-Gaub on 7/19/13. // Created by Brad Hefta-Gaub on 7/19/13.
@ -14,13 +14,13 @@
#include <QPalette> #include <QPalette>
#include <QColor> #include <QColor>
#include <VoxelSceneStats.h> #include <OctreeSceneStats.h>
#include "Application.h" #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), QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint),
_model(model) { _model(model) {
@ -52,7 +52,7 @@ VoxelStatsDialog::VoxelStatsDialog(QWidget* parent, NodeToVoxelSceneStats* model
layout()->setSizeConstraint(QLayout::SetFixedSize); layout()->setSizeConstraint(QLayout::SetFixedSize);
} }
void VoxelStatsDialog::RemoveStatItem(int item) { void OctreeStatsDialog::RemoveStatItem(int item) {
QLabel* myLabel = _labels[item]; QLabel* myLabel = _labels[item];
QWidget* automaticLabel = _form->labelForField(myLabel); QWidget* automaticLabel = _form->labelForField(myLabel);
_form->removeWidget(myLabel); _form->removeWidget(myLabel);
@ -62,7 +62,7 @@ void VoxelStatsDialog::RemoveStatItem(int item) {
_labels[item] = NULL; _labels[item] = NULL;
} }
void VoxelStatsDialog::moreless(const QString& link) { void OctreeStatsDialog::moreless(const QString& link) {
QStringList linkDetails = link.split("-"); QStringList linkDetails = link.split("-");
const int COMMAND_ITEM = 0; const int COMMAND_ITEM = 0;
const int SERVER_NUMBER_ITEM = 1; 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]; char strBuf[64];
const int STATS_LABEL_WIDTH = 600; const int STATS_LABEL_WIDTH = 600;
@ -109,13 +109,13 @@ int VoxelStatsDialog::AddStatItem(const char* caption, unsigned colorRGBA) {
return _statCount; return _statCount;
} }
VoxelStatsDialog::~VoxelStatsDialog() { OctreeStatsDialog::~OctreeStatsDialog() {
for (int i = 0; i < _statCount; i++) { for (int i = 0; i < _statCount; i++) {
delete _labels[i]; delete _labels[i];
} }
} }
void VoxelStatsDialog::paintEvent(QPaintEvent* event) { void OctreeStatsDialog::paintEvent(QPaintEvent* event) {
// Update labels // Update labels
@ -171,11 +171,11 @@ void VoxelStatsDialog::paintEvent(QPaintEvent* event) {
unsigned long totalInternal = 0; unsigned long totalInternal = 0;
unsigned long totalLeaves = 0; unsigned long totalLeaves = 0;
Application::getInstance()->lockVoxelSceneStats(); Application::getInstance()->lockOctreeSceneStats();
NodeToVoxelSceneStats* sceneStats = Application::getInstance()->getOcteeSceneStats(); NodeToOctreeSceneStats* sceneStats = Application::getInstance()->getOcteeSceneStats();
for(NodeToVoxelSceneStatsIterator i = sceneStats->begin(); i != sceneStats->end(); i++) { for(NodeToOctreeSceneStatsIterator i = sceneStats->begin(); i != sceneStats->end(); i++) {
//const QUuid& uuid = i->first; //const QUuid& uuid = i->first;
VoxelSceneStats& stats = i->second; OctreeSceneStats& stats = i->second;
serverCount++; serverCount++;
// calculate server node totals // calculate server node totals
@ -194,7 +194,7 @@ void VoxelStatsDialog::paintEvent(QPaintEvent* event) {
sendingMode << "S"; sendingMode << "S";
} }
} }
Application::getInstance()->unlockVoxelSceneStats(); Application::getInstance()->unlockOctreeSceneStats();
sendingMode << " - " << serverCount << " servers"; sendingMode << " - " << serverCount << " servers";
if (movingServerCount > 0) { if (movingServerCount > 0) {
sendingMode << " <SCENE NOT STABLE>"; sendingMode << " <SCENE NOT STABLE>";
@ -221,7 +221,7 @@ void VoxelStatsDialog::paintEvent(QPaintEvent* event) {
this->QDialog::paintEvent(event); this->QDialog::paintEvent(event);
} }
void VoxelStatsDialog::showAllOctreeServers() { void OctreeStatsDialog::showAllOctreeServers() {
int serverCount = 0; int serverCount = 0;
showOctreeServersOfType(serverCount, NodeType::VoxelServer, "Voxel", 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) { NodeToJurisdictionMap& serverJurisdictions) {
QLocale locale(QLocale::English); QLocale locale(QLocale::English);
@ -303,10 +303,10 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serv
// now lookup stats details for this server... // now lookup stats details for this server...
if (_extraServerDetails[serverCount-1] != LESS) { if (_extraServerDetails[serverCount-1] != LESS) {
Application::getInstance()->lockVoxelSceneStats(); Application::getInstance()->lockOctreeSceneStats();
NodeToVoxelSceneStats* sceneStats = Application::getInstance()->getOcteeSceneStats(); NodeToOctreeSceneStats* sceneStats = Application::getInstance()->getOcteeSceneStats();
if (sceneStats->find(nodeUUID) != sceneStats->end()) { if (sceneStats->find(nodeUUID) != sceneStats->end()) {
VoxelSceneStats& stats = sceneStats->at(nodeUUID); OctreeSceneStats& stats = sceneStats->at(nodeUUID);
switch (_extraServerDetails[serverCount-1]) { switch (_extraServerDetails[serverCount-1]) {
case MOST: { case MOST: {
@ -323,9 +323,9 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serv
"Encode Time: " << lastFullEncodeString.toLocal8Bit().constData() << " ms " << "Encode Time: " << lastFullEncodeString.toLocal8Bit().constData() << " ms " <<
"Send Time: " << lastFullSendString.toLocal8Bit().constData() << " ms "; "Send Time: " << lastFullSendString.toLocal8Bit().constData() << " ms ";
for (int i = 0; i < VoxelSceneStats::ITEM_COUNT; i++) { for (int i = 0; i < OctreeSceneStats::ITEM_COUNT; i++) {
VoxelSceneStats::Item item = (VoxelSceneStats::Item)(i); OctreeSceneStats::Item item = (OctreeSceneStats::Item)(i);
VoxelSceneStats::ItemInfo& itemInfo = stats.getItemInfo(item); OctreeSceneStats::ItemInfo& itemInfo = stats.getItemInfo(item);
extraDetails << "<br/>" << itemInfo.caption << " " << stats.getItemValue(item); extraDetails << "<br/>" << itemInfo.caption << " " << stats.getItemValue(item);
} }
} // fall through... since MOST has all of MORE } // fall through... since MOST has all of MORE
@ -386,7 +386,7 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serv
} break; } break;
} }
} }
Application::getInstance()->unlockVoxelSceneStats(); Application::getInstance()->unlockOctreeSceneStats();
} else { } else {
linkDetails << " " << " [<a href='more-" << serverCount << "'>more...</a>]"; linkDetails << " " << " [<a href='more-" << serverCount << "'>more...</a>]";
linkDetails << " " << " [<a href='most-" << serverCount << "'>most...</a>]"; linkDetails << " " << " [<a href='most-" << serverCount << "'>most...</a>]";
@ -397,12 +397,12 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serv
} }
} }
void VoxelStatsDialog::reject() { void OctreeStatsDialog::reject() {
// Just regularly close upon ESC // Just regularly close upon ESC
this->QDialog::close(); this->QDialog::close();
} }
void VoxelStatsDialog::closeEvent(QCloseEvent* event) { void OctreeStatsDialog::closeEvent(QCloseEvent* event) {
this->QDialog::closeEvent(event); this->QDialog::closeEvent(event);
emit closed(); emit closed();
} }

View file

@ -1,30 +1,30 @@
// //
// VoxelStatsDialog.h // OctreeStatsDialog.h
// interface // interface
// //
// Created by Brad Hefta-Gaub on 7/19/13. // Created by Brad Hefta-Gaub on 7/19/13.
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved. // Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
// //
#ifndef __hifi__VoxelStatsDialog__ #ifndef __hifi__OctreeStatsDialog__
#define __hifi__VoxelStatsDialog__ #define __hifi__OctreeStatsDialog__
#include <QDialog> #include <QDialog>
#include <QFormLayout> #include <QFormLayout>
#include <QLabel> #include <QLabel>
#include <VoxelSceneStats.h> #include <OctreeSceneStats.h>
#define MAX_STATS 100 #define MAX_STATS 100
#define MAX_VOXEL_SERVERS 50 #define MAX_VOXEL_SERVERS 50
#define DEFAULT_COLOR 0 #define DEFAULT_COLOR 0
class VoxelStatsDialog : public QDialog { class OctreeStatsDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
// Sets up the UI // Sets up the UI
VoxelStatsDialog(QWidget* parent, NodeToVoxelSceneStats* model); OctreeStatsDialog(QWidget* parent, NodeToOctreeSceneStats* model);
~VoxelStatsDialog(); ~OctreeStatsDialog();
signals: signals:
void closed(); void closed();
@ -53,7 +53,7 @@ private:
QFormLayout* _form; QFormLayout* _form;
QLabel* _labels[MAX_STATS]; QLabel* _labels[MAX_STATS];
NodeToVoxelSceneStats* _model; NodeToOctreeSceneStats* _model;
int _statCount; int _statCount;
int _sendingMode; int _sendingMode;
@ -66,5 +66,5 @@ private:
details _extraServerDetails[MAX_VOXEL_SERVERS]; details _extraServerDetails[MAX_VOXEL_SERVERS];
}; };
#endif /* defined(__interface__VoxelStatsDialog__) */ #endif /* defined(__interface__OctreeStatsDialog__) */

View file

@ -16,13 +16,12 @@
#include "JurisdictionListener.h" #include "JurisdictionListener.h"
JurisdictionListener::JurisdictionListener(NodeType_t type) : JurisdictionListener::JurisdictionListener(NodeType_t type) :
_nodeType(type),
_packetSender(JurisdictionListener::DEFAULT_PACKETS_PER_SECOND) _packetSender(JurisdictionListener::DEFAULT_PACKETS_PER_SECOND)
{ {
_nodeType = type;
ReceivedPacketProcessor::_dontSleep = true; // we handle sleeping so this class doesn't need to ReceivedPacketProcessor::_dontSleep = true; // we handle sleeping so this class doesn't need to
connect(NodeList::getInstance(), &NodeList::nodeKilled, this, &JurisdictionListener::nodeKilled); connect(NodeList::getInstance(), &NodeList::nodeKilled, this, &JurisdictionListener::nodeKilled);
//qDebug("JurisdictionListener::JurisdictionListener(NodeType_t type=%c)", type);
// tell our NodeList we want to hear about nodes with our node type // tell our NodeList we want to hear about nodes with our node type
NodeList::getInstance()->addNodeTypeToInterestSet(type); NodeList::getInstance()->addNodeTypeToInterestSet(type);
@ -35,8 +34,6 @@ void JurisdictionListener::nodeKilled(SharedNodePointer node) {
} }
bool JurisdictionListener::queueJurisdictionRequest() { bool JurisdictionListener::queueJurisdictionRequest() {
//qDebug() << "JurisdictionListener::queueJurisdictionRequest()";
static unsigned char buffer[MAX_PACKET_SIZE]; static unsigned char buffer[MAX_PACKET_SIZE];
unsigned char* bufferOut = &buffer[0]; unsigned char* bufferOut = &buffer[0];
ssize_t sizeOut = populatePacketHeader(reinterpret_cast<char*>(bufferOut), PacketTypeJurisdictionRequest); ssize_t sizeOut = populatePacketHeader(reinterpret_cast<char*>(bufferOut), PacketTypeJurisdictionRequest);
@ -71,7 +68,6 @@ void JurisdictionListener::processPacket(const SharedNodePointer& sendingNode, c
} }
bool JurisdictionListener::process() { bool JurisdictionListener::process() {
//qDebug() << "JurisdictionListener::process()";
bool continueProcessing = isStillRunning(); bool continueProcessing = isStillRunning();
// If we're still running, and we don't have any requests waiting to be sent, then queue our jurisdiction requests // If we're still running, and we don't have any requests waiting to be sent, then queue our jurisdiction requests
@ -80,7 +76,6 @@ bool JurisdictionListener::process() {
} }
if (continueProcessing) { if (continueProcessing) {
//qDebug() << "JurisdictionListener::process() calling _packetSender.process()";
continueProcessing = _packetSender.process(); continueProcessing = _packetSender.process();
} }
if (continueProcessing) { if (continueProcessing) {

View file

@ -19,9 +19,9 @@
JurisdictionSender::JurisdictionSender(JurisdictionMap* map, NodeType_t type) : JurisdictionSender::JurisdictionSender(JurisdictionMap* map, NodeType_t type) :
ReceivedPacketProcessor(), ReceivedPacketProcessor(),
_jurisdictionMap(map), _jurisdictionMap(map),
_nodeType(type),
_packetSender(JurisdictionSender::DEFAULT_PACKETS_PER_SECOND) _packetSender(JurisdictionSender::DEFAULT_PACKETS_PER_SECOND)
{ {
_nodeType = type;
} }
JurisdictionSender::~JurisdictionSender() { JurisdictionSender::~JurisdictionSender() {

View file

@ -17,10 +17,11 @@
#include "OctreeEditPacketSender.h" #include "OctreeEditPacketSender.h"
EditPacketBuffer::EditPacketBuffer(PacketType type, unsigned char* buffer, ssize_t length, QUuid nodeUUID) { EditPacketBuffer::EditPacketBuffer(PacketType type, unsigned char* buffer, ssize_t length, QUuid nodeUUID) :
_nodeUUID = nodeUUID; _nodeUUID(nodeUUID),
_currentType = type; _currentType(type),
_currentSize = length; _currentSize(length)
{
memcpy(_currentBuffer, buffer, length); memcpy(_currentBuffer, buffer, length);
}; };

View file

@ -19,7 +19,8 @@ OctreePersistThread::OctreePersistThread(Octree* tree, const QString& filename,
_filename(filename), _filename(filename),
_persistInterval(persistInterval), _persistInterval(persistInterval),
_initialLoadComplete(false), _initialLoadComplete(false),
_loadTimeUSecs(0) { _loadTimeUSecs(0)
{
} }
bool OctreePersistThread::process() { bool OctreePersistThread::process() {

View file

@ -20,23 +20,22 @@
const int samples = 100; const int samples = 100;
OctreeSceneStats::OctreeSceneStats() : OctreeSceneStats::OctreeSceneStats() :
_elapsedAverage(samples), _isReadyToSend(false),
_isStarted(false),
_lastFullElapsed(0),
_elapsedAverage(samples),
_bitsPerOctreeAverage(samples), _bitsPerOctreeAverage(samples),
_lastFullTotalEncodeTime(0),
_incomingPacket(0),
_incomingBytes(0),
_incomingWastedBytes(0),
_incomingLastSequence(0),
_incomingOutOfOrder(0),
_incomingLikelyLost(0),
_incomingFlightTimeAverage(samples), _incomingFlightTimeAverage(samples),
_jurisdictionRoot(NULL) _jurisdictionRoot(NULL)
{ {
reset(); reset();
_isReadyToSend = false;
_isStarted = false;
_lastFullTotalEncodeTime = 0;
_lastFullElapsed = 0;
_incomingPacket = 0;
_incomingBytes = 0;
_incomingWastedBytes = 0;
_incomingLastSequence = 0;
_incomingOutOfOrder = 0;
_incomingLikelyLost = 0;
} }
// copy constructor // copy constructor

View file

@ -12,14 +12,12 @@
OctreeScriptingInterface::OctreeScriptingInterface(OctreeEditPacketSender* packetSender, OctreeScriptingInterface::OctreeScriptingInterface(OctreeEditPacketSender* packetSender,
JurisdictionListener* jurisdictionListener) : JurisdictionListener* jurisdictionListener) :
_packetSender(NULL), _packetSender(packetSender),
_jurisdictionListener(NULL), _jurisdictionListener(jurisdictionListener),
_managedPacketSender(false), _managedPacketSender(false),
_managedJurisdictionListener(false), _managedJurisdictionListener(false),
_initialized(false) _initialized(false)
{ {
setPacketSender(packetSender);
setJurisdictionListener(jurisdictionListener);
} }
OctreeScriptingInterface::~OctreeScriptingInterface() { OctreeScriptingInterface::~OctreeScriptingInterface() {

View file

@ -12,11 +12,6 @@
#include <stdio.h> #include <stdio.h>
// These are some useful utilities that vec3 is missing
void printVec3(const char* name, const glm::vec3& v) {
printf("%s x=%f y=%f z=%f\n", name, v.x, v.y, v.z);
}
void Plane::set3Points(const glm::vec3 &v1, const glm::vec3 &v2, const glm::vec3 &v3) { void Plane::set3Points(const glm::vec3 &v1, const glm::vec3 &v2, const glm::vec3 &v3) {
glm::vec3 linev1v2, linev1v3; glm::vec3 linev1v2, linev1v3;

View file

@ -9,8 +9,7 @@
#include "ParticleTree.h" #include "ParticleTree.h"
ParticleTree::ParticleTree(bool shouldReaverage) : Octree(shouldReaverage) { ParticleTree::ParticleTree(bool shouldReaverage) : Octree(shouldReaverage) {
ParticleTreeElement* rootNode = createNewElement(); _rootNode = createNewElement();
_rootNode = rootNode;
} }
ParticleTreeElement* ParticleTree::createNewElement(unsigned char * octalCode) { ParticleTreeElement* ParticleTree::createNewElement(unsigned char * octalCode) {

View file

@ -44,22 +44,28 @@ static QScriptValue soundConstructor(QScriptContext* context, QScriptEngine* eng
ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, const QString& fileNameString, ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, const QString& fileNameString,
AbstractControllerScriptingInterface* controllerScriptingInterface) : AbstractControllerScriptingInterface* controllerScriptingInterface) :
_scriptContents(scriptContents),
_isFinished(false),
_isRunning(false),
_isInitialized(false),
_engine(),
_isAvatar(false), _isAvatar(false),
_avatarIdentityTimer(NULL), _avatarIdentityTimer(NULL),
_avatarBillboardTimer(NULL), _avatarBillboardTimer(NULL),
_avatarData(NULL) _timerFunctionMap(),
_controllerScriptingInterface(controllerScriptingInterface),
_avatarData(NULL),
_wantMenuItems(wantMenuItems),
_scriptMenuName(),
_fileNameString(fileNameString),
_quatLibrary(),
_vec3Library()
{ {
_scriptContents = scriptContents;
_isFinished = false;
_isRunning = false;
_isInitialized = false;
_fileNameString = fileNameString;
QByteArray fileNameAscii = fileNameString.toLocal8Bit(); QByteArray fileNameAscii = fileNameString.toLocal8Bit();
const char* scriptMenuName = fileNameAscii.data(); const char* scriptMenuName = fileNameAscii.data();
// some clients will use these menu features // some clients will use these menu features
_wantMenuItems = wantMenuItems;
if (!fileNameString.isEmpty()) { if (!fileNameString.isEmpty()) {
_scriptMenuName = "Stop "; _scriptMenuName = "Stop ";
_scriptMenuName.append(scriptMenuName); _scriptMenuName.append(scriptMenuName);
@ -69,11 +75,9 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, co
_scriptMenuName.append(_scriptNumber); _scriptMenuName.append(_scriptNumber);
} }
_scriptNumber++; _scriptNumber++;
_controllerScriptingInterface = controllerScriptingInterface;
} }
ScriptEngine::~ScriptEngine() { ScriptEngine::~ScriptEngine() {
//printf("ScriptEngine::~ScriptEngine()...\n");
} }
void ScriptEngine::setIsAvatar(bool isAvatar) { void ScriptEngine::setIsAvatar(bool isAvatar) {

View file

@ -96,13 +96,14 @@ private:
static VoxelsScriptingInterface _voxelsScriptingInterface; static VoxelsScriptingInterface _voxelsScriptingInterface;
static ParticlesScriptingInterface _particlesScriptingInterface; static ParticlesScriptingInterface _particlesScriptingInterface;
static int _scriptNumber;
AbstractControllerScriptingInterface* _controllerScriptingInterface; AbstractControllerScriptingInterface* _controllerScriptingInterface;
AudioScriptingInterface _audioScriptingInterface; AudioScriptingInterface _audioScriptingInterface;
AvatarData* _avatarData; AvatarData* _avatarData;
bool _wantMenuItems; bool _wantMenuItems;
QString _scriptMenuName; QString _scriptMenuName;
QString _fileNameString; QString _fileNameString;
static int _scriptNumber;
Quat _quatLibrary; Quat _quatLibrary;
Vec3 _vec3Library; Vec3 _vec3Library;
}; };

View file

@ -1,14 +0,0 @@
//
// VoxelSceneStats.cpp
// hifi
//
// Created by Brad Hefta-Gaub on 7/18/13.
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
//
//
#include "VoxelSceneStats.h"
// currently an alias for OctreeSceneStats

View file

@ -1,28 +0,0 @@
//
// VoxelSceneStats.h
// hifi
//
// Created by Brad Hefta-Gaub on 7/18/13.
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
//
//
#ifndef __hifi__VoxelSceneStats__
#define __hifi__VoxelSceneStats__
#include <NodeList.h>
#include <OctreeSceneStats.h>
/// Collects statistics for calculating and sending a scene from a voxel server to an interface client
class VoxelSceneStats : public OctreeSceneStats {
// currently an alias for OctreeSceneStats
};
/// Map between node IDs and their reported VoxelSceneStats. Typically used by classes that need to know which nodes sent
/// which voxel stats
typedef std::map<QUuid, VoxelSceneStats> NodeToVoxelSceneStats;
typedef std::map<QUuid, VoxelSceneStats>::iterator NodeToVoxelSceneStatsIterator;
#endif /* defined(__hifi__VoxelSceneStats__) */

View file

@ -20,7 +20,8 @@
// Voxel Specific operations.... // Voxel Specific operations....
VoxelTree::VoxelTree(bool shouldReaverage) : Octree(shouldReaverage) { VoxelTree::VoxelTree(bool shouldReaverage) : Octree(shouldReaverage)
{
_rootNode = createNewElement(); _rootNode = createNewElement();
} }