RigGeometry: do not allocate new NodePath every frame

openmw-38
scrawl 9 years ago
parent 6d5aa272fc
commit 94e8560bf8

@ -298,7 +298,7 @@ void RigGeometry::updateBounds(osg::NodeVisitor *nv)
void RigGeometry::updateGeomToSkelMatrix(osg::NodeVisitor *nv) void RigGeometry::updateGeomToSkelMatrix(osg::NodeVisitor *nv)
{ {
osg::NodePath path; mSkelToGeomPath.clear();
bool foundSkel = false; bool foundSkel = false;
for (osg::NodePath::const_iterator it = nv->getNodePath().begin(); it != nv->getNodePath().end(); ++it) for (osg::NodePath::const_iterator it = nv->getNodePath().begin(); it != nv->getNodePath().end(); ++it)
{ {
@ -308,9 +308,9 @@ void RigGeometry::updateGeomToSkelMatrix(osg::NodeVisitor *nv)
foundSkel = true; foundSkel = true;
} }
else else
path.push_back(*it); mSkelToGeomPath.push_back(*it);
} }
mGeomToSkelMatrix = osg::computeWorldToLocal(path); mGeomToSkelMatrix = osg::computeWorldToLocal(mSkelToGeomPath);
} }
void RigGeometry::setInfluenceMap(osg::ref_ptr<InfluenceMap> influenceMap) void RigGeometry::setInfluenceMap(osg::ref_ptr<InfluenceMap> influenceMap)

@ -48,6 +48,7 @@ namespace SceneUtil
osg::ref_ptr<osg::Geometry> mSourceGeometry; osg::ref_ptr<osg::Geometry> mSourceGeometry;
Skeleton* mSkeleton; Skeleton* mSkeleton;
osg::NodePath mSkelToGeomPath;
osg::Matrixf mGeomToSkelMatrix; osg::Matrixf mGeomToSkelMatrix;
osg::ref_ptr<InfluenceMap> mInfluenceMap; osg::ref_ptr<InfluenceMap> mInfluenceMap;

Loading…
Cancel
Save