Added scale parameter into PositionAttitudeTransform.

Added pivotPoint parameter into AnimationPathCallack.
This commit is contained in:
Robert Osfield
2004-02-22 11:58:44 +00:00
parent e36ceae483
commit ac812539d8
10 changed files with 74 additions and 21 deletions

View File

@@ -14,7 +14,8 @@
using namespace osg;
PositionAttitudeTransform::PositionAttitudeTransform()
PositionAttitudeTransform::PositionAttitudeTransform():
_scale(1.0f,1.0f,1.0f)
{
}
@@ -23,12 +24,14 @@ bool PositionAttitudeTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVis
if (_referenceFrame==RELATIVE_TO_PARENTS)
{
matrix.preMult(osg::Matrix::translate(-_pivotPoint)*
osg::Matrix::scale(_scale)*
osg::Matrix::rotate(_attitude)*
osg::Matrix::translate(_position));
}
else // absolute
{
matrix = osg::Matrix::translate(-_pivotPoint)*
osg::Matrix::scale(_scale)*
osg::Matrix::rotate(_attitude)*
osg::Matrix::translate(_position);
}
@@ -42,12 +45,14 @@ bool PositionAttitudeTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVis
{
matrix.postMult(osg::Matrix::translate(-_position)*
osg::Matrix::rotate(_attitude.inverse())*
osg::Matrix::scale(1.0f/_scale.x(),1.0f/_scale.y(),1.0f/_scale.z())*
osg::Matrix::translate(_pivotPoint));
}
else // absolute
{
matrix = osg::Matrix::translate(-_position)*
osg::Matrix::rotate(_attitude.inverse())*
osg::Matrix::scale(1.0f/_scale.x(),1.0f/_scale.y(),1.0f/_scale.z())*
osg::Matrix::translate(_pivotPoint);
}
return true;