From a4aa8fbcd21c2339e1b76c787b83062b955cc06c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 8 Oct 2008 10:55:20 +0000 Subject: [PATCH] Replaced std::vector::insert with std::copy + back_inserter to avoid member template problems with sunos. --- src/osgShadow/ConvexPolyhedron.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/osgShadow/ConvexPolyhedron.cpp b/src/osgShadow/ConvexPolyhedron.cpp index c8f868bd7..0183d739f 100644 --- a/src/osgShadow/ConvexPolyhedron.cpp +++ b/src/osgShadow/ConvexPolyhedron.cpp @@ -15,13 +15,15 @@ */ #include -#include -#include -#include #include #include #include +#include +#include +#include + + using namespace osgShadow; @@ -591,8 +593,7 @@ void ConvexPolyhedron::transformClip(const osg::Matrix& matrix, const osg::Matri } #endif - face.vertices.insert( face.vertices.begin(), - vertices.begin(), vertices.end() ); + std::copy(vertices.begin(), vertices.end(), std::back_inserter(face.vertices)); face.plane.set( vertices[0], vertices[1], vertices[2] ); @@ -734,8 +735,9 @@ bool ConvexPolyhedron::mergeFaces #if 1 // Resulting plane will be the same as face0 face.plane = face0.plane; - face.vertices.insert( face.vertices.begin(), - vertices.begin(), vertices.end() ); + + std::copy(vertices.begin(), vertices.end(), std::back_inserter(face.vertices)); + #else // Compute resulting plane as average of faces (not a good idea) osg::Vec3d normal = face0.plane.getNormal() + face1.plane.getNormal(); normal.normalize(); @@ -1485,8 +1487,8 @@ void ConvexPolyhedron::cut(const osg::Plane& plane, const std::string& name) } #endif - face.vertices.insert( face.vertices.begin(), - vertices.begin(), vertices.end() ); + std::copy(vertices.begin(), vertices.end(), std::back_inserter(face.vertices)); + _faces.push_back(face); // Last vertex is duplicated - remove one instance