History

merge with hifi/plugins

Sam Gondelman committed 11 years ago

Commit f69b7552 parents 8fbbb26 95000ee231 files · +6439 −5987Browse files

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

Unified · Split

interface/src/Application.cpp+79−8
@@ -93,6 +93,7 @@ · 92 unmodified lines
93#include <SceneScriptingInterface.h>93#include <SceneScriptingInterface.h>
94#include <ScriptCache.h>94#include <ScriptCache.h>
95#include <SettingHandle.h>95#include <SettingHandle.h>
96#include <SimpleAverage.h>
96#include <SoundCache.h>97#include <SoundCache.h>
97#include <TextRenderer.h>98#include <TextRenderer.h>
98#include <Tooltip.h>99#include <Tooltip.h>
@@ -196,6 +197,7 @@ using namespace std; · 97 unmodified lines
196// Starfield information197// Starfield information
197static unsigned STARFIELD_NUM_STARS = 50000;198static unsigned STARFIELD_NUM_STARS = 50000;
198static unsigned STARFIELD_SEED = 1;199static unsigned STARFIELD_SEED = 1;
200static uint8_t THROTTLED_IDLE_TIMER_DELAY = 10;
199 201
200const qint64 MAXIMUM_CACHE_SIZE = 10 * BYTES_PER_GIGABYTES; // 10GB202const qint64 MAXIMUM_CACHE_SIZE = 10 * BYTES_PER_GIGABYTES; // 10GB
201 203
@@ -1087,6 +1089,7 @@ void Application::paintGL() { · 885 unmodified lines
1087 uvec2 finalSize = toGlm(size);1089 uvec2 finalSize = toGlm(size);
1088 // Ensure the rendering context commands are completed when rendering 1090 // Ensure the rendering context commands are completed when rendering
1089 GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);1091 GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
1092 glFinish();
1090 _offscreenContext->doneCurrent();1093 _offscreenContext->doneCurrent();
1091 Q_ASSERT(!QOpenGLContext::currentContext());1094 Q_ASSERT(!QOpenGLContext::currentContext());
1092 displayPlugin->preDisplay();1095 displayPlugin->preDisplay();
@@ -1130,7 +1133,6 @@ void Application::showEditEntitiesHelp() { · 37 unmodified lines
1130 InfoView::show(INFO_EDIT_ENTITIES_PATH);1133 InfoView::show(INFO_EDIT_ENTITIES_PATH);
1131}1134}
1132 1135
1133
1134void Application::resizeEvent(QResizeEvent * event) {1136void Application::resizeEvent(QResizeEvent * event) {
1135 resizeGL();1137 resizeGL();
1136}1138}
@@ -1258,6 +1260,54 @@ bool Application::eventFilter(QObject* object, QEvent* event) { · 121 unmodified lines
1258 return true;1260 return true;
1259 }1261 }
1260 }1262 }
1263
1264 if (object == _glWindow) {
1265 auto offscreenUi = DependencyManager::get<OffscreenUi>();
1266 if (offscreenUi->eventFilter(object, event)) {
1267 return true;
1268 }
1269 switch (event->type()) {
1270 case QEvent::MouseMove:
1271 mouseMoveEvent((QMouseEvent*)event);
1272 return true;
1273 case QEvent::MouseButtonPress:
1274 mousePressEvent((QMouseEvent*)event);
1275 return true;
1276 case QEvent::MouseButtonDblClick:
1277 mouseDoublePressEvent((QMouseEvent*)event);
1278 return true;
1279 case QEvent::MouseButtonRelease:
1280 mouseReleaseEvent((QMouseEvent*)event);
1281 return true;
1282 case QEvent::KeyPress:
1283 keyPressEvent((QKeyEvent*)event);
1284 return true;
1285 case QEvent::KeyRelease:
1286 keyReleaseEvent((QKeyEvent*)event);
1287 return true;
1288 case QEvent::FocusOut:
1289 focusOutEvent((QFocusEvent*)event);
1290 return true;
1291 case QEvent::TouchBegin:
1292 touchBeginEvent(static_cast<QTouchEvent*>(event));
1293 event->accept();
1294 return true;
1295 case QEvent::TouchEnd:
1296 touchEndEvent(static_cast<QTouchEvent*>(event));
1297 return true;
1298 case QEvent::TouchUpdate:
1299 touchUpdateEvent(static_cast<QTouchEvent*>(event));
1300 return true;
1301 case QEvent::Wheel:
1302 wheelEvent(static_cast<QWheelEvent*>(event));
1303 return true;
1304 case QEvent::Drop:
1305 dropEvent(static_cast<QDropEvent*>(event));
1306 return true;
1307 default:
1308 break;
1309 }
1310 }
1261 return false;1311 return false;
1262}1312}
1263 1313
@@ -1848,8 +1898,24 @@ void Application::checkFPS() { · 584 unmodified lines
1848}1898}
1849 1899
1850void Application::idle() {1900void Application::idle() {
1851 PerformanceTimer perfTimer("idle");1901 static SimpleAverage<float> interIdleDurations;
1902 static uint64_t lastIdleEnd{ 0 };
1903
1904 if (lastIdleEnd != 0) {
1905 uint64_t now = usecTimestampNow();
1906 interIdleDurations.update(now - lastIdleEnd);
1907 static uint64_t lastReportTime = now;
1908 if ((now - lastReportTime) >= (USECS_PER_SECOND)) {
1909 static QString LOGLINE("Average inter-idle time: %1 us for %2 samples");
1910 if (Menu::getInstance()->isOptionChecked(MenuOption::LogExtraTimings)) {
1911 qCDebug(interfaceapp_timing) << LOGLINE.arg((int)interIdleDurations.getAverage()).arg(interIdleDurations.getCount());
1912 }
1913 interIdleDurations.reset();
1914 lastReportTime = now;
1915 }
1916 }
1852 1917
1918 PerformanceTimer perfTimer("idle");
1853 if (_aboutToQuit) {1919 if (_aboutToQuit) {
1854 return; // bail early, nothing to do here.1920 return; // bail early, nothing to do here.
1855 }1921 }
@@ -1892,13 +1958,15 @@ void Application::idle() { · 36 unmodified lines
1892 _idleLoopStdev.reset();1958 _idleLoopStdev.reset();
1893 }1959 }
1894 1960
1895 // After finishing all of the above work, restart the idle timer, allowing 2ms to process events.
1896 idleTimer->start(2);
1897 }1961 }
1898 }1962 // After finishing all of the above work, ensure the idle timer is set to the proper interval,
1963 // depending on whether we're throttling or not
1964 idleTimer->start(getActiveDisplayPlugin()->isThrottled() ? THROTTLED_IDLE_TIMER_DELAY : 0);
1965 }
1899 1966
1900 // check for any requested background downloads.1967 // check for any requested background downloads.
1901 emit checkBackgroundDownloads();1968 emit checkBackgroundDownloads();
1969 lastIdleEnd = usecTimestampNow();
1902}1970}
1903 1971
1904#if 01972#if 0
@@ -2269,6 +2337,7 @@ void Application::init() { · 364 unmodified lines
2269 2337
2270 // Make sure any new sounds are loaded as soon as know about them.2338 // Make sure any new sounds are loaded as soon as know about them.
2271 connect(tree, &EntityTree::newCollisionSoundURL, DependencyManager::get<SoundCache>().data(), &SoundCache::getSound);2339 connect(tree, &EntityTree::newCollisionSoundURL, DependencyManager::get<SoundCache>().data(), &SoundCache::getSound);
2340 connect(_myAvatar, &MyAvatar::newCollisionSoundURL, DependencyManager::get<SoundCache>().data(), &SoundCache::getSound);
2272}2341}
2273 2342
2274void Application::closeMirrorView() {2343void Application::closeMirrorView() {
@@ -3588,6 +3657,8 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 1313 unmodified lines
3588 renderContext._maxDrawnTransparentItems = sceneInterface->getEngineMaxDrawnTransparentItems();3657 renderContext._maxDrawnTransparentItems = sceneInterface->getEngineMaxDrawnTransparentItems();
3589 renderContext._maxDrawnOverlay3DItems = sceneInterface->getEngineMaxDrawnOverlay3DItems();3658 renderContext._maxDrawnOverlay3DItems = sceneInterface->getEngineMaxDrawnOverlay3DItems();
3590 3659
3660 renderContext._drawItemStatus = sceneInterface->doEngineDisplayItemStatus();
3661
3591 renderArgs->_shouldRender = LODManager::shouldRender;3662 renderArgs->_shouldRender = LODManager::shouldRender;
3592 3663
3593 renderContext.args = renderArgs;3664 renderContext.args = renderArgs;
@@ -3609,7 +3680,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se · 15 unmodified lines
3609 }3680 }
3610 //Render the sixense lasers3681 //Render the sixense lasers
3611 if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) {3682 if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) {
3612 _myAvatar->renderLaserPointers();3683 _myAvatar->renderLaserPointers(*renderArgs->_batch);
3613 }3684 }
3614 3685
3615 if (!selfAvatarOnly) {3686 if (!selfAvatarOnly) {
@@ -4877,8 +4948,8 @@ void Application::updateDisplayMode() { · 1261 unmodified lines
4877 DisplayPluginPointer oldDisplayPlugin = _displayPlugin;4948 DisplayPluginPointer oldDisplayPlugin = _displayPlugin;
4878 if (oldDisplayPlugin != newDisplayPlugin) {4949 if (oldDisplayPlugin != newDisplayPlugin) {
4879 if (oldDisplayPlugin) {4950 if (oldDisplayPlugin) {
4880 oldDisplayPlugin->removeEventFilter(offscreenUi.data());
4881 oldDisplayPlugin->removeEventFilter(qApp);4951 oldDisplayPlugin->removeEventFilter(qApp);
4952 oldDisplayPlugin->removeEventFilter(offscreenUi.data());
4882 }4953 }
4883 4954
4884 if (!_currentDisplayPluginActions.isEmpty()) {4955 if (!_currentDisplayPluginActions.isEmpty()) {
@@ -4894,8 +4965,8 @@ void Application::updateDisplayMode() { · 9 unmodified lines
4894 newDisplayPlugin->activate(this);4965 newDisplayPlugin->activate(this);
4895 4966
4896 _offscreenContext->makeCurrent();4967 _offscreenContext->makeCurrent();
4897 newDisplayPlugin->installEventFilter(offscreenUi.data());
4898 newDisplayPlugin->installEventFilter(qApp);4968 newDisplayPlugin->installEventFilter(qApp);
4969 newDisplayPlugin->installEventFilter(offscreenUi.data());
4899 QWindow* pluginWindow = newDisplayPlugin->getWindow();4970 QWindow* pluginWindow = newDisplayPlugin->getWindow();
4900 if (pluginWindow) {4971 if (pluginWindow) {
4901 DependencyManager::get<OffscreenUi>()->setProxyWindow(pluginWindow);4972 DependencyManager::get<OffscreenUi>()->setProxyWindow(pluginWindow);

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