History

Merge remote-tracking branch 'upstream/master' into smarter_textures

Brad Davis committed 9 years ago

Commit e482eac2 parents 5a6478c 92e3f87123 files · +3184 −1521Browse files

Showing the changes to interface/src/ui/ApplicationOverlay.cpp (1 of 123 files). Show all

Unified · Split

interface/src/ui/ApplicationOverlay.cpp+0−43
@@ -13,7 +13,6 @@ · 12 unmodified lines
13 13
14#include <avatar/AvatarManager.h>14#include <avatar/AvatarManager.h>
15#include <GLMHelpers.h>15#include <GLMHelpers.h>
16#include <FramebufferCache.h>
17#include <GLMHelpers.h>16#include <GLMHelpers.h>
18#include <OffscreenUi.h>17#include <OffscreenUi.h>
19#include <CursorManager.h>18#include <CursorManager.h>
@@ -42,7 +41,6 @@ ApplicationOverlay::ApplicationOverlay() · 22 unmodified lines
42 _domainStatusBorder = geometryCache->allocateID();41 _domainStatusBorder = geometryCache->allocateID();
43 _magnifierBorder = geometryCache->allocateID();42 _magnifierBorder = geometryCache->allocateID();
44 _qmlGeometryId = geometryCache->allocateID();43 _qmlGeometryId = geometryCache->allocateID();
45 _rearViewGeometryId = geometryCache->allocateID();
46}44}
47 45
48ApplicationOverlay::~ApplicationOverlay() {46ApplicationOverlay::~ApplicationOverlay() {
@@ -51,7 +49,6 @@ ApplicationOverlay::~ApplicationOverlay() { · 2 unmodified lines
51 geometryCache->releaseID(_domainStatusBorder);49 geometryCache->releaseID(_domainStatusBorder);
52 geometryCache->releaseID(_magnifierBorder);50 geometryCache->releaseID(_magnifierBorder);
53 geometryCache->releaseID(_qmlGeometryId);51 geometryCache->releaseID(_qmlGeometryId);
54 geometryCache->releaseID(_rearViewGeometryId);
55 }52 }
56}53}
57 54
@@ -86,7 +83,6 @@ void ApplicationOverlay::renderOverlay(RenderArgs* renderArgs) { · 28 unmodified lines
86 // Now render the overlay components together into a single texture83 // Now render the overlay components together into a single texture
87 renderDomainConnectionStatusBorder(renderArgs); // renders the connected domain line84 renderDomainConnectionStatusBorder(renderArgs); // renders the connected domain line
88 renderAudioScope(renderArgs); // audio scope in the very back - NOTE: this is the debug audio scope, not the VU meter85 renderAudioScope(renderArgs); // audio scope in the very back - NOTE: this is the debug audio scope, not the VU meter
89 renderRearView(renderArgs); // renders the mirror view selfie
90 renderOverlays(renderArgs); // renders Scripts Overlay and AudioScope86 renderOverlays(renderArgs); // renders Scripts Overlay and AudioScope
91 renderQmlUi(renderArgs); // renders a unit quad with the QML UI texture, and the text overlays from scripts87 renderQmlUi(renderArgs); // renders a unit quad with the QML UI texture, and the text overlays from scripts
92 renderStatsAndLogs(renderArgs); // currently renders nothing88 renderStatsAndLogs(renderArgs); // currently renders nothing
@@ -163,45 +159,6 @@ void ApplicationOverlay::renderOverlays(RenderArgs* renderArgs) { · 70 unmodified lines
163 qApp->getOverlays().renderHUD(renderArgs);159 qApp->getOverlays().renderHUD(renderArgs);
164}160}
165 161
166void ApplicationOverlay::renderRearViewToFbo(RenderArgs* renderArgs) {
167}
168
169void ApplicationOverlay::renderRearView(RenderArgs* renderArgs) {
170 if (!qApp->isHMDMode() && Menu::getInstance()->isOptionChecked(MenuOption::MiniMirror) &&
171 !Menu::getInstance()->isOptionChecked(MenuOption::FullscreenMirror)) {
172 gpu::Batch& batch = *renderArgs->_batch;
173
174 auto geometryCache = DependencyManager::get<GeometryCache>();
175
176 auto framebuffer = DependencyManager::get<FramebufferCache>();
177 auto selfieTexture = framebuffer->getSelfieFramebuffer()->getRenderBuffer(0);
178
179 int width = renderArgs->_viewport.z;
180 int height = renderArgs->_viewport.w;
181 mat4 legacyProjection = glm::ortho<float>(0, width, height, 0, ORTHO_NEAR_CLIP, ORTHO_FAR_CLIP);
182 batch.setProjectionTransform(legacyProjection);
183 batch.setModelTransform(Transform());
184 batch.resetViewTransform();
185
186 float screenRatio = ((float)qApp->getDevicePixelRatio());
187 float renderRatio = ((float)qApp->getRenderResolutionScale());
188
189 auto viewport = qApp->getMirrorViewRect();
190 glm::vec2 bottomLeft(viewport.left(), viewport.top() + viewport.height());
191 glm::vec2 topRight(viewport.left() + viewport.width(), viewport.top());
192 bottomLeft *= screenRatio;
193 topRight *= screenRatio;
194 glm::vec2 texCoordMinCorner(0.0f, 0.0f);
195 glm::vec2 texCoordMaxCorner(viewport.width() * renderRatio / float(selfieTexture->getWidth()), viewport.height() * renderRatio / float(selfieTexture->getHeight()));
196
197 batch.setResourceTexture(0, selfieTexture);
198 float alpha = DependencyManager::get<OffscreenUi>()->getDesktop()->property("unpinnedAlpha").toFloat();
199 geometryCache->renderQuad(batch, bottomLeft, topRight, texCoordMinCorner, texCoordMaxCorner, glm::vec4(1.0f, 1.0f, 1.0f, alpha), _rearViewGeometryId);
200
201 batch.setResourceTexture(0, renderArgs->_whiteTexture);
202 }
203}
204
205void ApplicationOverlay::renderStatsAndLogs(RenderArgs* renderArgs) {162void ApplicationOverlay::renderStatsAndLogs(RenderArgs* renderArgs) {
206 163
207 // Display stats and log text onscreen164 // Display stats and log text onscreen