From c73ec7112392d9e61992f12878ca27b5207ac459 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 22 Mar 2016 23:28:57 +0100 Subject: [PATCH] Revert "Store the RigGeometry's source vertices and normals directly" This reverts commit 7a347e34832419fb8283d59f6843939c2316e4ab. --- components/sceneutil/riggeometry.cpp | 10 ++++------ components/sceneutil/riggeometry.hpp | 4 +--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/components/sceneutil/riggeometry.cpp b/components/sceneutil/riggeometry.cpp index edbb6371e..410ab5300 100644 --- a/components/sceneutil/riggeometry.cpp +++ b/components/sceneutil/riggeometry.cpp @@ -82,14 +82,12 @@ RigGeometry::RigGeometry(const RigGeometry ©, const osg::CopyOp ©op) , mLastFrameNumber(0) , mBoundsFirstFrame(true) { - mSourceVertices = copy.mSourceVertices; - mSourceNormals = copy.mSourceNormals; + setSourceGeometry(copy.mSourceGeometry); } void RigGeometry::setSourceGeometry(osg::ref_ptr sourceGeometry) { - mSourceVertices = static_cast(sourceGeometry->getVertexArray()); - mSourceNormals = static_cast(sourceGeometry->getNormalArray()); + mSourceGeometry = sourceGeometry; osg::Geometry& from = *sourceGeometry; @@ -225,8 +223,8 @@ void RigGeometry::update(osg::NodeVisitor* nv) mSkeleton->updateBoneMatrices(nv); // skinning - osg::Vec3Array* positionSrc = mSourceVertices; - osg::Vec3Array* normalSrc = mSourceNormals; + osg::Vec3Array* positionSrc = static_cast(mSourceGeometry->getVertexArray()); + osg::Vec3Array* normalSrc = static_cast(mSourceGeometry->getNormalArray()); 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 fb4b914a0..90d4c1156 100644 --- a/components/sceneutil/riggeometry.hpp +++ b/components/sceneutil/riggeometry.hpp @@ -41,7 +41,6 @@ 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 @@ -51,8 +50,7 @@ namespace SceneUtil void updateBounds(osg::NodeVisitor* nv); private: - osg::ref_ptr mSourceVertices; - osg::ref_ptr mSourceNormals; + osg::ref_ptr mSourceGeometry; Skeleton* mSkeleton; osg::NodePath mSkelToGeomPath;