1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:53:50 +00:00

Merge remote-tracking branch 'origin/master' into mergetool

This commit is contained in:
Marc Zinnschlag 2015-08-01 10:16:20 +02:00
commit 9392e426c0
7 changed files with 45 additions and 2 deletions

View file

@ -291,6 +291,10 @@ namespace MWMechanics
return; return;
} }
// no combat for totally static creatures (they have no movement or attack animations anyway)
if (!actor1.getClass().isMobile(actor1))
return;
bool aggressive; bool aggressive;
if (againstPlayer) if (againstPlayer)

View file

@ -390,7 +390,8 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
} }
else else
{ {
movemask = MWRender::Animation::BlendMask_LowerBody; if (weap != sWeaponTypeListEnd)
movemask = MWRender::Animation::BlendMask_LowerBody;
movementAnimName.erase(swimpos, 4); movementAnimName.erase(swimpos, 4);
if(!mAnimation->hasAnimation(movementAnimName)) if(!mAnimation->hasAnimation(movementAnimName))
movementAnimName.clear(); movementAnimName.clear();
@ -467,10 +468,14 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
mIdleState = idle; mIdleState = idle;
std::string idle; std::string idle;
MWRender::Animation::AnimPriority idlePriority (Priority_Default);
// Only play "idleswim" or "idlesneak" if they exist. Otherwise, fallback to // Only play "idleswim" or "idlesneak" if they exist. Otherwise, fallback to
// "idle"+weapon or "idle". // "idle"+weapon or "idle".
if(mIdleState == CharState_IdleSwim && mAnimation->hasAnimation("idleswim")) if(mIdleState == CharState_IdleSwim && mAnimation->hasAnimation("idleswim"))
{
idle = "idleswim"; idle = "idleswim";
idlePriority = Priority_SwimIdle;
}
else if(mIdleState == CharState_IdleSneak && mAnimation->hasAnimation("idlesneak")) else if(mIdleState == CharState_IdleSneak && mAnimation->hasAnimation("idlesneak"))
idle = "idlesneak"; idle = "idlesneak";
else if(mIdleState != CharState_None) else if(mIdleState != CharState_None)
@ -487,7 +492,7 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
mAnimation->disable(mCurrentIdle); mAnimation->disable(mCurrentIdle);
mCurrentIdle = idle; mCurrentIdle = idle;
if(!mCurrentIdle.empty()) 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); 1.0f, "start", "stop", 0.0f, ~0ul, true);
} }

View file

@ -29,6 +29,7 @@ class CreatureStats;
enum Priority { enum Priority {
Priority_Default, Priority_Default,
Priority_WeaponLowerBody, Priority_WeaponLowerBody,
Priority_SwimIdle,
Priority_Jump, Priority_Jump,
Priority_Movement, Priority_Movement,
Priority_Hit, Priority_Hit,

View file

@ -717,6 +717,13 @@ public:
mAlpha = alpha; mAlpha = alpha;
} }
virtual void setDefaults(osg::StateSet* stateset)
{
// need to create a deep copy of StateAttributes we will modify
osg::Material* mat = static_cast<osg::Material*>(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) virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv)
{ {
osg::Material* mat = static_cast<osg::Material*>(stateset->getAttribute(osg::StateAttribute::MATERIAL)); osg::Material* mat = static_cast<osg::Material*>(stateset->getAttribute(osg::StateAttribute::MATERIAL));

View file

@ -353,6 +353,13 @@ AlphaController::AlphaController(const AlphaController &copy, 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<osg::Material*>(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) void AlphaController::apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
{ {
if (hasInput()) if (hasInput())
@ -380,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<osg::Material*>(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) void MaterialColorController::apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
{ {
if (hasInput()) if (hasInput())

View file

@ -189,6 +189,8 @@ namespace NifOsg
AlphaController(); AlphaController();
AlphaController(const AlphaController& copy, const osg::CopyOp& copyop); AlphaController(const AlphaController& copy, const osg::CopyOp& copyop);
virtual void setDefaults(osg::StateSet* stateset);
virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv); virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv);
META_Object(NifOsg, AlphaController) META_Object(NifOsg, AlphaController)
@ -206,6 +208,8 @@ namespace NifOsg
META_Object(NifOsg, MaterialColorController) META_Object(NifOsg, MaterialColorController)
virtual void setDefaults(osg::StateSet* stateset);
virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv); virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv);
}; };

View file

@ -2,6 +2,7 @@
#include <osgDB/Registry> #include <osgDB/Registry>
#include <osg/GLExtensions> #include <osg/GLExtensions>
#include <osg/Version>
#include <stdexcept> #include <stdexcept>
@ -118,10 +119,17 @@ namespace Resource
case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT):
case(GL_COMPRESSED_RGBA_S3TC_DXT5_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); osg::Texture::Extensions* exts = osg::Texture::getExtensions(0, false);
if (exts && !exts->isTextureCompressionS3TCSupported() if (exts && !exts->isTextureCompressionS3TCSupported()
// This one works too. Should it be included in isTextureCompressionS3TCSupported()? Submitted as a patch to OSG. // This one works too. Should it be included in isTextureCompressionS3TCSupported()? Submitted as a patch to OSG.
&& !osg::isGLExtensionSupported(0, "GL_S3_s3tc")) && !osg::isGLExtensionSupported(0, "GL_S3_s3tc"))
#endif
{ {
std::cerr << "Error loading " << filename << ": no S3TC texture compression support installed" << std::endl; std::cerr << "Error loading " << filename << ": no S3TC texture compression support installed" << std::endl;
return false; return false;