From e9ffbcc1b0aa771ca627a26acb6565b6b5e85555 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Thu, 30 Jul 2015 11:45:10 +0200 Subject: [PATCH 1/9] OSG 3.3.3 moves GL extensions out of osg::Texture --- components/resource/texturemanager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/resource/texturemanager.cpp b/components/resource/texturemanager.cpp index 4bd712ea5..252456fb1 100644 --- a/components/resource/texturemanager.cpp +++ b/components/resource/texturemanager.cpp @@ -118,10 +118,17 @@ namespace Resource case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): { +#if OSG_MIN_VERSION_REQUIRED(3, 3, 3) + osg::GLExtensions* exts = osg::GLExtensions::Get(0, false); + if (exts && !exts->isTextureCompressionS3TCSupported + // This one works too. Should it be included in isTextureCompressionS3TCSupported()? Submitted as a patch to OSG. + && !osg::isGLExtensionSupported(0, "GL_S3_s3tc")) +#else osg::Texture::Extensions* exts = osg::Texture::getExtensions(0, false); if (exts && !exts->isTextureCompressionS3TCSupported() // This one works too. Should it be included in isTextureCompressionS3TCSupported()? Submitted as a patch to OSG. && !osg::isGLExtensionSupported(0, "GL_S3_s3tc")) +#endif { std::cerr << "Error loading " << filename << ": no S3TC texture compression support installed" << std::endl; return false; From 77a3a52b4e5d154d55c50c728410c809aa137a8c Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Thu, 30 Jul 2015 12:16:15 +0200 Subject: [PATCH 2/9] What's wrong with this statement? --- components/resource/texturemanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/resource/texturemanager.cpp b/components/resource/texturemanager.cpp index 252456fb1..750dfaab7 100644 --- a/components/resource/texturemanager.cpp +++ b/components/resource/texturemanager.cpp @@ -118,7 +118,7 @@ namespace Resource case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): { -#if OSG_MIN_VERSION_REQUIRED(3, 3, 3) +#if OSG_MIN_VERSION_REQUIRED(3,3,3) osg::GLExtensions* exts = osg::GLExtensions::Get(0, false); if (exts && !exts->isTextureCompressionS3TCSupported // This one works too. Should it be included in isTextureCompressionS3TCSupported()? Submitted as a patch to OSG. From 1f78ebd3c98bf9759f5573a76279e44eab8cec61 Mon Sep 17 00:00:00 2001 From: "Alexander \"Ace\" Olofsson" Date: Thu, 30 Jul 2015 12:22:51 +0200 Subject: [PATCH 3/9] Oops? --- components/resource/texturemanager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/components/resource/texturemanager.cpp b/components/resource/texturemanager.cpp index 750dfaab7..d29aa2812 100644 --- a/components/resource/texturemanager.cpp +++ b/components/resource/texturemanager.cpp @@ -2,6 +2,7 @@ #include #include +#include #include From de479e35c8e39f6097148d17b5631630333cd1b4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 30 Jul 2015 23:51:37 +0200 Subject: [PATCH 4/9] Fix AlphaController affecting all instances of the StateSet --- components/nifosg/controller.cpp | 7 +++++++ components/nifosg/controller.hpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index 83ecc0fa9..e66713c17 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -353,6 +353,13 @@ AlphaController::AlphaController(const AlphaController ©, const osg::CopyOp { } +void AlphaController::setDefaults(osg::StateSet *stateset) +{ + // need to create a deep copy of StateAttributes we will modify + osg::Material* mat = static_cast(stateset->getAttribute(osg::StateAttribute::MATERIAL)); + stateset->setAttribute(osg::clone(mat, osg::CopyOp::DEEP_COPY_ALL), osg::StateAttribute::ON); +} + void AlphaController::apply(osg::StateSet *stateset, osg::NodeVisitor *nv) { if (hasInput()) diff --git a/components/nifosg/controller.hpp b/components/nifosg/controller.hpp index 4877c83db..500a5cc17 100644 --- a/components/nifosg/controller.hpp +++ b/components/nifosg/controller.hpp @@ -189,6 +189,8 @@ namespace NifOsg AlphaController(); AlphaController(const AlphaController& copy, const osg::CopyOp& copyop); + virtual void setDefaults(osg::StateSet* stateset); + virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv); META_Object(NifOsg, AlphaController) From 16b8ef3164c28f829bbe76b3ac1a21a3bb53715c Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 31 Jul 2015 00:01:55 +0200 Subject: [PATCH 5/9] Don't use a shared Material in MaterialColorController --- components/nifosg/controller.cpp | 7 +++++++ components/nifosg/controller.hpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/components/nifosg/controller.cpp b/components/nifosg/controller.cpp index e66713c17..bb698ed63 100644 --- a/components/nifosg/controller.cpp +++ b/components/nifosg/controller.cpp @@ -387,6 +387,13 @@ MaterialColorController::MaterialColorController(const MaterialColorController & { } +void MaterialColorController::setDefaults(osg::StateSet *stateset) +{ + // need to create a deep copy of StateAttributes we will modify + osg::Material* mat = static_cast(stateset->getAttribute(osg::StateAttribute::MATERIAL)); + stateset->setAttribute(osg::clone(mat, osg::CopyOp::DEEP_COPY_ALL), osg::StateAttribute::ON); +} + void MaterialColorController::apply(osg::StateSet *stateset, osg::NodeVisitor *nv) { if (hasInput()) diff --git a/components/nifosg/controller.hpp b/components/nifosg/controller.hpp index 500a5cc17..58870317e 100644 --- a/components/nifosg/controller.hpp +++ b/components/nifosg/controller.hpp @@ -208,6 +208,8 @@ namespace NifOsg META_Object(NifOsg, MaterialColorController) + virtual void setDefaults(osg::StateSet* stateset); + virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv); }; From 1f755a2bc0d99f1ad5e3fe1a32e645a6a4d77694 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 31 Jul 2015 00:03:01 +0200 Subject: [PATCH 6/9] Don't use a shared Material in AlphaFader --- apps/openmw/mwrender/sky.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 49c00c33d..2009232c5 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -705,6 +705,13 @@ public: mAlpha = alpha; } + virtual void setDefaults(osg::StateSet* stateset) + { + // need to create a deep copy of StateAttributes we will modify + osg::Material* mat = static_cast(stateset->getAttribute(osg::StateAttribute::MATERIAL)); + stateset->setAttribute(osg::clone(mat, osg::CopyOp::DEEP_COPY_ALL), osg::StateAttribute::ON); + } + virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv) { osg::Material* mat = static_cast(stateset->getAttribute(osg::StateAttribute::MATERIAL)); From e8cbdcfb1e98956b86df8d80eb268882d951864b Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 31 Jul 2015 00:35:17 +0200 Subject: [PATCH 7/9] Play swimming animation fallback on the upper body when possible --- apps/openmw/mwmechanics/character.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 9d5f7137f..ae4412dbf 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -390,7 +390,8 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat } else { - movemask = MWRender::Animation::BlendMask_LowerBody; + if (weap != sWeaponTypeListEnd) + movemask = MWRender::Animation::BlendMask_LowerBody; movementAnimName.erase(swimpos, 4); if(!mAnimation->hasAnimation(movementAnimName)) movementAnimName.clear(); From f326b8e5d28e5a8a68098bdb60a96fc382d0a3fc Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 31 Jul 2015 00:52:34 +0200 Subject: [PATCH 8/9] Fix weapon animations playing on the lowerbody when swimming --- apps/openmw/mwmechanics/character.cpp | 6 +++++- apps/openmw/mwmechanics/character.hpp | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index ae4412dbf..44fcf1c57 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -468,10 +468,14 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat mIdleState = idle; std::string idle; + MWRender::Animation::AnimPriority idlePriority (Priority_Default); // Only play "idleswim" or "idlesneak" if they exist. Otherwise, fallback to // "idle"+weapon or "idle". if(mIdleState == CharState_IdleSwim && mAnimation->hasAnimation("idleswim")) + { idle = "idleswim"; + idlePriority = Priority_SwimIdle; + } else if(mIdleState == CharState_IdleSneak && mAnimation->hasAnimation("idlesneak")) idle = "idlesneak"; else if(mIdleState != CharState_None) @@ -488,7 +492,7 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat mAnimation->disable(mCurrentIdle); mCurrentIdle = idle; if(!mCurrentIdle.empty()) - mAnimation->play(mCurrentIdle, Priority_Default, MWRender::Animation::BlendMask_All, false, + mAnimation->play(mCurrentIdle, idlePriority, MWRender::Animation::BlendMask_All, false, 1.0f, "start", "stop", 0.0f, ~0ul, true); } diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index d647cae22..3ada5e65e 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -29,6 +29,7 @@ class CreatureStats; enum Priority { Priority_Default, Priority_WeaponLowerBody, + Priority_SwimIdle, Priority_Jump, Priority_Movement, Priority_Hit, From 7644a46deddc25367dfa6d50f6c51a74a32566f4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 31 Jul 2015 01:26:26 +0200 Subject: [PATCH 9/9] Creatures with no movement should not attempt to start combat (Fixes #2786) --- apps/openmw/mwmechanics/actors.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index c135811dd..75d501ff1 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -291,6 +291,10 @@ namespace MWMechanics return; } + // no combat for totally static creatures (they have no movement or attack animations anyway) + if (!actor1.getClass().isMobile(actor1)) + return; + bool aggressive; if (againstPlayer)