History

move TextureCache out of interface and Application

ZappoMan committed 11 years ago

Commit e253b8a1 parent 0b85a4c10 files · +49 −20Browse files

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

Unified · Split

interface/src/Application.cpp+10−5
@@ -177,6 +177,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 176 unmodified lines
177177 _touchAvgY(0.0f),
178178 _isTouchPressed(false),
179179 _mousePressed(false),
180+ _textureCache(NULL),
180181 _audio(),
181182 _enableProcessVoxelsThread(true),
182183 _octreeProcessor(),
@@ -194,6 +195,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 11 unmodified lines
194195 _isVSyncOn(true),
195196 _aboutToQuit(false)
196197 {
198+ _textureCache = TextureCache::getInstance();
197199
198200 // read the ApplicationInfo.ini file for Name/Version/Domain information
199201 QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
@@ -621,10 +623,10 @@ void Application::paintGL() { · 421 unmodified lines
621623 // Set the desired FBO texture size. If it hasn't changed, this does nothing.
622624 // Otherwise, it must rebuild the FBOs
623625 if (OculusManager::isConnected()) {
624− _textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize());
626+ _textureCache->setFrameBufferSize(OculusManager::getRenderTargetSize());
625627 } else {
626628 QSize fbSize = _glWidget->getDeviceSize() * getRenderResolutionScale();
627− _textureCache.setFrameBufferSize(fbSize);
629+ _textureCache->setFrameBufferSize(fbSize);
628630 }
629631
630632 glEnable(GL_LINE_SMOOTH);
@@ -2042,6 +2044,9 @@ void Application::init() { · 1411 unmodified lines
20422044
20432045 // save settings when avatar changes
20442046 connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings);
2047+
2048+ // make sure our texture cache knows about window size changes
2049+ _textureCache->associateWithWidget(getGLWidget());
20452050 }
20462051
20472052 void Application::closeMirrorView() {
@@ -2772,7 +2777,7 @@ glm::vec3 Application::getSunDirection() { · 724 unmodified lines
27722777
27732778 void Application::updateShadowMap() {
27742779 PerformanceTimer perfTimer("shadowMap");
2775− QOpenGLFramebufferObject* fbo = _textureCache.getShadowFramebufferObject();
2780+ QOpenGLFramebufferObject* fbo = _textureCache->getShadowFramebufferObject();
27762781 fbo->bind();
27772782 glEnable(GL_DEPTH_TEST);
27782783 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -2937,7 +2942,7 @@ void Application::setupWorldLight() { · 158 unmodified lines
29372942 }
29382943
29392944 QImage Application::renderAvatarBillboard() {
2940− _textureCache.getPrimaryFramebufferObject()->bind();
2945+ _textureCache->getPrimaryFramebufferObject()->bind();
29412946
29422947 // the "glow" here causes an alpha of one
29432948 Glower glower;
@@ -2948,7 +2953,7 @@ QImage Application::renderAvatarBillboard() { · 4 unmodified lines
29482953 QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32);
29492954 glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits());
29502955
2951− _textureCache.getPrimaryFramebufferObject()->release();
2956+ _textureCache->getPrimaryFramebufferObject()->release();
29522957
29532958 return image;
29542959 }

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