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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user