History

Merge branch 'master' of https://github.com/highfidelity/hifi into authentication

Stephen Birarda committed 12 years ago

Commit f92f9ec2 parents 53170d3 4d55f3556 files · +435 −500Browse files

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

Unified · Split

interface/src/Application.cpp+13−68
@@ -101,10 +101,12 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D · 100 unmodified lines
101101
102102 const int STATS_PELS_PER_LINE = 20;
103103
104−void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
105− QString messageWithNewLine = message + "\n";
106− fprintf(stdout, "%s", messageWithNewLine.toLocal8Bit().constData());
107− Application::getInstance()->getLogger()->addMessage(messageWithNewLine.toLocal8Bit().constData());
104+void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) {
105+ if (message.size() > 0) {
106+ QString messageWithNewLine = message + "\n";
107+ fprintf(stdout, "%s", messageWithNewLine.toLocal8Bit().constData());
108+ Application::getInstance()->getLogger()->addMessage(messageWithNewLine.toLocal8Bit().constData());
109+ }
108110 }
109111
110112 Application::Application(int& argc, char** argv, timeval &startup_time) :
@@ -152,8 +154,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 41 unmodified lines
152154 _resetRecentMaxPacketsSoon(true),
153155 _swatch(NULL),
154156 _pasteMode(false),
155− _logger(new FileLogger(this)),
156− _persistThread(NULL)
157+ _logger(new FileLogger(this))
157158 {
158159 _myAvatar = _avatarManager.getMyAvatar();
159160
@@ -320,12 +321,7 @@ Application::~Application() { · 160 unmodified lines
320321 _voxelHideShowThread.terminate();
321322 _voxelEditSender.terminate();
322323 _particleEditSender.terminate();
323− if (_persistThread) {
324− _persistThread->terminate();
325− _persistThread->deleteLater();
326− _persistThread = NULL;
327− }
328−
324+
329325 storeSizeAndPosition();
330326 saveScripts();
331327 _sharedVoxelSystem.changeTree(new VoxelTree);
@@ -1266,7 +1262,8 @@ void Application::mousePressEvent(QMouseEvent* event) { · 934 unmodified lines
12661262 pasteVoxels();
12671263 }
12681264
1269− if (MAKE_SOUND_ON_VOXEL_CLICK && _isHoverVoxel && !_isHoverVoxelSounding) {
1265+ if (!Menu::getInstance()->isOptionChecked(MenuOption::VoxelDeleteMode) &&
1266+ MAKE_SOUND_ON_VOXEL_CLICK && _isHoverVoxel && !_isHoverVoxelSounding) {
12701267 _hoverVoxelOriginalColor[0] = _hoverVoxel.red;
12711268 _hoverVoxelOriginalColor[1] = _hoverVoxel.green;
12721269 _hoverVoxelOriginalColor[2] = _hoverVoxel.blue;
@@ -1905,9 +1902,6 @@ void Application::init() { · 632 unmodified lines
19051902 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
19061903 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
19071904 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
1908−
1909−
1910− updateLocalOctreeCache(true);
19111905 }
19121906
19131907 void Application::closeMirrorView() {
@@ -2060,7 +2054,7 @@ void Application::updateHoverVoxels(float deltaTime, float& distance, BoxFace& f · 146 unmodified lines
20602054 glm::vec4 oldVoxel(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s);
20612055 // only do this work if MAKE_SOUND_ON_VOXEL_HOVER or MAKE_SOUND_ON_VOXEL_CLICK is enabled,
20622056 // and make sure the tree is not already busy... because otherwise you'll have to wait.
2063− if (!(_voxels.treeIsBusy() || _mousePressed)) {
2057+ if (!_mousePressed) {
20642058 {
20652059 PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels() _voxels.findRayIntersection()");
20662060 _isHoverVoxel = _voxels.findRayIntersection(_mouseRayOrigin, _mouseRayDirection, _hoverVoxel, distance, face);
@@ -2205,9 +2199,6 @@ void Application::updateThreads(float deltaTime) { · 138 unmodified lines
22052199 _voxelHideShowThread.threadRoutine();
22062200 _voxelEditSender.threadRoutine();
22072201 _particleEditSender.threadRoutine();
2208− if (_persistThread) {
2209− _persistThread->threadRoutine();
2210− }
22112202 }
22122203 }
22132204
@@ -2882,7 +2873,8 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 668 unmodified lines
28822873 }
28832874 }
28842875
2885− _avatarManager.renderAvatars(whichCamera.getMode() == CAMERA_MODE_MIRROR, selfAvatarOnly);
2876+ bool renderMyHead = (whichCamera.getInterpolatedMode() != CAMERA_MODE_FIRST_PERSON);
2877+ _avatarManager.renderAvatars(renderMyHead, selfAvatarOnly);
28862878
28872879 if (!selfAvatarOnly) {
28882880 // Render the world box
@@ -3880,10 +3872,6 @@ void Application::domainChanged(const QString& domainHostname) { · 991 unmodified lines
38803872
38813873 // reset the particle renderer
38823874 _particles.clear();
3883−
3884− // reset our persist thread
3885− qDebug() << "Domain changed to" << domainHostname << ". Swapping persist cache.";
3886− updateLocalOctreeCache();
38873875 }
38883876
38893877 void Application::nodeAdded(SharedNodePointer node) {
@@ -4160,49 +4148,6 @@ void Application::initAvatarAndViewFrustum() { · 270 unmodified lines
41604148 updateMyAvatar(0.f);
41614149 }
41624150
4163−QString Application::getLocalVoxelCacheFileName() {
4164− QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
4165− QDir logDir(fileName);
4166− if (!logDir.exists(fileName)) {
4167− logDir.mkdir(fileName);
4168− }
4169−
4170− fileName.append(QString("/hifi.voxelscache."));
4171− fileName.append(_profile.getLastDomain());
4172− fileName.append(QString(".svo"));
4173−
4174− return fileName;
4175−}
4176−
4177−
4178−void Application::updateLocalOctreeCache(bool firstTime) {
4179− // only do this if we've already got a persistThread or we're told this is the first time
4180− if (firstTime || _persistThread) {
4181−
4182− if (_persistThread) {
4183− _persistThread->terminate();
4184− _persistThread->deleteLater();
4185− _persistThread = NULL;
4186− }
4187−
4188− QString localVoxelCacheFileName = getLocalVoxelCacheFileName();
4189− const int LOCAL_CACHE_PERSIST_INTERVAL = 1000 * 10; // every 10 seconds
4190−
4191− if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableLocalVoxelCache)) {
4192− _persistThread = new OctreePersistThread(_voxels.getTree(),
4193− localVoxelCacheFileName.toLocal8Bit().constData(),LOCAL_CACHE_PERSIST_INTERVAL);
4194−
4195− qDebug() << "updateLocalOctreeCache()... localVoxelCacheFileName=" << localVoxelCacheFileName;
4196− }
4197−
4198− if (_persistThread) {
4199− _voxels.beginLoadingLocalVoxelCache(); // while local voxels are importing, don't do individual node VBO updates
4200− connect(_persistThread, SIGNAL(loadCompleted()), &_voxels, SLOT(localVoxelCacheLoaded()));
4201− _persistThread->initialize(true);
4202− }
4203− }
4204−}
4205−
42064151 void Application::checkVersion() {
42074152 QNetworkRequest latestVersionRequest((QUrl(CHECK_VERSION_URL)));
42084153 latestVersionRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);

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