diff --git a/CHANGELOG.md b/CHANGELOG.md index fe266a066e..eeb16224ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Bug #3905: Great House Dagoth issues Bug #4203: Resurrecting an actor doesn't close the loot GUI Bug #4227: Spellcasting restrictions are checked before spellcasting animations are played + Bug #4374: Player rotation reset when nearing area that hasn't been loaded yet Bug #4376: Moved actors don't respawn in their original cells Bug #4389: NPC's lips do not move if his head model has the NiBSAnimationNode root node Bug #4602: Robert's Bodies: crash inside createInstance() @@ -118,6 +119,7 @@ Bug #6519: Effects tooltips for ingredients work incorrectly Bug #6523: Disintegrate Weapon is resisted by Resist Magicka instead of Sanctuary Bug #6544: Far from world origin objects jitter when camera is still + Bug #6545: Player character momentum is preserved when going to a different cell Bug #6559: Weapon condition inconsistency between melee and ranged critical / sneak / KO attacks Bug #6579: OpenMW compilation error when using OSG doubles for BoundingSphere Bug #6606: Quests with multiple IDs cannot always be restarted diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index f4718e0d8f..c2fb47186f 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -699,7 +699,10 @@ namespace MWPhysics void PhysicsSystem::clearQueuedMovement() { for (const auto& [_, actor] : mActors) + { actor->setVelocity(osg::Vec3f()); + actor->setInertialForce(osg::Vec3f()); + } } std::vector PhysicsSystem::prepareSimulation(bool willSimulate) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 0933bf4e9e..9d910c00f9 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -51,6 +51,22 @@ namespace { + class MarkDrawablesVisitor : public osg::NodeVisitor + { + public: + MarkDrawablesVisitor(osg::Node::NodeMask mask) + : osg::NodeVisitor(TRAVERSE_ALL_CHILDREN) + , mMask(mask) + { } + + void apply(osg::Drawable& drawable) override + { + drawable.setNodeMask(mMask); + } + + private: + osg::Node::NodeMask mMask = 0; + }; /// Removes all particle systems and related nodes in a subgraph. class RemoveParticlesVisitor : public osg::NodeVisitor @@ -1555,6 +1571,9 @@ namespace MWRender node->setNodeMask(Mask_Effect); + MarkDrawablesVisitor markVisitor(Mask_Effect); + node->accept(markVisitor); + params.mMaxControllerLength = findMaxLengthVisitor.getMaxLength(); params.mLoop = loop; params.mEffectId = effectId; diff --git a/apps/openmw/mwrender/transparentpass.cpp b/apps/openmw/mwrender/transparentpass.cpp index 239a11821b..facd271643 100644 --- a/apps/openmw/mwrender/transparentpass.cpp +++ b/apps/openmw/mwrender/transparentpass.cpp @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include @@ -10,6 +12,8 @@ #include #include +#include "vismask.hpp" + namespace MWRender { TransparentDepthBinCallback::TransparentDepthBinCallback(Shader::ShaderManager& shaderManager, bool postPass) @@ -34,6 +38,7 @@ namespace MWRender mStateSet->setAttributeAndModes(new osg::BlendFunc, modeOff); mStateSet->setAttributeAndModes(shaderManager.getProgram(vertex, fragment), modeOn); + mStateSet->setAttributeAndModes(new SceneUtil::AutoDepth, modeOn); for (unsigned int unit = 1; unit < 8; ++unit) mStateSet->setTextureMode(unit, GL_TEXTURE_2D, modeOff); @@ -88,11 +93,35 @@ namespace MWRender opaqueFbo->apply(state, osg::FrameBufferObject::DRAW_FRAMEBUFFER); - osg::ref_ptr restore = bin->getStateSet(); - bin->setStateSet(mStateSet); - // draws transparent post-pass to populate a postprocess friendly depth texture with alpha-clipped geometry - bin->drawImplementation(renderInfo, previous); - bin->setStateSet(restore); + // draw transparent post-pass to populate a postprocess friendly depth texture with alpha-clipped geometry + + unsigned int numToPop = previous ? osgUtil::StateGraph::numToPop(previous->_parent) : 0; + if (numToPop > 1) + numToPop--; + unsigned int insertStateSetPosition = state.getStateSetStackSize() - numToPop; + + state.insertStateSet(insertStateSetPosition, mStateSet); + for(auto rit = bin->getRenderLeafList().begin(); rit != bin->getRenderLeafList().end(); rit++) + { + osgUtil::RenderLeaf* rl = *rit; + const osg::StateSet* ss = rl->_parent->getStateSet(); + + if (rl->_drawable->getNodeMask() == Mask_ParticleSystem || rl->_drawable->getNodeMask() == Mask_Effect) + continue; + + if (ss->getAttribute(osg::StateAttribute::ALPHAFUNC)) + continue; + + if (ss->getAttribute(osg::StateAttribute::MATERIAL)) { + const osg::Material* mat = static_cast(ss->getAttribute(osg::StateAttribute::MATERIAL)); + if (mat->getDiffuse(osg::Material::FRONT).a() < 0.5) + continue; + } + + rl->render(renderInfo,previous); + previous = rl; + } + state.removeStateSet(insertStateSetPosition); msaaFbo ? msaaFbo->apply(state, osg::FrameBufferObject::DRAW_FRAMEBUFFER) : fbo->apply(state, osg::FrameBufferObject::DRAW_FRAMEBUFFER); state.checkGLErrors("after TransparentDepthBinCallback::drawImplementation"); diff --git a/components/sdlutil/sdlinputwrapper.cpp b/components/sdlutil/sdlinputwrapper.cpp index 8f8396c36d..4273cf5b96 100644 --- a/components/sdlutil/sdlinputwrapper.cpp +++ b/components/sdlutil/sdlinputwrapper.cpp @@ -52,13 +52,15 @@ InputWrapper::InputWrapper(SDL_Window* window, osg::ref_ptr v if (windowEventsOnly) { - // During loading, handle window events, discard button presses and keep others for later + // During loading, handle window events, discard button presses and mouse movement and keep others for later while (SDL_PeepEvents(&evt, 1, SDL_GETEVENT, SDL_WINDOWEVENT, SDL_WINDOWEVENT) > 0) handleWindowEvent(evt); SDL_FlushEvent(SDL_KEYDOWN); SDL_FlushEvent(SDL_CONTROLLERBUTTONDOWN); SDL_FlushEvent(SDL_MOUSEBUTTONDOWN); + SDL_FlushEvent(SDL_MOUSEMOTION); + SDL_FlushEvent(SDL_MOUSEWHEEL); return; } diff --git a/files/shaders/blended_depth_postpass_fragment.glsl b/files/shaders/blended_depth_postpass_fragment.glsl index 61e8b4ea7e..fc86080030 100644 --- a/files/shaders/blended_depth_postpass_fragment.glsl +++ b/files/shaders/blended_depth_postpass_fragment.glsl @@ -9,7 +9,7 @@ void main() { float alpha = texture2D(diffuseMap, diffuseMapUV).a * alphaPassthrough; - const float alphaRef = 0.5; + const float alphaRef = 0.499; if (alpha < alphaRef) discard;