mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-16 11:39:41 +00:00
Fix inactive RigGeometry not rendering correctly
This commit is contained in:
parent
e0c9265148
commit
eb458bf9c8
2 changed files with 7 additions and 2 deletions
components/sceneutil
|
@ -82,7 +82,7 @@ RigGeometry::RigGeometry(const RigGeometry ©, const osg::CopyOp ©op)
|
|||
, mSkeleton(NULL)
|
||||
, mInfluenceMap(copy.mInfluenceMap)
|
||||
, mLastFrameNumber(0)
|
||||
, mBoundsFirstFrame(copy.mBoundsFirstFrame)
|
||||
, mBoundsFirstFrame(true)
|
||||
{
|
||||
setSourceGeometry(copy.mSourceGeometry);
|
||||
}
|
||||
|
@ -211,6 +211,8 @@ void RigGeometry::update(osg::NodeVisitor* nv)
|
|||
{
|
||||
if (!mSkeleton)
|
||||
{
|
||||
std::cerr << "RigGeometry rendering with no skeleton, should have been initialized by UpdateVisitor" << std::endl;
|
||||
// try to recover anyway, though rendering is likely to be incorrect.
|
||||
if (!initFromParentSkeleton(nv))
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,10 @@ bool Skeleton::getActive() const
|
|||
|
||||
void Skeleton::traverse(osg::NodeVisitor& nv)
|
||||
{
|
||||
if (!mActive && nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR && mLastFrameNumber != 0)
|
||||
if (!getActive() && nv.getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR
|
||||
// need to process at least 2 frames before shutting off update, since we need to have both frame-alternating RigGeometries initialized
|
||||
// this would be more naturally handled if the double-buffering was implemented in RigGeometry itself rather than in a FrameSwitch decorator node
|
||||
&& mLastFrameNumber != 0 && mLastFrameNumber+2 <= nv.getTraversalNumber())
|
||||
return;
|
||||
osg::Group::traverse(nv);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue