forked from teamnwah/openmw-tes3coop
Use the traversalNumber as frame number
This commit is contained in:
parent
52901ec10c
commit
21e25f4756
4 changed files with 10 additions and 11 deletions
|
@ -100,14 +100,13 @@ namespace
|
||||||
|
|
||||||
virtual void traverse(osg::NodeVisitor& nv)
|
virtual void traverse(osg::NodeVisitor& nv)
|
||||||
{
|
{
|
||||||
const osg::FrameStamp* stamp = nv.getFrameStamp();
|
if (nv.getTraversalMode() != osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN)
|
||||||
if (!stamp || nv.getTraversalMode() != osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN)
|
|
||||||
osg::Group::traverse(nv);
|
osg::Group::traverse(nv);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<getNumChildren(); ++i)
|
for (unsigned int i=0; i<getNumChildren(); ++i)
|
||||||
{
|
{
|
||||||
if (i%2 == stamp->getFrameNumber()%2)
|
if (i%2 == nv.getTraversalNumber()%2)
|
||||||
getChild(i)->accept(nv);
|
getChild(i)->accept(nv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,9 +181,9 @@ namespace
|
||||||
if (!geom)
|
if (!geom)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (mLastFrameNumber == nv->getFrameStamp()->getFrameNumber())
|
if (mLastFrameNumber == nv->getTraversalNumber())
|
||||||
return false;
|
return false;
|
||||||
mLastFrameNumber = nv->getFrameStamp()->getFrameNumber();
|
mLastFrameNumber = nv->getTraversalNumber();
|
||||||
|
|
||||||
geom->transformSoftwareMethod();
|
geom->transformSoftwareMethod();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -294,9 +294,9 @@ namespace SceneUtil
|
||||||
|
|
||||||
// update light list if necessary
|
// update light list if necessary
|
||||||
// makes sure we don't update it more than once per frame when rendering with multiple cameras
|
// makes sure we don't update it more than once per frame when rendering with multiple cameras
|
||||||
if (mLastFrameNumber != nv->getFrameStamp()->getFrameNumber())
|
if (mLastFrameNumber != nv->getTraversalNumber())
|
||||||
{
|
{
|
||||||
mLastFrameNumber = nv->getFrameStamp()->getFrameNumber();
|
mLastFrameNumber = nv->getTraversalNumber();
|
||||||
|
|
||||||
// Don't use Camera::getViewMatrix, that one might be relative to another camera!
|
// Don't use Camera::getViewMatrix, that one might be relative to another camera!
|
||||||
const osg::RefMatrix* viewMatrix = cv->getCurrentRenderStage()->getInitialViewMatrix();
|
const osg::RefMatrix* viewMatrix = cv->getCurrentRenderStage()->getInitialViewMatrix();
|
||||||
|
|
|
@ -218,9 +218,9 @@ void RigGeometry::update(osg::NodeVisitor* nv)
|
||||||
if (!mSkeleton->getActive() && mLastFrameNumber != 0)
|
if (!mSkeleton->getActive() && mLastFrameNumber != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mLastFrameNumber == nv->getFrameStamp()->getFrameNumber())
|
if (mLastFrameNumber == nv->getTraversalNumber())
|
||||||
return;
|
return;
|
||||||
mLastFrameNumber = nv->getFrameStamp()->getFrameNumber();
|
mLastFrameNumber = nv->getTraversalNumber();
|
||||||
|
|
||||||
mSkeleton->updateBoneMatrices(nv);
|
mSkeleton->updateBoneMatrices(nv);
|
||||||
|
|
||||||
|
|
|
@ -104,10 +104,10 @@ Bone* Skeleton::getBone(const std::string &name)
|
||||||
|
|
||||||
void Skeleton::updateBoneMatrices(osg::NodeVisitor* nv)
|
void Skeleton::updateBoneMatrices(osg::NodeVisitor* nv)
|
||||||
{
|
{
|
||||||
if (nv->getFrameStamp()->getFrameNumber() != mLastFrameNumber)
|
if (nv->getTraversalNumber() != mLastFrameNumber)
|
||||||
mNeedToUpdateBoneMatrices = true;
|
mNeedToUpdateBoneMatrices = true;
|
||||||
|
|
||||||
mLastFrameNumber = nv->getFrameStamp()->getFrameNumber();
|
mLastFrameNumber = nv->getTraversalNumber();
|
||||||
|
|
||||||
if (mNeedToUpdateBoneMatrices)
|
if (mNeedToUpdateBoneMatrices)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue