Showing the changes to interface/src/Application.cpp (1 of 56 files). Show all
Unified · Split
| @@ -101,10 +101,12 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D · 100 unmodified lines | ||
| 101 | 101 | |
| 102 | 102 | const int STATS_PELS_PER_LINE = 20; |
| 103 | 103 | |
| 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 | + } | |
| 108 | 110 | } |
| 109 | 111 | |
| 110 | 112 | 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 | ||
| 152 | 154 | _resetRecentMaxPacketsSoon(true), |
| 153 | 155 | _swatch(NULL), |
| 154 | 156 | _pasteMode(false), |
| 155 | − _logger(new FileLogger(this)), | |
| 156 | − _persistThread(NULL) | |
| 157 | + _logger(new FileLogger(this)) | |
| 157 | 158 | { |
| 158 | 159 | _myAvatar = _avatarManager.getMyAvatar(); |
| 159 | 160 | |
| @@ -320,12 +321,7 @@ Application::~Application() { · 160 unmodified lines | ||
| 320 | 321 | _voxelHideShowThread.terminate(); |
| 321 | 322 | _voxelEditSender.terminate(); |
| 322 | 323 | _particleEditSender.terminate(); |
| 323 | − if (_persistThread) { | |
| 324 | − _persistThread->terminate(); | |
| 325 | − _persistThread->deleteLater(); | |
| 326 | − _persistThread = NULL; | |
| 327 | − } | |
| 328 | − | |
| 324 | + | |
| 329 | 325 | storeSizeAndPosition(); |
| 330 | 326 | saveScripts(); |
| 331 | 327 | _sharedVoxelSystem.changeTree(new VoxelTree); |
| @@ -1266,7 +1262,8 @@ void Application::mousePressEvent(QMouseEvent* event) { · 934 unmodified lines | ||
| 1266 | 1262 | pasteVoxels(); |
| 1267 | 1263 | } |
| 1268 | 1264 | |
| 1269 | − if (MAKE_SOUND_ON_VOXEL_CLICK && _isHoverVoxel && !_isHoverVoxelSounding) { | |
| 1265 | + if (!Menu::getInstance()->isOptionChecked(MenuOption::VoxelDeleteMode) && | |
| 1266 | + MAKE_SOUND_ON_VOXEL_CLICK && _isHoverVoxel && !_isHoverVoxelSounding) { | |
| 1270 | 1267 | _hoverVoxelOriginalColor[0] = _hoverVoxel.red; |
| 1271 | 1268 | _hoverVoxelOriginalColor[1] = _hoverVoxel.green; |
| 1272 | 1269 | _hoverVoxelOriginalColor[2] = _hoverVoxel.blue; |
| @@ -1905,9 +1902,6 @@ void Application::init() { · 632 unmodified lines | ||
| 1905 | 1902 | connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); |
| 1906 | 1903 | connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); |
| 1907 | 1904 | connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors())); |
| 1908 | − | |
| 1909 | − | |
| 1910 | − updateLocalOctreeCache(true); | |
| 1911 | 1905 | } |
| 1912 | 1906 | |
| 1913 | 1907 | void Application::closeMirrorView() { |
| @@ -2060,7 +2054,7 @@ void Application::updateHoverVoxels(float deltaTime, float& distance, BoxFace& f · 146 unmodified lines | ||
| 2060 | 2054 | glm::vec4 oldVoxel(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s); |
| 2061 | 2055 | // only do this work if MAKE_SOUND_ON_VOXEL_HOVER or MAKE_SOUND_ON_VOXEL_CLICK is enabled, |
| 2062 | 2056 | // and make sure the tree is not already busy... because otherwise you'll have to wait. |
| 2063 | − if (!(_voxels.treeIsBusy() || _mousePressed)) { | |
| 2057 | + if (!_mousePressed) { | |
| 2064 | 2058 | { |
| 2065 | 2059 | PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels() _voxels.findRayIntersection()"); |
| 2066 | 2060 | _isHoverVoxel = _voxels.findRayIntersection(_mouseRayOrigin, _mouseRayDirection, _hoverVoxel, distance, face); |
| @@ -2205,9 +2199,6 @@ void Application::updateThreads(float deltaTime) { · 138 unmodified lines | ||
| 2205 | 2199 | _voxelHideShowThread.threadRoutine(); |
| 2206 | 2200 | _voxelEditSender.threadRoutine(); |
| 2207 | 2201 | _particleEditSender.threadRoutine(); |
| 2208 | − if (_persistThread) { | |
| 2209 | − _persistThread->threadRoutine(); | |
| 2210 | − } | |
| 2211 | 2202 | } |
| 2212 | 2203 | } |
| 2213 | 2204 | |
| @@ -2882,7 +2873,8 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 668 unmodified lines | ||
| 2882 | 2873 | } |
| 2883 | 2874 | } |
| 2884 | 2875 | |
| 2885 | − _avatarManager.renderAvatars(whichCamera.getMode() == CAMERA_MODE_MIRROR, selfAvatarOnly); | |
| 2876 | + bool renderMyHead = (whichCamera.getInterpolatedMode() != CAMERA_MODE_FIRST_PERSON); | |
| 2877 | + _avatarManager.renderAvatars(renderMyHead, selfAvatarOnly); | |
| 2886 | 2878 | |
| 2887 | 2879 | if (!selfAvatarOnly) { |
| 2888 | 2880 | // Render the world box |
| @@ -3880,10 +3872,6 @@ void Application::domainChanged(const QString& domainHostname) { · 991 unmodified lines | ||
| 3880 | 3872 | |
| 3881 | 3873 | // reset the particle renderer |
| 3882 | 3874 | _particles.clear(); |
| 3883 | − | |
| 3884 | − // reset our persist thread | |
| 3885 | − qDebug() << "Domain changed to" << domainHostname << ". Swapping persist cache."; | |
| 3886 | − updateLocalOctreeCache(); | |
| 3887 | 3875 | } |
| 3888 | 3876 | |
| 3889 | 3877 | void Application::nodeAdded(SharedNodePointer node) { |
| @@ -4160,49 +4148,6 @@ void Application::initAvatarAndViewFrustum() { · 270 unmodified lines | ||
| 4160 | 4148 | updateMyAvatar(0.f); |
| 4161 | 4149 | } |
| 4162 | 4150 | |
| 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 | − | |
| 4206 | 4151 | void Application::checkVersion() { |
| 4207 | 4152 | QNetworkRequest latestVersionRequest((QUrl(CHECK_VERSION_URL))); |
| 4208 | 4153 | latestVersionRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); |