diff --git a/components/sceneutil/riggeometry.cpp b/components/sceneutil/riggeometry.cpp index 410ab5300..edbb6371e 100644 --- a/components/sceneutil/riggeometry.cpp +++ b/components/sceneutil/riggeometry.cpp @@ -82,12 +82,14 @@ RigGeometry::RigGeometry(const RigGeometry ©, const osg::CopyOp ©op) , mLastFrameNumber(0) , mBoundsFirstFrame(true) { - setSourceGeometry(copy.mSourceGeometry); + mSourceVertices = copy.mSourceVertices; + mSourceNormals = copy.mSourceNormals; } void RigGeometry::setSourceGeometry(osg::ref_ptr sourceGeometry) { - mSourceGeometry = sourceGeometry; + mSourceVertices = static_cast(sourceGeometry->getVertexArray()); + mSourceNormals = static_cast(sourceGeometry->getNormalArray()); osg::Geometry& from = *sourceGeometry; @@ -223,8 +225,8 @@ void RigGeometry::update(osg::NodeVisitor* nv) mSkeleton->updateBoneMatrices(nv); // skinning - osg::Vec3Array* positionSrc = static_cast(mSourceGeometry->getVertexArray()); - osg::Vec3Array* normalSrc = static_cast(mSourceGeometry->getNormalArray()); + osg::Vec3Array* positionSrc = mSourceVertices; + osg::Vec3Array* normalSrc = mSourceNormals; osg::Vec3Array* positionDst = static_cast(getVertexArray()); osg::Vec3Array* normalDst = static_cast(getNormalArray()); diff --git a/components/sceneutil/riggeometry.hpp b/components/sceneutil/riggeometry.hpp index 90d4c1156..fb4b914a0 100644 --- a/components/sceneutil/riggeometry.hpp +++ b/components/sceneutil/riggeometry.hpp @@ -41,6 +41,7 @@ namespace SceneUtil /// Initialize this geometry from the source geometry. /// @note The source geometry will not be modified. + /// @note The source geometry's normal and vertex arrays must be an osg::Vec3Array. void setSourceGeometry(osg::ref_ptr sourceGeom); // Called automatically by our CullCallback @@ -50,7 +51,8 @@ namespace SceneUtil void updateBounds(osg::NodeVisitor* nv); private: - osg::ref_ptr mSourceGeometry; + osg::ref_ptr mSourceVertices; + osg::ref_ptr mSourceNormals; Skeleton* mSkeleton; osg::NodePath mSkelToGeomPath;