History

merge again after some competing pull requests were processed

Andrew Meadows committed 12 years ago

Commit 8799ad12 parents d28ed70 ea0f7c112 files · +589 −480Browse files

Showing the changes to interface/src/Application.cpp (1 of 12 files). Show all

Unified · Split

interface/src/Application.cpp+57−3
@@ -85,7 +85,6 @@ const float MIRROR_FULLSCREEN_DISTANCE = 0.35f; · 84 unmodified lines
8585 const float MIRROR_REARVIEW_DISTANCE = 0.65f;
8686 const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f;
8787
88−
8988 void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
9089 fprintf(stdout, "%s", message.toLocal8Bit().constData());
9190 Application::getInstance()->getLogger()->addMessage(message.toLocal8Bit().constData());
@@ -142,7 +141,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 50 unmodified lines
142141 _resetRecentMaxPacketsSoon(true),
143142 _swatch(NULL),
144143 _pasteMode(false),
145− _logger(new FileLogger())
144+ _logger(new FileLogger()),
145+ _persistThread(NULL)
146146 {
147147 _applicationStartupTime = startup_time;
148148
@@ -177,7 +177,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 28 unmodified lines
177177 nodeList->addHook(&_voxels);
178178 nodeList->addHook(this);
179179 nodeList->addDomainListener(this);
180− nodeList->addDomainListener(&_voxels);
181180
182181 // network receive thread and voxel parsing thread are both controlled by the --nonblocking command line
183182 _enableProcessVoxelsThread = _enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");
@@ -249,6 +248,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 65 unmodified lines
249248
250249 // Set the sixense filtering
251250 _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));
251+
252252 }
253253
254254 Application::~Application() {
@@ -1434,6 +1434,8 @@ void Application::terminate() { · 1179 unmodified lines
14341434 _voxelHideShowThread.terminate();
14351435 _voxelEditSender.terminate();
14361436 _particleEditSender.terminate();
1437+ _persistThread->terminate();
1438+ _persistThread = NULL;
14371439 }
14381440
14391441 static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) {
@@ -1933,6 +1935,9 @@ void Application::init() { · 493 unmodified lines
19331935 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
19341936 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
19351937 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
1938+
1939+
1940+ updateLocalOctreeCache(true);
19361941 }
19371942
19381943 void Application::closeMirrorView() {
@@ -2393,6 +2398,7 @@ void Application::updateThreads(float deltaTime) { · 454 unmodified lines
23932398 _voxelHideShowThread.threadRoutine();
23942399 _voxelEditSender.threadRoutine();
23952400 _particleEditSender.threadRoutine();
2401+ _persistThread->threadRoutine();
23962402 }
23972403 }
23982404
@@ -4188,6 +4194,10 @@ void Application::domainChanged(QString domain) { · 1789 unmodified lines
41884194 _voxelServerJurisdictions.clear();
41894195 _octreeServerSceneStats.clear();
41904196 _particleServerJurisdictions.clear();
4197+
4198+ // reset our persist thread
4199+ qDebug() << "domainChanged()... domain=" << domain << " swapping persist cache\n";
4200+ updateLocalOctreeCache();
41914201 }
41924202
41934203 void Application::nodeAdded(Node* node) {
@@ -4527,3 +4537,47 @@ void Application::toggleLogDialog() { · 333 unmodified lines
45274537 _logDialog->close();
45284538 }
45294539 }
4540+
4541+
4542+void Application::initAvatarAndViewFrustum() {
4543+ updateAvatar(0.f);
4544+}
4545+
4546+QString Application::getLocalVoxelCacheFileName() {
4547+ QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
4548+ QDir logDir(fileName);
4549+ if (!logDir.exists(fileName)) {
4550+ logDir.mkdir(fileName);
4551+ }
4552+
4553+ fileName.append(QString("/hifi.voxelscache."));
4554+ fileName.append(_profile.getLastDomain());
4555+ fileName.append(QString(".svo"));
4556+
4557+ return fileName;
4558+}
4559+
4560+
4561+void Application::updateLocalOctreeCache(bool firstTime) {
4562+ // only do this if we've already got a persistThread or we're told this is the first time
4563+ if (firstTime || _persistThread) {
4564+
4565+ if (_persistThread) {
4566+ _persistThread->terminate();
4567+ _persistThread = NULL;
4568+ }
4569+
4570+ QString localVoxelCacheFileName = getLocalVoxelCacheFileName();
4571+ const int LOCAL_CACHE_PERSIST_INTERVAL = 1000 * 10; // every 10 seconds
4572+ _persistThread = new OctreePersistThread(_voxels.getTree(),
4573+ localVoxelCacheFileName.toLocal8Bit().constData(),LOCAL_CACHE_PERSIST_INTERVAL);
4574+
4575+ qDebug() << "updateLocalOctreeCache()... localVoxelCacheFileName=" << localVoxelCacheFileName << "\n";
4576+
4577+ if (_persistThread) {
4578+ _voxels.beginLoadingLocalVoxelCache(); // while local voxels are importing, don't do individual node VBO updates
4579+ connect(_persistThread, SIGNAL(loadCompleted()), &_voxels, SLOT(localVoxelCacheLoaded()));
4580+ _persistThread->initialize(true);
4581+ }
4582+ }
4583+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t