From 9003a7d40b3fa39938e546a68b51901b430e327d Mon Sep 17 00:00:00 2001 From: atlante45 Date: Wed, 21 Aug 2013 12:06:47 -0700 Subject: [PATCH] PR comments --- interface/src/Application.cpp | 4 +++- interface/src/VoxelImporter.cpp | 29 +++++++++++++---------------- interface/src/VoxelImporter.h | 4 ++-- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index c3137e2d9b..dbb2170150 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -81,6 +81,8 @@ const int STARTUP_JITTER_SAMPLES = PACKET_LENGTH_SAMPLES_PER_CHANNEL / 2; // Startup optimistically with small jitter buffer that // will start playback on the second received audio packet. +static const float CLIPBOARD_TREE_SCALE = 1.0f; + void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) { fprintf(stdout, "%s", message.toLocal8Bit().constData()); LogDisplay::instance.addMessage(message.toLocal8Bit().constData()); @@ -94,7 +96,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : _frameCount(0), _fps(120.0f), _justStarted(true), - _clipboard(1), + _clipboard(CLIPBOARD_TREE_SCALE), _voxelImporter(_window), _wantToKillLocalVoxels(false), _audioScope(256, 200, true), diff --git a/interface/src/VoxelImporter.cpp b/interface/src/VoxelImporter.cpp index 7aa7dcb02a..ef4eeafc4b 100644 --- a/interface/src/VoxelImporter.cpp +++ b/interface/src/VoxelImporter.cpp @@ -11,6 +11,7 @@ #include #include +static const int IMPORT_SYSTEM_SCALE = 1.0f; static const int MAX_VOXELS_PER_IMPORT = 2000000; class ImportTask : public QObject, public QRunnable { @@ -25,10 +26,10 @@ private: VoxelImporter::VoxelImporter(QWidget* parent) : QObject(parent), - _voxelSystem(new VoxelSystem(1, MAX_VOXELS_PER_IMPORT)), + _voxelSystem(IMPORT_SYSTEM_SCALE, MAX_VOXELS_PER_IMPORT), _initialized(false), _importWaiting(false), - _importDialog(parent, _voxelSystem), + _importDialog(parent, &_voxelSystem), _currentTask(NULL), _nextTask(NULL) { @@ -45,16 +46,13 @@ VoxelImporter::~VoxelImporter() { if (_currentTask) { disconnect(_currentTask, 0, 0, 0); - connect(_currentTask, SIGNAL(destroyed()), _voxelSystem, SLOT(deleteLater())); - _voxelSystem->cancelImport(); + _voxelSystem.cancelImport(); _currentTask = NULL; - } else if (_initialized) { - delete _voxelSystem; } } void VoxelImporter::reset() { - _voxelSystem->killLocalVoxels(); + _voxelSystem.killLocalVoxels(); _importDialog.reset(); _filename = ""; _importWaiting = false; @@ -65,16 +63,15 @@ void VoxelImporter::reset() { } if (_currentTask) { - _voxelSystem->cancelImport(); + _voxelSystem.cancelImport(); } } int VoxelImporter::exec() { if (!_initialized) { - _voxelSystem->init(); - _importViewFrustum.setKeyholeRadius(100000.0f); + _voxelSystem.init(); _importViewFrustum.calculate(); - _voxelSystem->setViewFrustum(&_importViewFrustum); + _voxelSystem.setViewFrustum(&_importViewFrustum); _initialized = true; } reset(); @@ -105,11 +102,11 @@ int VoxelImporter::preImport() { delete _nextTask; } - _nextTask = new ImportTask(_voxelSystem, _filename); + _nextTask = new ImportTask(&_voxelSystem, _filename); connect(_nextTask, SIGNAL(destroyed()), SLOT(launchTask())); if (_currentTask != NULL) { - _voxelSystem->cancelImport(); + _voxelSystem.cancelImport(); } else { launchTask(); } @@ -141,12 +138,12 @@ int VoxelImporter::import() { delete _nextTask; } - _nextTask = new ImportTask(_voxelSystem, _filename); + _nextTask = new ImportTask(&_voxelSystem, _filename); connect(_nextTask, SIGNAL(destroyed()), SLOT(launchTask())); connect(_nextTask, SIGNAL(destroyed()), &_importDialog, SLOT(accept())); if (_currentTask != NULL) { - _voxelSystem->cancelImport(); + _voxelSystem.cancelImport(); } else { launchTask(); } @@ -156,7 +153,7 @@ int VoxelImporter::import() { void VoxelImporter::launchTask() { if (_nextTask != NULL) { - _voxelSystem->killLocalVoxels(); + _voxelSystem.killLocalVoxels(); _currentTask = _nextTask; _nextTask = NULL; QThreadPool::globalInstance()->start(_currentTask); diff --git a/interface/src/VoxelImporter.h b/interface/src/VoxelImporter.h index b5624ed07f..4ab230d6fb 100644 --- a/interface/src/VoxelImporter.h +++ b/interface/src/VoxelImporter.h @@ -25,7 +25,7 @@ public: void reset(); bool getImportWaiting() const { return _importWaiting; } - VoxelSystem* getVoxelSystem() const { return _voxelSystem; } + VoxelSystem* getVoxelSystem() { return &_voxelSystem; } bool getimportIntoClipboard() const { return _importDialog.getImportIntoClipboard(); } public slots: @@ -37,7 +37,7 @@ private slots: void launchTask(); private: - VoxelSystem* _voxelSystem; + VoxelSystem _voxelSystem; ViewFrustum _importViewFrustum; bool _initialized; bool _importWaiting;