From Mikhail Izmestev, "Attached fix to avoid vector reallocs on push_back in StateGraph::moveStateGraph."

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14334 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2014-06-30 10:13:19 +00:00
parent 147c5e183f
commit bb8b1538c7

View File

@ -207,6 +207,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
// use return path to trace back steps to sg_new. // use return path to trace back steps to sg_new.
std::vector<StateGraph*> return_path; std::vector<StateGraph*> return_path;
return_path.reserve(sg_new->_depth+1);
// need to pop back root render graph. // need to pop back root render graph.
do do
@ -248,6 +249,7 @@ class OSGUTIL_EXPORT StateGraph : public osg::Referenced
// use return path to trace back steps to sg_new. // use return path to trace back steps to sg_new.
std::vector<StateGraph*> return_path; std::vector<StateGraph*> return_path;
return_path.reserve(sg_new->_depth+1);
// need to pop back up to the same depth as the curr state group. // need to pop back up to the same depth as the curr state group.
while (sg_new->_depth>sg_curr->_depth) while (sg_new->_depth>sg_curr->_depth)