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
85const float MIRROR_REARVIEW_DISTANCE = 0.65f;85const float MIRROR_REARVIEW_DISTANCE = 0.65f;
86const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f;86const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f;
87 87
88
89void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {88void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
90 fprintf(stdout, "%s", message.toLocal8Bit().constData());89 fprintf(stdout, "%s", message.toLocal8Bit().constData());
91 Application::getInstance()->getLogger()->addMessage(message.toLocal8Bit().constData());90 Application::getInstance()->getLogger()->addMessage(message.toLocal8Bit().constData());
@@ -142,7 +141,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 50 unmodified lines
142 _resetRecentMaxPacketsSoon(true),141 _resetRecentMaxPacketsSoon(true),
143 _swatch(NULL),142 _swatch(NULL),
144 _pasteMode(false),143 _pasteMode(false),
145 _logger(new FileLogger())144 _logger(new FileLogger()),
145 _persistThread(NULL)
146{146{
147 _applicationStartupTime = startup_time;147 _applicationStartupTime = startup_time;
148 148
@@ -177,7 +177,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 28 unmodified lines
177 nodeList->addHook(&_voxels);177 nodeList->addHook(&_voxels);
178 nodeList->addHook(this);178 nodeList->addHook(this);
179 nodeList->addDomainListener(this);179 nodeList->addDomainListener(this);
180 nodeList->addDomainListener(&_voxels);
181 180
182 // network receive thread and voxel parsing thread are both controlled by the --nonblocking command line181 // network receive thread and voxel parsing thread are both controlled by the --nonblocking command line
183 _enableProcessVoxelsThread = _enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");182 _enableProcessVoxelsThread = _enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");
@@ -249,6 +248,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 65 unmodified lines
249 248
250 // Set the sixense filtering249 // Set the sixense filtering
251 _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));250 _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));
251
252}252}
253 253
254Application::~Application() {254Application::~Application() {
@@ -1434,6 +1434,8 @@ void Application::terminate() { · 1179 unmodified lines
1434 _voxelHideShowThread.terminate();1434 _voxelHideShowThread.terminate();
1435 _voxelEditSender.terminate();1435 _voxelEditSender.terminate();
1436 _particleEditSender.terminate();1436 _particleEditSender.terminate();
1437 _persistThread->terminate();
1438 _persistThread = NULL;
1437}1439}
1438 1440
1439static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) {1441static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) {
@@ -1933,6 +1935,9 @@ void Application::init() { · 493 unmodified lines
1933 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));1935 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
1934 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));1936 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
1935 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));1937 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
1938
1939
1940 updateLocalOctreeCache(true);
1936}1941}
1937 1942
1938void Application::closeMirrorView() {1943void Application::closeMirrorView() {
@@ -2393,6 +2398,7 @@ void Application::updateThreads(float deltaTime) { · 454 unmodified lines
2393 _voxelHideShowThread.threadRoutine();2398 _voxelHideShowThread.threadRoutine();
2394 _voxelEditSender.threadRoutine();2399 _voxelEditSender.threadRoutine();
2395 _particleEditSender.threadRoutine();2400 _particleEditSender.threadRoutine();
2401 _persistThread->threadRoutine();
2396 }2402 }
2397}2403}
2398 2404
@@ -4188,6 +4194,10 @@ void Application::domainChanged(QString domain) { · 1789 unmodified lines
4188 _voxelServerJurisdictions.clear();4194 _voxelServerJurisdictions.clear();
4189 _octreeServerSceneStats.clear();4195 _octreeServerSceneStats.clear();
4190 _particleServerJurisdictions.clear();4196 _particleServerJurisdictions.clear();
4197
4198 // reset our persist thread
4199 qDebug() << "domainChanged()... domain=" << domain << " swapping persist cache\n";
4200 updateLocalOctreeCache();
4191}4201}
4192 4202
4193void Application::nodeAdded(Node* node) {4203void Application::nodeAdded(Node* node) {
@@ -4527,3 +4537,47 @@ void Application::toggleLogDialog() { · 333 unmodified lines
4527 _logDialog->close();4537 _logDialog->close();
4528 }4538 }
4529}4539}
4540
4541
4542void Application::initAvatarAndViewFrustum() {
4543 updateAvatar(0.f);
4544}
4545
4546QString 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
4561void 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