mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Skeleton update fix
This commit is contained in:
parent
bd88758962
commit
9246a668b9
3 changed files with 13 additions and 5 deletions
|
@ -135,7 +135,7 @@ void RigGeometry::update(osg::NodeVisitor* nv)
|
|||
return;
|
||||
}
|
||||
|
||||
mSkeleton->updateBoneMatrices();
|
||||
mSkeleton->updateBoneMatrices(nv);
|
||||
|
||||
osg::NodePath path;
|
||||
bool foundSkel = false;
|
||||
|
|
|
@ -34,6 +34,7 @@ private:
|
|||
Skeleton::Skeleton()
|
||||
: mBoneCacheInit(false)
|
||||
, mNeedToUpdateBoneMatrices(true)
|
||||
, mLastFrameNumber(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -42,6 +43,7 @@ Skeleton::Skeleton(const Skeleton ©, const osg::CopyOp ©op)
|
|||
: osg::Group(copy, copyop)
|
||||
, mBoneCacheInit(false)
|
||||
, mNeedToUpdateBoneMatrices(true)
|
||||
, mLastFrameNumber(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -100,11 +102,15 @@ Bone* Skeleton::getBone(const std::string &name)
|
|||
return bone;
|
||||
}
|
||||
|
||||
void Skeleton::updateBoneMatrices()
|
||||
void Skeleton::updateBoneMatrices(osg::NodeVisitor* nv)
|
||||
{
|
||||
//if (mNeedToUpdateBoneMatrices)
|
||||
{
|
||||
if (nv->getFrameStamp()->getFrameNumber() != mLastFrameNumber)
|
||||
mNeedToUpdateBoneMatrices = true;
|
||||
|
||||
mLastFrameNumber = nv->getFrameStamp()->getFrameNumber();
|
||||
|
||||
if (mNeedToUpdateBoneMatrices)
|
||||
{
|
||||
if (mRootBone.get())
|
||||
{
|
||||
for (unsigned int i=0; i<mRootBone->mChildren.size(); ++i)
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace NifOsg
|
|||
|
||||
META_Node(NifOsg, Skeleton)
|
||||
|
||||
void updateBoneMatrices();
|
||||
void updateBoneMatrices(osg::NodeVisitor* nv);
|
||||
|
||||
private:
|
||||
// The root bone is not a "real" bone, it has no corresponding node in the scene graph.
|
||||
|
@ -51,6 +51,8 @@ namespace NifOsg
|
|||
bool mBoneCacheInit;
|
||||
|
||||
bool mNeedToUpdateBoneMatrices;
|
||||
|
||||
unsigned int mLastFrameNumber;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue