diff --git a/include/osg/PrimitiveSet b/include/osg/PrimitiveSet index 711866aaf..d753831f2 100644 --- a/include/osg/PrimitiveSet +++ b/include/osg/PrimitiveSet @@ -233,12 +233,12 @@ class SG_EXPORT DrawArrayLengths : public PrimitiveSet, public VectorSizei VectorSizei(no), _first(first) {} - template - DrawArrayLengths(GLenum mode, GLint first, InputIterator firstItr,InputIterator lastItr) : + DrawArrayLengths(GLenum mode,GLint first) : PrimitiveSet(DrawArrayLengthsPrimitiveType,mode), - VectorSizei(firstItr,lastItr), + VectorSizei(), _first(first) {} + virtual Object* cloneType() const { return new DrawArrayLengths(); } virtual Object* clone(const CopyOp& copyop) const { return new DrawArrayLengths(*this,copyop); } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } @@ -301,11 +301,6 @@ class SG_EXPORT DrawElementsUByte : public PrimitiveSet, public VectorUByte PrimitiveSet(DrawElementsUBytePrimitiveType,mode), VectorUByte(no) {} - template - DrawElementsUByte(GLenum mode, InputIterator first,InputIterator last) : - PrimitiveSet(DrawElementsUBytePrimitiveType,mode), - VectorUByte(first,last) {} - virtual Object* cloneType() const { return new DrawElementsUByte(); } virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUByte(*this,copyop); } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } @@ -388,11 +383,6 @@ class SG_EXPORT DrawElementsUInt : public PrimitiveSet, public VectorUInt PrimitiveSet(DrawElementsUIntPrimitiveType,mode), VectorUInt(no) {} - template - DrawElementsUInt(GLenum mode, InputIterator first,InputIterator last) : - PrimitiveSet(DrawElementsUIntPrimitiveType,mode), - VectorUInt(first,last) {} - virtual Object* cloneType() const { return new DrawElementsUInt(); } virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsUInt(*this,copyop); } virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast(obj)!=NULL; } diff --git a/src/osg/GeoSet.cpp b/src/osg/GeoSet.cpp index ac95eaeae..b7565340d 100644 --- a/src/osg/GeoSet.cpp +++ b/src/osg/GeoSet.cpp @@ -1176,7 +1176,9 @@ Geometry* GeoSet::convertToGeometry() if (_needprimlen) { - geom->addPrimitiveSet(new DrawArrayLengths((GLenum)_oglprimtype,0, _primLengths, _primLengths+_numprims )); + DrawArrayLengths* primitives = new DrawArrayLengths((GLenum)_oglprimtype); + primitives->insert(primitives->end(), _primLengths, _primLengths+_numprims ); + geom->addPrimitiveSet(primitives); } else { diff --git a/src/osgUtil/TriStripVisitor.cpp b/src/osgUtil/TriStripVisitor.cpp index 038ec4806..c559bcd36 100644 --- a/src/osgUtil/TriStripVisitor.cpp +++ b/src/osgUtil/TriStripVisitor.cpp @@ -37,6 +37,21 @@ struct TriangleAcumulatorFunctor void TriStripVisitor::stripify(Geometry& geom) { + + if (geom.getNormalBinding()==osg::Geometry::BIND_PER_PRIMITIVE || + geom.getNormalBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return; + + if (geom.getColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE || + geom.getColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return; + + if (geom.getSecondaryColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE || + geom.getSecondaryColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return; + + if (geom.getFogCoordBinding()==osg::Geometry::BIND_PER_PRIMITIVE || + geom.getFogCoordBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return; + + + unsigned int numSurfacePrimitives = 0; unsigned int numNonSurfacePrimitives = 0; @@ -118,7 +133,8 @@ void TriStripVisitor::stripify(Geometry& geom) itr!=outPrimitives.end(); ++itr) { - osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(itr->m_Type,itr->m_Indices.begin(),itr->m_Indices.end()); + osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(itr->m_Type); + elements->insert(elements->end(),itr->m_Indices.begin(),itr->m_Indices.end()); new_primitives.push_back(elements); }