From 51dd9676db3fed14b7278b3055a93cbf136987f8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 26 May 2008 22:34:06 +0000 Subject: [PATCH] From Paul Martz, "When exporting a DrawArrays PrimitiveSet, the DAE plugin computes an incorrect nbVerticesPerPoly if the first index is not zero. The issue can be reproduced easily with: osgconv cessna.osg cessna.dae Examination of the resulting .dae file reveals several out-of-range tristrip indices; viewing the .dae file in osgviewer causes a crash when OSG tries to lookup those indices. Attached resolves this issue." --- src/osgPlugins/dae/daeWGeometry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osgPlugins/dae/daeWGeometry.cpp b/src/osgPlugins/dae/daeWGeometry.cpp index e57eea518..6aeb431fb 100644 --- a/src/osgPlugins/dae/daeWGeometry.cpp +++ b/src/osgPlugins/dae/daeWGeometry.cpp @@ -587,7 +587,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st } unsigned int indexBegin = drawArray->getFirst(); - unsigned int nbVerticesPerPoly=indexEnd/p.size(); + unsigned int nbVerticesPerPoly=(indexEnd-indexBegin)/p.size(); unsigned int indexPolyEnd = indexBegin+nbVerticesPerPoly; for( unsigned int iPoly = 0; iPoly < p.size(); ++iPoly ) {