Merge pull request #245 from OpenMW/master

Add OpenMW commits up to 22 Jul 2017
0.6.1
David Cernat 8 years ago committed by GitHub
commit 2c1ece79fc

@ -6,5 +6,5 @@ brew outdated cmake || brew upgrade cmake
brew outdated pkgconfig || brew upgrade pkgconfig brew outdated pkgconfig || brew upgrade pkgconfig
brew install $macos_qt_formula brew install $macos_qt_formula
curl https://downloads.openmw.org/osx/dependencies/openmw-deps-eaf8112.zip -o ~/openmw-deps.zip curl https://downloads.openmw.org/osx/dependencies/openmw-deps-5e144e2.zip -o ~/openmw-deps.zip
unzip ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null unzip ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null

@ -40,6 +40,7 @@ namespace MWGui
, mEnabled(true) , mEnabled(true)
, mFullHelp(false) , mFullHelp(false)
, mShowOwned(0) , mShowOwned(0)
, mFrameDuration(0.f)
{ {
getWidget(mDynamicToolTipBox, "DynamicToolTipBox"); getWidget(mDynamicToolTipBox, "DynamicToolTipBox");
@ -67,6 +68,11 @@ namespace MWGui
} }
void ToolTips::onFrame(float frameDuration) void ToolTips::onFrame(float frameDuration)
{
mFrameDuration = frameDuration;
}
void ToolTips::update(float frameDuration)
{ {
while (mDynamicToolTipBox->getChildCount()) while (mDynamicToolTipBox->getChildCount())
@ -320,6 +326,8 @@ namespace MWGui
void ToolTips::setFocusObject(const MWWorld::ConstPtr& focus) void ToolTips::setFocusObject(const MWWorld::ConstPtr& focus)
{ {
mFocusObject = focus; mFocusObject = focus;
update(mFrameDuration);
} }
MyGUI::IntSize ToolTips::getToolTipViaPtr (int count, bool image) MyGUI::IntSize ToolTips::getToolTipViaPtr (int count, bool image)

@ -50,6 +50,7 @@ namespace MWGui
ToolTips(); ToolTips();
void onFrame(float frameDuration); void onFrame(float frameDuration);
void update(float frameDuration);
void setEnabled(bool enabled); void setEnabled(bool enabled);
@ -126,6 +127,8 @@ namespace MWGui
bool mFullHelp; bool mFullHelp;
int mShowOwned; int mShowOwned;
float mFrameDuration;
}; };
} }
#endif #endif

@ -1732,6 +1732,8 @@ namespace MWGui
mCompanionWindow->resetReference(); mCompanionWindow->resetReference();
mConsole->resetReference(); mConsole->resetReference();
mToolTips->setFocusObject(MWWorld::ConstPtr());
mInventoryWindow->clear(); mInventoryWindow->clear();
mSelectedSpell.clear(); mSelectedSpell.clear();

@ -133,6 +133,7 @@ namespace MWRender
mCamera->setRenderOrder(osg::Camera::PRE_RENDER); mCamera->setRenderOrder(osg::Camera::PRE_RENDER);
mCamera->attach(osg::Camera::COLOR_BUFFER, mTexture); mCamera->attach(osg::Camera::COLOR_BUFFER, mTexture);
mCamera->setName("CharacterPreview"); mCamera->setName("CharacterPreview");
mCamera->setComputeNearFarMode(osg::Camera::COMPUTE_NEAR_FAR_USING_BOUNDING_VOLUMES);
mCamera->setNodeMask(Mask_RenderToTexture); mCamera->setNodeMask(Mask_RenderToTexture);
@ -256,7 +257,8 @@ namespace MWRender
// NB Camera::setViewport has threading issues // NB Camera::setViewport has threading issues
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet; osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet;
stateset->setAttributeAndModes(new osg::Viewport(0, mSizeY-sizeY, std::min(mSizeX, sizeX), std::min(mSizeY, sizeY))); mViewport = new osg::Viewport(0, mSizeY-sizeY, std::min(mSizeX, sizeX), std::min(mSizeY, sizeY));
stateset->setAttributeAndModes(mViewport);
mCamera->setStateSet(stateset); mCamera->setStateSet(stateset);
redraw(); redraw();
@ -334,8 +336,10 @@ namespace MWRender
int InventoryPreview::getSlotSelected (int posX, int posY) int InventoryPreview::getSlotSelected (int posX, int posY)
{ {
float projX = (posX / mCamera->getViewport()->width()) * 2 - 1.f; if (!mViewport)
float projY = (posY / mCamera->getViewport()->height()) * 2 - 1.f; return -1;
float projX = (posX / mViewport->width()) * 2 - 1.f;
float projY = (posY / mViewport->height()) * 2 - 1.f;
// With Intersector::WINDOW, the intersection ratios are slightly inaccurate. Seems to be a // With Intersector::WINDOW, the intersection ratios are slightly inaccurate. Seems to be a
// precision issue - compiling with OSG_USE_FLOAT_MATRIX=0, Intersector::WINDOW works ok. // precision issue - compiling with OSG_USE_FLOAT_MATRIX=0, Intersector::WINDOW works ok.
// Using Intersector::PROJECTION results in better precision because the start/end points and the model matrices // Using Intersector::PROJECTION results in better precision because the start/end points and the model matrices

@ -17,6 +17,7 @@ namespace osg
class Texture2D; class Texture2D;
class Camera; class Camera;
class Group; class Group;
class Viewport;
} }
namespace MWRender namespace MWRender
@ -83,6 +84,8 @@ namespace MWRender
int getSlotSelected(int posX, int posY); int getSlotSelected(int posX, int posY);
protected: protected:
osg::ref_ptr<osg::Viewport> mViewport;
virtual void onSetup(); virtual void onSetup();
}; };

@ -1843,8 +1843,6 @@ namespace MWWorld
// inform the GUI about focused object // inform the GUI about focused object
MWWorld::Ptr object = getFacedObject (); MWWorld::Ptr object = getFacedObject ();
MWBase::Environment::get().getWindowManager()->setFocusObject(object);
// retrieve object dimensions so we know where to place the floating label // retrieve object dimensions so we know where to place the floating label
if (!object.isEmpty ()) if (!object.isEmpty ())
{ {
@ -1853,6 +1851,8 @@ namespace MWWorld
MWBase::Environment::get().getWindowManager()->setFocusObjectScreenCoords( MWBase::Environment::get().getWindowManager()->setFocusObjectScreenCoords(
screenBounds.x(), screenBounds.y(), screenBounds.z(), screenBounds.w()); screenBounds.x(), screenBounds.y(), screenBounds.z(), screenBounds.w());
} }
MWBase::Environment::get().getWindowManager()->setFocusObject(object);
} }
MWWorld::Ptr World::getFacedObject(float maxDistance, bool ignorePlayer) MWWorld::Ptr World::getFacedObject(float maxDistance, bool ignorePlayer)

@ -221,10 +221,12 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr<osgViewer::Viewer> v
case SDL_WINDOWEVENT_CLOSE: case SDL_WINDOWEVENT_CLOSE:
break; break;
case SDL_WINDOWEVENT_SHOWN: case SDL_WINDOWEVENT_SHOWN:
case SDL_WINDOWEVENT_RESTORED:
if (mWindowListener) if (mWindowListener)
mWindowListener->windowVisibilityChange(true); mWindowListener->windowVisibilityChange(true);
break; break;
case SDL_WINDOWEVENT_HIDDEN: case SDL_WINDOWEVENT_HIDDEN:
case SDL_WINDOWEVENT_MINIMIZED:
if (mWindowListener) if (mWindowListener)
mWindowListener->windowVisibilityChange(false); mWindowListener->windowVisibilityChange(false);
break; break;

Loading…
Cancel
Save