Futher improvements and fixes to osg::AnimationPath, and the osglight

demo to show it action.
This commit is contained in:
Robert Osfield
2002-08-13 15:31:10 +00:00
parent 7c049360ff
commit f9cc8783b3
10 changed files with 175 additions and 172 deletions

View File

@@ -30,3 +30,21 @@ MatrixTransform::MatrixTransform(const Matrix& mat )
MatrixTransform::~MatrixTransform()
{
}
void MatrixTransform::AnimationPathCallback::operator()(Node* node, NodeVisitor* nv)
{
MatrixTransform* mt = dynamic_cast<MatrixTransform*>(node);
if (mt &&
_animationPath.valid() &&
nv->getVisitorType()==NodeVisitor::APP_VISITOR &&
nv->getFrameStamp())
{
double time = nv->getFrameStamp()->getReferenceTime();
if (_firstTime==0.0) _firstTime = time;
Matrix matrix;
if (_animationPath->getMatrix(time-_firstTime,matrix))
{
mt->setMatrix(matrix);
}
}
}