Working on overlays

This commit is contained in:
Brad Davis 2015-06-17 16:06:06 -07:00
parent f2261b5ed5
commit 8a1b519071
4 changed files with 27 additions and 14 deletions

View file

@ -151,6 +151,7 @@
#include "ui/AddressBarDialog.h" #include "ui/AddressBarDialog.h"
#include "ui/UpdateDialog.h" #include "ui/UpdateDialog.h"
static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f;
// ON WIndows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU // ON WIndows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
@ -932,13 +933,15 @@ void Application::paintGL() {
} }
} else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { } else if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
#if 0 // TODO put the mirror modifiers somewhere both the app and the overlay can access it
float _rotateMirror = 0.0f;
float _raiseMirror = 0.0f;
float _scaleMirror = 1.0f;
_myCamera.setRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f))); _myCamera.setRotation(_myAvatar->getWorldAlignedOrientation() * glm::quat(glm::vec3(0.0f, PI + _rotateMirror, 0.0f)));
_myCamera.setPosition(_myAvatar->getDefaultEyePosition() + _myCamera.setPosition(_myAvatar->getDefaultEyePosition() +
glm::vec3(0, _raiseMirror * _myAvatar->getScale(), 0) + glm::vec3(0, _raiseMirror * _myAvatar->getScale(), 0) +
(_myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) * (_myAvatar->getOrientation() * glm::quat(glm::vec3(0.0f, _rotateMirror, 0.0f))) *
glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror); glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_FULLSCREEN_DISTANCE * _scaleMirror);
#endif
} }
// Update camera position // Update camera position

View file

@ -610,7 +610,7 @@ void OculusManager::display(QGLWidget * glCanvas, RenderArgs* renderArgs, const
glViewport(vp.Pos.x, vp.Pos.y, vp.Size.w, vp.Size.h); glViewport(vp.Pos.x, vp.Pos.y, vp.Size.w, vp.Size.h);
renderArgs->_renderSide = RenderArgs::MONO; renderArgs->_renderSide = RenderArgs::MONO;
qApp->displaySide(renderArgs, *_camera, false); qApp->displaySide(renderArgs, *_camera);
//qApp->getApplicationCompositor().displayOverlayTexture(renderArgs); //qApp->getApplicationCompositor().displayOverlayTexture(renderArgs);
qApp->getApplicationCompositor().displayOverlayTextureHmd(renderArgs, eye); qApp->getApplicationCompositor().displayOverlayTextureHmd(renderArgs, eye);
}); });

View file

@ -191,6 +191,11 @@ void ApplicationCompositor::displayOverlayTexture(RenderArgs* renderArgs) {
return; return;
} }
GLuint texture = qApp->getApplicationOverlay().getOverlayTexture();
if (!texture) {
return;
}
updateTooltips(); updateTooltips();
vec2 canvasSize = qApp->getCanvasSize(); vec2 canvasSize = qApp->getCanvasSize();
@ -198,10 +203,6 @@ void ApplicationCompositor::displayOverlayTexture(RenderArgs* renderArgs) {
//Handle fading and deactivation/activation of UI //Handle fading and deactivation/activation of UI
gpu::Batch batch; gpu::Batch batch;
GLuint texture = qApp->getApplicationOverlay().getOverlayTexture();
if (!texture) {
return;
}
renderArgs->_context->syncCache(); renderArgs->_context->syncCache();
auto geometryCache = DependencyManager::get<GeometryCache>(); auto geometryCache = DependencyManager::get<GeometryCache>();
@ -262,28 +263,38 @@ void ApplicationCompositor::displayOverlayTextureHmd(RenderArgs* renderArgs, int
return; return;
} }
updateTooltips();
vec2 canvasSize = qApp->getCanvasSize(); vec2 canvasSize = qApp->getCanvasSize();
_textureAspectRatio = aspect(canvasSize); _textureAspectRatio = aspect(canvasSize);
updateTooltips();
renderArgs->_context->syncCache(); renderArgs->_context->syncCache();
auto geometryCache = DependencyManager::get<GeometryCache>(); auto geometryCache = DependencyManager::get<GeometryCache>();
gpu::Batch batch; gpu::Batch batch;
DependencyManager::get<GeometryCache>()->useSimpleDrawPipeline(batch); geometryCache->useSimpleDrawPipeline(batch);
batch._glDisable(GL_DEPTH_TEST); batch._glDisable(GL_DEPTH_TEST);
batch._glDisable(GL_CULL_FACE); batch._glDisable(GL_CULL_FACE);
batch._glBindTexture(GL_TEXTURE_2D, texture); batch._glBindTexture(GL_TEXTURE_2D, texture);
batch._glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); batch._glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
batch._glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); batch._glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
batch.setViewTransform(Transform()); batch.setViewTransform(Transform());
batch.setProjectionTransform(qApp->getEyeProjection(eye)); batch.setProjectionTransform(qApp->getEyeProjection(eye));
mat4 eyePose = qApp->getEyePose(eye); mat4 eyePose = qApp->getEyePose(eye);
glm::mat4 overlayXfm = glm::inverse(eyePose); glm::mat4 overlayXfm = glm::inverse(eyePose);
batch.setModelTransform(overlayXfm);
drawSphereSection(batch); #ifdef DEBUG_OVERLAY
{
batch.setModelTransform(glm::translate(mat4(), vec3(0, 0, -2)));
geometryCache->renderUnitQuad(batch, glm::vec4(1));
}
#else
{
batch.setModelTransform(overlayXfm);
drawSphereSection(batch);
}
#endif
// Doesn't actually render // Doesn't actually render
renderPointers(batch); renderPointers(batch);

View file

@ -46,7 +46,6 @@ static const int MIRROR_VIEW_LEFT_PADDING = 10;
static const int MIRROR_VIEW_WIDTH = 265; static const int MIRROR_VIEW_WIDTH = 265;
static const int MIRROR_VIEW_HEIGHT = 215; static const int MIRROR_VIEW_HEIGHT = 215;
static const int STATS_HORIZONTAL_OFFSET = MIRROR_VIEW_WIDTH + MIRROR_VIEW_LEFT_PADDING * 2; static const int STATS_HORIZONTAL_OFFSET = MIRROR_VIEW_WIDTH + MIRROR_VIEW_LEFT_PADDING * 2;
static const float MIRROR_FULLSCREEN_DISTANCE = 0.389f;
static const float MIRROR_REARVIEW_DISTANCE = 0.722f; static const float MIRROR_REARVIEW_DISTANCE = 0.722f;
static const float MIRROR_REARVIEW_BODY_DISTANCE = 2.56f; static const float MIRROR_REARVIEW_BODY_DISTANCE = 2.56f;
static const float MIRROR_FIELD_OF_VIEW = 30.0f; static const float MIRROR_FIELD_OF_VIEW = 30.0f;