mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
basic setup for 360 screenshots
This commit is contained in:
parent
5e69f6033f
commit
7feba7e498
9 changed files with 2553 additions and 4 deletions
|
@ -450,6 +450,7 @@ namespace MWBase
|
||||||
|
|
||||||
/// \todo this does not belong here
|
/// \todo this does not belong here
|
||||||
virtual void screenshot (osg::Image* image, int w, int h) = 0;
|
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
|
/// Find default position inside exterior cell specified by name
|
||||||
/// \return false if exterior with given name not exists, true otherwise
|
/// \return false if exterior with given name not exists, true otherwise
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "inputmanagerimp.hpp"
|
#include "inputmanagerimp.hpp"
|
||||||
|
|
||||||
#include <osgViewer/ViewerEventHandlers>
|
#include <osgViewer/ViewerEventHandlers>
|
||||||
|
#include <osgDB/Registry>
|
||||||
|
|
||||||
#include <MyGUI_InputManager.h>
|
#include <MyGUI_InputManager.h>
|
||||||
#include <MyGUI_RenderManager.h>
|
#include <MyGUI_RenderManager.h>
|
||||||
|
@ -1014,10 +1015,36 @@ namespace MWInput
|
||||||
|
|
||||||
void InputManager::screenshot()
|
void InputManager::screenshot()
|
||||||
{
|
{
|
||||||
mScreenCaptureHandler->setFramesToCapture(1);
|
// MOVE THIS ELSEWHERE LATER!
|
||||||
mScreenCaptureHandler->captureNextFrame(*mViewer);
|
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()
|
void InputManager::toggleInventory()
|
||||||
|
|
2464
apps/openmw/mwmechanics/character.cpp.orig
Normal file
2464
apps/openmw/mwmechanics/character.cpp.orig
Normal file
File diff suppressed because it is too large
Load diff
46
apps/openmw/mwmechanics/character.cpp.rej
Normal file
46
apps/openmw/mwmechanics/character.cpp.rej
Normal file
|
@ -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;
|
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)
|
void RenderingManager::screenshot(osg::Image *image, int w, int h)
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::Camera> rttCamera (new osg::Camera);
|
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.
|
/// Take a screenshot of w*h onto the given image, not including the GUI.
|
||||||
void screenshot(osg::Image* image, int w, int h);
|
void screenshot(osg::Image* image, int w, int h);
|
||||||
|
void screenshot360(osg::Image* image, int w);
|
||||||
|
|
||||||
struct RayResult
|
struct RayResult
|
||||||
{
|
{
|
||||||
|
|
|
@ -655,5 +655,4 @@ void MWState::StateManager::writeScreenshot(std::vector<char> &imageData) const
|
||||||
|
|
||||||
std::string data = ostream.str();
|
std::string data = ostream.str();
|
||||||
imageData = std::vector<char>(data.begin(), data.end());
|
imageData = std::vector<char>(data.begin(), data.end());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2280,6 +2280,11 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
mRendering->screenshot(image, w, h);
|
mRendering->screenshot(image, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World::screenshot360 (osg::Image* image, int w)
|
||||||
|
{
|
||||||
|
mRendering->screenshot360(image, w);
|
||||||
|
}
|
||||||
|
|
||||||
void World::activateDoor(const MWWorld::Ptr& door)
|
void World::activateDoor(const MWWorld::Ptr& door)
|
||||||
{
|
{
|
||||||
|
|
|
@ -560,6 +560,7 @@ namespace MWWorld
|
||||||
|
|
||||||
/// \todo this does not belong here
|
/// \todo this does not belong here
|
||||||
void screenshot (osg::Image* image, int w, int h) override;
|
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
|
/// Find center of exterior cell above land surface
|
||||||
/// \return false if exterior with given name not exists, true otherwise
|
/// \return false if exterior with given name not exists, true otherwise
|
||||||
|
|
Loading…
Reference in a new issue