diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 09db0ef8c..60f11a585 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -1109,7 +1109,7 @@ void Optimizer::RemoveRedundantNodesVisitor::removeRedundantNodes() } else { - std::cout<<"failed dynamic_cast"<begin(),primitiveUByte->end(),std::back_inserter(*new_primitive)); new_primitive->offsetIndices(base); (*primItr) = new_primitive; - std::cout<<"Remapping to a UInt "<<(*primItr)->className()<=256) { // must promote to a DrawElementsUShort @@ -1782,11 +1781,9 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom std::copy(primitiveUByte->begin(),primitiveUByte->end(),std::back_inserter(*new_primitive)); new_primitive->offsetIndices(base); (*primItr) = new_primitive; - std::cout<<"Remapped to a UShort"<<(*primItr)->className()<offsetIndices(base); } } @@ -1925,7 +1922,7 @@ bool Optimizer::SpatializeGroupsVisitor::divide(osg::Group* group, unsigned int bool yAxis = (bb.yMax()-bb.yMin())>divide_distance; bool zAxis = (bb.zMax()-bb.zMin())>divide_distance; - std::cout<<"Dividing "<className()<<" num children = "<getNumChildren()<<" xAxis="<className()<<" num children = "<getNumChildren()<<" xAxis="<getNumParents()<getNumParents()<getNumParents()-1;i>0;--i) { diff --git a/src/osgUtil/TriStripVisitor.cpp b/src/osgUtil/TriStripVisitor.cpp index 6ac51857f..b021c1f7a 100644 --- a/src/osgUtil/TriStripVisitor.cpp +++ b/src/osgUtil/TriStripVisitor.cpp @@ -531,8 +531,6 @@ void TriStripVisitor::stripify(Geometry& geom) geom.copyToAndOptimize(geom); } - - // check for the existance of surface primitives unsigned int numSurfacePrimitives = 0; unsigned int numNonSurfacePrimitives = 0; @@ -780,13 +778,13 @@ void TriStripVisitor::stripify(Geometry& geom) { unsigned int maxValue = *(std::max_element(indices.begin(),indices.end())); - if (maxValue<256) + if (maxValue>=65536) { - osg::DrawElementsUByte* elements = new osg::DrawElementsUByte(GL_QUADS); + osg::DrawElementsUInt* elements = new osg::DrawElementsUInt(GL_QUADS); std::copy(indices.begin(),indices.end(),std::back_inserter(*elements)); new_primitives.push_back(elements); } - else if (maxValue<65536) + else if (maxValue>=256) { osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(GL_QUADS); std::copy(indices.begin(),indices.end(),std::back_inserter(*elements)); @@ -794,7 +792,7 @@ void TriStripVisitor::stripify(Geometry& geom) } else { - osg::DrawElementsUInt* elements = new osg::DrawElementsUInt(GL_QUADS); + osg::DrawElementsUByte* elements = new osg::DrawElementsUByte(GL_QUADS); std::copy(indices.begin(),indices.end(),std::back_inserter(*elements)); new_primitives.push_back(elements); } @@ -826,14 +824,14 @@ void TriStripVisitor::stripify(Geometry& geom) else { unsigned int maxValue = *(std::max_element(pitr->m_Indices.begin(),pitr->m_Indices.end())); - if (maxValue<256) + if (maxValue>=65536) { - osg::DrawElementsUByte* elements = new osg::DrawElementsUByte(pitr->m_Type); + osg::DrawElementsUInt* elements = new osg::DrawElementsUInt(pitr->m_Type); elements->reserve(pitr->m_Indices.size()); std::copy(pitr->m_Indices.begin(),pitr->m_Indices.end(),std::back_inserter(*elements)); new_primitives.push_back(elements); } - else if (maxValue<65536) + else if (maxValue>=256) { osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(pitr->m_Type); elements->reserve(pitr->m_Indices.size()); @@ -842,7 +840,7 @@ void TriStripVisitor::stripify(Geometry& geom) } else { - osg::DrawElementsUInt* elements = new osg::DrawElementsUInt(pitr->m_Type); + osg::DrawElementsUByte* elements = new osg::DrawElementsUByte(pitr->m_Type); elements->reserve(pitr->m_Indices.size()); std::copy(pitr->m_Indices.begin(),pitr->m_Indices.end(),std::back_inserter(*elements)); new_primitives.push_back(elements);