Merge pull request #7947 from ZappoMan/zzmp-fix/avatar-inputs-pos

fix AvatarInputs spawning on bottom-left
This commit is contained in:
Brad Hefta-Gaub 2016-05-20 08:59:54 -07:00
commit 1cce891f7c
2 changed files with 9 additions and 9 deletions

View file

@ -1510,17 +1510,17 @@ void Application::paintGL() {
renderArgs._context->syncCache(); renderArgs._context->syncCache();
} }
if (Menu::getInstance()->isOptionChecked(MenuOption::MiniMirror)) { auto inputs = AvatarInputs::getInstance();
if (inputs->mirrorVisible()) {
PerformanceTimer perfTimer("Mirror"); PerformanceTimer perfTimer("Mirror");
auto primaryFbo = DependencyManager::get<FramebufferCache>()->getPrimaryFramebuffer(); auto primaryFbo = DependencyManager::get<FramebufferCache>()->getPrimaryFramebuffer();
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE; renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
renderArgs._blitFramebuffer = DependencyManager::get<FramebufferCache>()->getSelfieFramebuffer(); renderArgs._blitFramebuffer = DependencyManager::get<FramebufferCache>()->getSelfieFramebuffer();
auto inputs = AvatarInputs::getInstance();
_mirrorViewRect.moveTo(inputs->x(), inputs->y()); _mirrorViewRect.moveTo(inputs->x(), inputs->y());
renderRearViewMirror(&renderArgs, _mirrorViewRect); renderRearViewMirror(&renderArgs, _mirrorViewRect, inputs->mirrorZoomed());
renderArgs._blitFramebuffer.reset(); renderArgs._blitFramebuffer.reset();
renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE; renderArgs._renderMode = RenderArgs::DEFAULT_RENDER_MODE;
@ -1839,6 +1839,9 @@ bool Application::event(QEvent* event) {
idle(); idle();
return true; return true;
} else if ((int)event->type() == (int)Paint) { } else if ((int)event->type() == (int)Paint) {
// NOTE: This must be updated as close to painting as possible,
// or AvatarInputs will mysteriously move to the bottom-right
AvatarInputs::getInstance()->update();
justPresented = true; justPresented = true;
paintGL(); paintGL();
return true; return true;
@ -2670,9 +2673,6 @@ void Application::idle() {
firstIdle = false; firstIdle = false;
connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop); connect(offscreenUi.data(), &OffscreenUi::showDesktop, this, &Application::showDesktop);
_overlayConductor.setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Overlays)); _overlayConductor.setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Overlays));
} else {
// FIXME: AvatarInputs are positioned incorrectly if instantiated before the first paint
AvatarInputs::getInstance()->update();
} }
PROFILE_RANGE(__FUNCTION__); PROFILE_RANGE(__FUNCTION__);
@ -4101,7 +4101,7 @@ void Application::displaySide(RenderArgs* renderArgs, Camera& theCamera, bool se
activeRenderingThread = nullptr; activeRenderingThread = nullptr;
} }
void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& region) { void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& region, bool isZoomed) {
auto originalViewport = renderArgs->_viewport; auto originalViewport = renderArgs->_viewport;
// Grab current viewport to reset it at the end // Grab current viewport to reset it at the end
@ -4111,7 +4111,7 @@ void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& regi
auto myAvatar = getMyAvatar(); auto myAvatar = getMyAvatar();
// bool eyeRelativeCamera = false; // bool eyeRelativeCamera = false;
if (!AvatarInputs::getInstance()->mirrorZoomed()) { if (!isZoomed) {
_mirrorCamera.setPosition(myAvatar->getChestPosition() + _mirrorCamera.setPosition(myAvatar->getChestPosition() +
myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * myAvatar->getScale()); myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * myAvatar->getScale());

View file

@ -342,7 +342,7 @@ private:
glm::vec3 getSunDirection() const; glm::vec3 getSunDirection() const;
void renderRearViewMirror(RenderArgs* renderArgs, const QRect& region); void renderRearViewMirror(RenderArgs* renderArgs, const QRect& region, bool isZoomed);
int sendNackPackets(); int sendNackPackets();