From 5afe02505b6816e3f44c819047508047902b7bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Tue, 7 Nov 2017 16:12:31 +0100 Subject: [PATCH] hide player in first person 360 screenshot --- apps/openmw/mwinput/inputmanagerimp.cpp | 2 +- apps/openmw/mwrender/renderingmanager.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 192eadbdee..61434521ee 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -1016,7 +1016,7 @@ namespace MWInput void InputManager::screenshot() { // MOVE THIS ELSEWHERE LATER! - int screenshotW = 512; + int screenshotW = 1024; osg::ref_ptr screenshot (new osg::Image); MWBase::Environment::get().getWorld()->screenshot360(screenshot.get(), screenshotW); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index eaee3a8031..4901bc1763 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -636,21 +636,24 @@ namespace MWRender double fovBackup = mFieldOfView; mFieldOfView = 90.0; // each side sees 90 degrees + if (mCamera->isFirstPerson()) + mPlayerAnimation->getObjectRoot()->setNodeMask(0); + for (int i = 0; i < 6; i++) // for each cube side { osg::ref_ptr sideImage (new osg::Image); screenshot(sideImage.get(),w,w,directions[i]); if (i == 0) - { image->allocateImage(w * 6,w,sideImage->r(),sideImage->getPixelFormat(),sideImage->getDataType()); - std::cout << image->s() << " " << image->t() << std::endl; - } osg::copyImage(sideImage.get(),0,0,0,sideImage->s(),sideImage->t(),sideImage->r(), image,w * i,0,0); } + if (mCamera->isFirstPerson()) + mPlayerAnimation->getObjectRoot()->setNodeMask(1); + mFieldOfView = fovBackup; } @@ -667,6 +670,8 @@ namespace MWRender mViewer->getCamera()->getViewMatrix() * osg::Matrixd::rotate(osg::Vec3(0,0,-1),direction) ); +// TODO: water reflections have to be transformed as well!!!!! + rttCamera->setViewport(0, 0, w, h); osg::ref_ptr texture (new osg::Texture2D);