diff --git a/examples/osggeometry/osggeometry.cpp b/examples/osggeometry/osggeometry.cpp index adeb61c60..b3541ba18 100644 --- a/examples/osggeometry/osggeometry.cpp +++ b/examples/osggeometry/osggeometry.cpp @@ -23,7 +23,8 @@ #include #include #include -#include +#include +#include #include #include @@ -60,25 +61,72 @@ struct NormalPrint { - void operator() (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3) const + void operator() (const osg::Vec3& v1, bool) const + { + std::cout << "\rpoint("< tf; + osg::TemplatePrimitiveFunctor tf; drawable.accept(tf); std::cout< pf; + drawable.accept(pf); + + std::cout<addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS,0,vertices->size())); + printPrimitiveIndices("POINTS indices", *pointsGeom); // add the points geometry to the geode. geode->addDrawable(pointsGeom); @@ -189,6 +238,7 @@ osg::Node* createScene() // since we know up front, linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,8)); + printPrimitiveIndices("LINES indices", *linesGeom); // add the points geometry to the geode. geode->addDrawable(linesGeom); @@ -229,6 +279,7 @@ osg::Node* createScene() // since we know up front, linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP,0,5)); + printPrimitiveIndices("LINE_STRIP indices", *linesGeom); // add the points geometry to the geode. geode->addDrawable(linesGeom); @@ -274,6 +325,7 @@ osg::Node* createScene() // since we know up front, linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,numCoords)); + printPrimitiveIndices("LINE_LOOP indices", *linesGeom); // add the points geometry to the geode. geode->addDrawable(linesGeom); @@ -342,7 +394,8 @@ osg::Node* createScene() // since we know up front, polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,numCoords)); - printTriangles("Polygon",*polyGeom); + printPrimitiveIndices("POLYGON indices", *polyGeom); + printPrimitives("POLYGON vertices", *polyGeom); // add the points geometry to the geode. geode->addDrawable(polyGeom); @@ -388,7 +441,8 @@ osg::Node* createScene() polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,numCoords)); - printTriangles("Quads",*polyGeom); + printPrimitiveIndices("QUADS indices", *polyGeom); + printPrimitives("QUADS vertices", *polyGeom); // add the points geometry to the geode. geode->addDrawable(polyGeom); @@ -434,8 +488,8 @@ osg::Node* createScene() // since we know up front, polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,numCoords)); - - printTriangles("Quads strip",*polyGeom); + printPrimitiveIndices("QUAD_STRIP indices", *polyGeom); + printPrimitives("QUAD_STRIP vertices", *polyGeom); // add the points geometry to the geode. geode->addDrawable(polyGeom); @@ -511,7 +565,8 @@ osg::Node* createScene() stateSet->setAttributeAndModes(polygonStipple,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); #endif - printTriangles("Triangles/Strip/Fan",*polyGeom); + printPrimitiveIndices("Triangles/Strip/Fan indices", *polyGeom); + printPrimitives("Triangles/Strip/Fan vertices", *polyGeom); // add the points geometry to the geode. geode->addDrawable(polyGeom); @@ -641,7 +696,9 @@ osg::Node* createBackground() polyGeom->setStateSet(stateset); - // create the Geode (Geometry Node) to contain the quad's osg::Geometry + printPrimitiveIndices("DrawElementsUShort TRIANGLE_STRIP", *polyGeom); + + // create the Geode (Geometry Node) to contain all our osg::Geometry objects. osg::Geode* geode = new osg::Geode(); // add the points geometry to the geode.