History

merge andrew/thermonuclear into andrew/inertia

Andrew Meadows committed 11 years ago

Commit 6ea766b2 parents 905d7f5 e36ee2a104 files · +745 −398Browse files

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

Unified · Split

interface/src/Application.cpp+35−22
@@ -54,9 +54,12 @@ · 53 unmodified lines
5454
5555 #include <AddressManager.h>
5656 #include <AccountManager.h>
57+#include <AmbientOcclusionEffect.h>
5758 #include <AudioInjector.h>
59+#include <DeferredLightingEffect.h>
5860 #include <DependencyManager.h>
5961 #include <EntityScriptingInterface.h>
62+#include <GlowEffect.h>
6063 #include <HFActionEvent.h>
6164 #include <HFBackEvent.h>
6265 #include <LocalVoxelsList.h>
@@ -65,8 +68,10 @@ · 2 unmodified lines
6568 #include <OctalCode.h>
6669 #include <OctreeSceneStats.h>
6770 #include <PacketHeaders.h>
71+#include <PathUtils.h>
6872 #include <PerfStat.h>
6973 #include <PhysicsEngine.h>
74+#include <ProgramObject.h>
7075 #include <ResourceCache.h>
7176 #include <SoundCache.h>
7277 #include <UserActivityLogger.h>
@@ -86,10 +91,10 @@ · 13 unmodified lines
8691 #include "devices/TV3DManager.h"
8792 #include "devices/Visage.h"
8893
89−#include "renderer/ProgramObject.h"
9094 #include "gpu/Batch.h"
9195 #include "gpu/GLBackend.h"
9296
97+
9398 #include "scripting/AccountScriptingInterface.h"
9499 #include "scripting/AudioDeviceScriptingInterface.h"
95100 #include "scripting/ClipboardScriptingInterface.h"
@@ -108,6 +113,7 @@ · 12 unmodified lines
108113 #include "ui/TextRenderer.h"
109114
110115
116+
111117 using namespace std;
112118
113119 // Starfield information
@@ -134,15 +140,6 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt · 20 unmodified lines
134140 }
135141 }
136142
137−QString& Application::resourcesPath() {
138−#ifdef Q_OS_MAC
139− static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/../Resources/";
140−#else
141− static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/resources/";
142−#endif
143− return staticResourcePath;
144−}
145−
146143 Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
147144 QApplication(argc, argv),
148145 _window(new MainWindow(desktop())),
@@ -198,8 +195,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 49 unmodified lines
198195 _isVSyncOn(true),
199196 _aboutToQuit(false)
200197 {
198+ Model::setViewStateInterface(this); // The model class will sometimes need to know view state details from us
199+
201200 // read the ApplicationInfo.ini file for Name/Version/Domain information
202− QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
201+ QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
203202
204203 // set the associated application properties
205204 applicationInfo.beginGroup("INFO");
@@ -217,7 +216,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 11 unmodified lines
217216
218217 _applicationStartupTime = startup_time;
219218
220− QFontDatabase::addApplicationFont(Application::resourcesPath() + "styles/Inconsolata.otf");
219+ QFontDatabase::addApplicationFont(PathUtils::resourcesPath() + "styles/Inconsolata.otf");
221220 _window->setWindowTitle("Interface");
222221
223222 qInstallMessageHandler(messageHandler);
@@ -714,7 +713,7 @@ void Application::paintGL() { · 490 unmodified lines
714713 TV3DManager::display(*whichCamera);
715714
716715 } else {
717− _glowEffect.prepare();
716+ DependencyManager::get<GlowEffect>()->prepare();
718717
719718 // Viewport is assigned to the size of the framebuffer
720719 QSize size = DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->size();
@@ -733,7 +732,7 @@ void Application::paintGL() { · 12 unmodified lines
733732 renderRearViewMirror(_mirrorViewRect);
734733 }
735734
736− _glowEffect.render();
735+ DependencyManager::get<GlowEffect>()->render();
737736
738737 {
739738 PerformanceTimer perfTimer("renderOverlay");
@@ -1924,9 +1923,8 @@ void Application::init() { · 1184 unmodified lines
19241923
19251924 _environment.init();
19261925
1927− _deferredLightingEffect.init();
1928− _glowEffect.init();
1929− _ambientOcclusionEffect.init();
1926+ DependencyManager::get<DeferredLightingEffect>()->init(this);
1927+ DependencyManager::get<AmbientOcclusionEffect>()->init(this);
19301928
19311929 // TODO: move _myAvatar out of Application. Move relevant code to MyAvataar or AvatarManager
19321930 _avatarManager.init();
@@ -2055,6 +2053,9 @@ void Application::init() { · 122 unmodified lines
20552053
20562054 // make sure our texture cache knows about window size changes
20572055 DependencyManager::get<TextureCache>()->associateWithWidget(getGLWidget());
2056+
2057+ // initialize the GlowEffect with our widget
2058+ DependencyManager::get<GlowEffect>()->init(getGLWidget(), Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect));
20582059 }
20592060
20602061 void Application::closeMirrorView() {
@@ -2956,6 +2957,10 @@ void Application::setupWorldLight() { · 895 unmodified lines
29562957 glMateriali(GL_FRONT, GL_SHININESS, 96);
29572958 }
29582959
2960+bool Application::shouldRenderMesh(float largestDimension, float distanceToCamera) {
2961+ return Menu::getInstance()->shouldRenderMesh(largestDimension, distanceToCamera);
2962+}
2963+
29592964 QImage Application::renderAvatarBillboard() {
29602965 DependencyManager::get<TextureCache>()->getPrimaryFramebufferObject()->bind();
29612966
@@ -3092,7 +3097,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr · 130 unmodified lines
30923097 glEnable(GL_LIGHTING);
30933098 glEnable(GL_DEPTH_TEST);
30943099
3095− _deferredLightingEffect.prepare();
3100+ DependencyManager::get<DeferredLightingEffect>()->prepare();
30963101
30973102 if (!selfAvatarOnly) {
30983103 // draw a red sphere
@@ -3135,7 +3140,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr · 36 unmodified lines
31353140 PerformanceTimer perfTimer("ambientOcclusion");
31363141 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
31373142 "Application::displaySide() ... AmbientOcclusion...");
3138− _ambientOcclusionEffect.render();
3143+ DependencyManager::get<AmbientOcclusionEffect>()->render();
31393144 }
31403145 }
31413146
@@ -3152,7 +3157,7 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly, RenderAr · 10 unmodified lines
31523157 {
31533158 PROFILE_RANGE("DeferredLighting");
31543159 PerformanceTimer perfTimer("lighting");
3155− _deferredLightingEffect.render();
3160+ DependencyManager::get<DeferredLightingEffect>()->render();
31563161 }
31573162
31583163 {
@@ -3257,6 +3262,14 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom · 98 unmodified lines
32573262 }
32583263 }
32593264
3265+bool Application::getShadowsEnabled() {
3266+ return Menu::getInstance()->getShadowsEnabled();
3267+}
3268+
3269+bool Application::getCascadeShadowsEnabled() {
3270+ return Menu::getInstance()->isOptionChecked(MenuOption::CascadedShadows);
3271+}
3272+
32603273 glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
32613274 float horizontalScale = _glWidget->getDeviceWidth() / 2.0f;
32623275 float verticalScale = _glWidget->getDeviceHeight() / 2.0f;
@@ -4025,7 +4038,7 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 762 unmodified lines
40254038 scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance());
40264039 scriptEngine->registerGlobalObject("Settings", SettingsScriptingInterface::getInstance());
40274040 scriptEngine->registerGlobalObject("AudioDevice", AudioDeviceScriptingInterface::getInstance());
4028− scriptEngine->registerGlobalObject("AnimationCache", &_animationCache);
4041+ scriptEngine->registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>());
40294042 scriptEngine->registerGlobalObject("SoundCache", &SoundCache::getInstance());
40304043 scriptEngine->registerGlobalObject("Account", AccountScriptingInterface::getInstance());
40314044 scriptEngine->registerGlobalObject("Metavoxels", &_metavoxels);
@@ -4406,7 +4419,7 @@ void Application::skipVersion(QString latestVersion) { · 374 unmodified lines
44064419
44074420 void Application::takeSnapshot() {
44084421 QMediaPlayer* player = new QMediaPlayer();
4409− QFileInfo inf = QFileInfo(Application::resourcesPath() + "sounds/snap.wav");
4422+ QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
44104423 player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
44114424 player->play();
44124425

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