basic setup for 360 screenshots

0.6.3
Miloslav Číž 7 years ago
parent 5e69f6033f
commit 7feba7e498

@ -450,6 +450,7 @@ namespace MWBase
/// \todo this does not belong here
virtual void screenshot (osg::Image* image, int w, int h) = 0;
virtual void screenshot360 (osg::Image* image, int w) = 0;
/// Find default position inside exterior cell specified by name
/// \return false if exterior with given name not exists, true otherwise

@ -1,6 +1,7 @@
#include "inputmanagerimp.hpp"
#include <osgViewer/ViewerEventHandlers>
#include <osgDB/Registry>
#include <MyGUI_InputManager.h>
#include <MyGUI_RenderManager.h>
@ -1014,10 +1015,36 @@ namespace MWInput
void InputManager::screenshot()
{
mScreenCaptureHandler->setFramesToCapture(1);
mScreenCaptureHandler->captureNextFrame(*mViewer);
// MOVE THIS ELSEWHERE LATER!
int screenshotW = 512;
osg::ref_ptr<osg::Image> screenshot (new osg::Image);
MWBase::Environment::get().getWorld()->screenshot360(screenshot.get(), screenshotW);
MWBase::Environment::get().getWindowManager()->messageBox ("Screenshot saved");
osgDB::ReaderWriter* readerwriter = osgDB::Registry::instance()->getReaderWriterForExtension("jpg");
if (!readerwriter)
{
std::cerr << "Error: Unable to write screenshot, can't find a jpg ReaderWriter" << std::endl;
return;
}
std::ofstream outfile;
outfile.open("test.jpg");
osgDB::ReaderWriter::WriteResult result = readerwriter->writeImage(*screenshot, outfile);
if (!result.success())
{
outfile << "Error: Unable to write screenshot: " << result.message() << " code " << result.status() << std::endl;
return;
}
outfile.close();
// mScreenCaptureHandler->setFramesToCapture(1);
// mScreenCaptureHandler->captureNextFrame(*mViewer);
// MWBase::Environment::get().getWindowManager()->messageBox ("Screenshot saved");
}
void InputManager::toggleInventory()

File diff suppressed because it is too large Load Diff

@ -0,0 +1,46 @@
--- apps/openmw/mwmechanics/character.cpp
+++ apps/openmw/mwmechanics/character.cpp
@@ -372,29 +372,28 @@ void CharacterController::refreshJumpAnims(const WeaponInfo* weap, JumpingState
}
}
- if(mJumpState == JumpState_InAir)
+ if (!mCurrentJump.empty())
{
mAnimation->disable(mCurrentJump);
- mCurrentJump = jumpAnimName;
- if (mAnimation->hasAnimation("jump"))
- mAnimation->play(mCurrentJump, Priority_Jump, jumpmask, false,
+ mCurrentJump.clear();
+ }
+
+ if(mJumpState == JumpState_InAir)
+ {
+ if (mAnimation->hasAnimation(jumpAnimName))
+ {
+ mAnimation->play(jumpAnimName, Priority_Jump, jumpmask, false,
1.0f, (startAtLoop?"loop start":"start"), "stop", 0.0f, ~0ul);
+ mCurrentJump = jumpAnimName;
+ }
}
else if (mJumpState == JumpState_Landing)
{
- if (startAtLoop)
- mAnimation->disable(mCurrentJump);
-
- if (mAnimation->hasAnimation("jump"))
+ if (mAnimation->hasAnimation(jumpAnimName))
+ {
mAnimation->play(jumpAnimName, Priority_Jump, jumpmask, true,
1.0f, "loop stop", "stop", 0.0f, 0);
- }
- else // JumpState_None
- {
- if (mCurrentJump.length() > 0)
- {
- mAnimation->disable(mCurrentJump);
- mCurrentJump.clear();
+ mCurrentJump = jumpAnimName;
}
}
}

@ -620,6 +620,11 @@ namespace MWRender
mutable bool mDone;
};
void RenderingManager::screenshot360(osg::Image* image, int w)
{
screenshot(image,w,w);
}
void RenderingManager::screenshot(osg::Image *image, int w, int h)
{
osg::ref_ptr<osg::Camera> rttCamera (new osg::Camera);

@ -126,6 +126,7 @@ namespace MWRender
/// Take a screenshot of w*h onto the given image, not including the GUI.
void screenshot(osg::Image* image, int w, int h);
void screenshot360(osg::Image* image, int w);
struct RayResult
{

@ -655,5 +655,4 @@ void MWState::StateManager::writeScreenshot(std::vector<char> &imageData) const
std::string data = ostream.str();
imageData = std::vector<char>(data.begin(), data.end());
}

@ -2280,6 +2280,11 @@ namespace MWWorld
{
mRendering->screenshot(image, w, h);
}
void World::screenshot360 (osg::Image* image, int w)
{
mRendering->screenshot360(image, w);
}
void World::activateDoor(const MWWorld::Ptr& door)
{

@ -560,6 +560,7 @@ namespace MWWorld
/// \todo this does not belong here
void screenshot (osg::Image* image, int w, int h) override;
void screenshot360 (osg::Image* image, int w) override;
/// Find center of exterior cell above land surface
/// \return false if exterior with given name not exists, true otherwise

Loading…
Cancel
Save