Made improvements to osg::AnimationPath, added

osg::PositionAttitudeTransform::AnimationPathCallback which us an app callback
which uses an AnimationPath to specify the new positions of the transform.

Added AnimationPath code to osglight to animate the positional light.

Added CullVisitor::setCullingMode() code into SceneView so that SceneView's
CullingMode is now properly passed onto CullVisitor.  Note, this work
had been done before, but must has been lost in a merge. Umm...
This commit is contained in:
Robert Osfield
2002-08-13 13:22:46 +00:00
parent 983da4fb9c
commit 7c049360ff
5 changed files with 96 additions and 31 deletions

View File

@@ -40,3 +40,22 @@ const bool PositionAttitudeTransform::computeWorldToLocalMatrix(Matrix& matrix,N
}
return true;
}
void PositionAttitudeTransform::AnimationPathCallback::operator()(Node* node, NodeVisitor* nv)
{
PositionAttitudeTransform* pat = dynamic_cast<PositionAttitudeTransform*>(node);
if (pat &&
_animationPath.valid() &&
nv->getVisitorType()==NodeVisitor::APP_VISITOR &&
nv->getFrameStamp())
{
double time = nv->getFrameStamp()->getReferenceTime();
if (_firstTime==0.0) _firstTime = time;
AnimationPath::Key key;
if (_animationPath->getKeyFrame(time-_firstTime,key))
{
pat->setPosition(key._position);
pat->setAttitude(key._rotation);
}
}
}