diff --git a/include/osgAnimation/RigTransformSoftware b/include/osgAnimation/RigTransformSoftware index f88988e9bcd..0792ee99a55 100644 --- a/include/osgAnimation/RigTransformSoftware +++ b/include/osgAnimation/RigTransformSoftware @@ -133,7 +133,7 @@ namespace osgAnimation }; template - inline void compute(const osg::Matrix& transform, const osg::Matrix& invTransform, const V* src, V* dst) + inline void compute(const osg::Matrix& transform, const osg::Matrix& invTransform, const V* src, V* dst, osg::BoundingBox* bbox = NULL) { // the result of matrix mult should be cached to be used for vertices transform and normal transform and maybe other computation for(VertexGroupList::iterator itvg=_uniqVertexGroupList.begin(); itvg!=_uniqVertexGroupList.end(); ++itvg) @@ -145,7 +145,10 @@ namespace osgAnimation const IndexList& vertices = uniq.getVertices(); for(IndexList::const_iterator vertIDit=vertices.begin(); vertIDit!=vertices.end(); ++vertIDit) { - dst[*vertIDit] = src[*vertIDit] * matrix; + osg::Vec3 v = src[*vertIDit] * matrix; + dst[*vertIDit] = v; + if (bbox) + bbox->expandBy(v); } } diff --git a/src/osgAnimation/RigTransformSoftware.cpp b/src/osgAnimation/RigTransformSoftware.cpp index e659e53bdb7..9882bab9b8f 100644 --- a/src/osgAnimation/RigTransformSoftware.cpp +++ b/src/osgAnimation/RigTransformSoftware.cpp @@ -248,10 +248,12 @@ void RigTransformSoftware::operator()(RigGeometry& geom) osg::Vec3Array* normalDst = static_cast(destination.getNormalArray()); + osg::BoundingBox bbox; compute(geom.getMatrixFromSkeletonToGeometry(), geom.getInvMatrixFromSkeletonToGeometry(), &positionSrc->front(), - &positionDst->front()); + &positionDst->front(), &bbox); + geom.setInitialBound(bbox); positionDst->dirty(); if (normalSrc )