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() :
_viewSent(false),
_octreePacket(new unsigned char[MAX_PACKET_SIZE]),
_octreePacketAt(_octreePacket),
_octreePacketAvailableBytes(MAX_PACKET_SIZE),
_octreePacketWaiting(false),
_lastOctreePacket(new unsigned char[MAX_PACKET_SIZE]),
_lastOctreePacketLength(0),
_duplicatePacketCount(0),
_firstSuppressedPacket(usecTimestampNow()),
_maxSearchLevel(1),
_maxLevelReachedInLastSearch(1),
_lastTimeBagEmpty(0),
@ -27,14 +34,9 @@ OctreeQueryNode::OctreeQueryNode() :
_lastClientBoundaryLevelAdjust(0),
_lastClientOctreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
_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() {

View file

@ -60,7 +60,7 @@
#include <PerfStat.h>
#include <ResourceCache.h>
#include <UUID.h>
#include <VoxelSceneStats.h>
#include <OctreeSceneStats.h>
#include <LocalVoxelsList.h>
#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<const unsigned char*>(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<const unsigned char*>(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;

View file

@ -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<VoxelFade> _voxelFades;
ControllerScriptingInterface _controllerScriptingInterface;

View file

@ -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;
}
}

View file

@ -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> _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";
}

View file

@ -1,5 +1,5 @@
//
// VoxelStatsDialog.cpp
// OctreeStatsDialog.cpp
// interface
//
// Created by Brad Hefta-Gaub on 7/19/13.
@ -14,13 +14,13 @@
#include <QPalette>
#include <QColor>
#include <VoxelSceneStats.h>
#include <OctreeSceneStats.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),
_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 << " <SCENE NOT STABLE>";
@ -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 << "<br/>" << 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 << " " << " [<a href='more-" << serverCount << "'>more...</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
this->QDialog::close();
}
void VoxelStatsDialog::closeEvent(QCloseEvent* event) {
void OctreeStatsDialog::closeEvent(QCloseEvent* event) {
this->QDialog::closeEvent(event);
emit closed();
}

View file

@ -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 <QDialog>
#include <QFormLayout>
#include <QLabel>
#include <VoxelSceneStats.h>
#include <OctreeSceneStats.h>
#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__) */

View file

@ -16,13 +16,12 @@
#include "JurisdictionListener.h"
JurisdictionListener::JurisdictionListener(NodeType_t type) :
_nodeType(type),
_packetSender(JurisdictionListener::DEFAULT_PACKETS_PER_SECOND)
{
_nodeType = type;
ReceivedPacketProcessor::_dontSleep = true; // we handle sleeping so this class doesn't need to
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
NodeList::getInstance()->addNodeTypeToInterestSet(type);
@ -35,8 +34,6 @@ void JurisdictionListener::nodeKilled(SharedNodePointer node) {
}
bool JurisdictionListener::queueJurisdictionRequest() {
//qDebug() << "JurisdictionListener::queueJurisdictionRequest()";
static unsigned char buffer[MAX_PACKET_SIZE];
unsigned char* bufferOut = &buffer[0];
ssize_t sizeOut = populatePacketHeader(reinterpret_cast<char*>(bufferOut), PacketTypeJurisdictionRequest);
@ -71,7 +68,6 @@ void JurisdictionListener::processPacket(const SharedNodePointer& sendingNode, c
}
bool JurisdictionListener::process() {
//qDebug() << "JurisdictionListener::process()";
bool continueProcessing = isStillRunning();
// 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) {
//qDebug() << "JurisdictionListener::process() calling _packetSender.process()";
continueProcessing = _packetSender.process();
}
if (continueProcessing) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,11 +12,6 @@
#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) {
glm::vec3 linev1v2, linev1v3;

View file

@ -9,8 +9,7 @@
#include "ParticleTree.h"
ParticleTree::ParticleTree(bool shouldReaverage) : Octree(shouldReaverage) {
ParticleTreeElement* rootNode = createNewElement();
_rootNode = rootNode;
_rootNode = createNewElement();
}
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,
AbstractControllerScriptingInterface* controllerScriptingInterface) :
_scriptContents(scriptContents),
_isFinished(false),
_isRunning(false),
_isInitialized(false),
_engine(),
_isAvatar(false),
_avatarIdentityTimer(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();
const char* scriptMenuName = fileNameAscii.data();
// some clients will use these menu features
_wantMenuItems = wantMenuItems;
if (!fileNameString.isEmpty()) {
_scriptMenuName = "Stop ";
_scriptMenuName.append(scriptMenuName);
@ -69,11 +75,9 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, co
_scriptMenuName.append(_scriptNumber);
}
_scriptNumber++;
_controllerScriptingInterface = controllerScriptingInterface;
}
ScriptEngine::~ScriptEngine() {
//printf("ScriptEngine::~ScriptEngine()...\n");
}
void ScriptEngine::setIsAvatar(bool isAvatar) {

View file

@ -96,13 +96,14 @@ private:
static VoxelsScriptingInterface _voxelsScriptingInterface;
static ParticlesScriptingInterface _particlesScriptingInterface;
static int _scriptNumber;
AbstractControllerScriptingInterface* _controllerScriptingInterface;
AudioScriptingInterface _audioScriptingInterface;
AvatarData* _avatarData;
bool _wantMenuItems;
QString _scriptMenuName;
QString _fileNameString;
static int _scriptNumber;
Quat _quatLibrary;
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....
VoxelTree::VoxelTree(bool shouldReaverage) : Octree(shouldReaverage) {
VoxelTree::VoxelTree(bool shouldReaverage) : Octree(shouldReaverage)
{
_rootNode = createNewElement();
}