Removed unused ShapesToGeometriesVisitor.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14823 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-04-07 15:52:02 +00:00
parent 6cff8650f2
commit 31488eeba1
2 changed files with 18 additions and 45 deletions

View File

@ -1,14 +1,14 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
* Copyright (C) 2014 Pawel Ksiezopolski
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*
*/
@ -26,7 +26,7 @@ void FakeGLBeginEndAdapter::PushMatrix()
{
if (_matrixStack.empty())
_matrixStack.push_back(osg::Matrixd());
else
else
_matrixStack.push_back(_matrixStack.back());
}
void FakeGLBeginEndAdapter::MultMatrixd(const GLdouble* m)
@ -91,7 +91,7 @@ void FakeGLBeginEndAdapter::End()
_overallNormal.normalize();
}
}
if (_colorAssigned)
{
@ -154,9 +154,9 @@ void FakeGLBeginEndAdapter::End()
if (_primitiveMode==GL_QUAD_STRIP) // will the winding be wrong? Do we need to swap it?
geometry->addPrimitiveSet( new osg::DrawArrays( GL_TRIANGLE_STRIP, vOffset, vSize ) );
else if (_primitiveMode==GL_POLYGON)
else if (_primitiveMode==GL_POLYGON)
geometry->addPrimitiveSet( new osg::DrawArrays( GL_TRIANGLE_FAN, vOffset, vSize ) );
else
else
geometry->addPrimitiveSet( new osg::DrawArrays( _primitiveMode, vOffset, vSize ) );
}
@ -1156,18 +1156,3 @@ osg::Geode* convertShapeToGeode(const osg::Shape& shape, const osg::Tessellation
geode->addDrawable( convertShapeToGeometry(shape,hints,color) );
return geode;
}
void ShapesToGeometriesVisitor::apply( osg::Geode& geode )
{
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
{
osg::ShapeDrawable* drawable = dynamic_cast<osg::ShapeDrawable*>( geode.getDrawable(i) );
if(drawable==NULL)
continue;
osg::Geometry* newGeom = convertShapeToGeometry(*(drawable->getShape()), _hints);
newGeom->setStateSet( drawable->getStateSet() );
geode.setDrawable( i, newGeom );
}
traverse(geode);
}

View File

@ -1,19 +1,19 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
* Copyright (C) 2014 Pawel Ksiezopolski
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*
*/
#ifndef SHAPE_TO_GEOMETRY
#define SHAPE_TO_GEOMETRY 1
#define SHAPE_TO_GEOMETRY 1
#include <osg/Geometry>
#include <osg/Geode>
#include <osg/ShapeDrawable>
@ -23,19 +23,19 @@
const unsigned int MIN_NUM_ROWS = 3;
const unsigned int MIN_NUM_SEGMENTS = 5;
// osg::GLBeginEndAdapter descendant that stores data for osg::Geometry creation
// osg::GLBeginEndAdapter descendant that stores data for osg::Geometry creation
class FakeGLBeginEndAdapter : public osg::GLBeginEndAdapter
{
public:
public:
FakeGLBeginEndAdapter();
void PushMatrix();
void MultMatrixd(const GLdouble* m);
void Translated(GLdouble x, GLdouble y, GLdouble z);
void Scaled(GLdouble x, GLdouble y, GLdouble z);
void Rotated(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
void End();
osg::ref_ptr<osg::Geometry> geometry;
};
@ -60,7 +60,7 @@ public:
virtual void apply(const osg::HeightField&);
virtual void apply(const osg::CompositeShape&);
osg::Geometry* getGeometry() { return gl.geometry.get(); }
@ -93,17 +93,5 @@ osg::Geode* convertShapeToGeode(const osg::Shape& shape, const osg::Tessellation
// osg::ref_ptr<osg::Geometry> capsuleGeometry = convertShapeToGeometry(*shape.get(), tessHints.get());
// osg::ref_ptr<osg::Geometry> redCapsuleGeometry = convertShapeToGeometry(*shape.get(), tessHints.get(), osg::Vec4(1.0,0.0,0.0,1.0) );
class ShapesToGeometriesVisitor : public osg::NodeVisitor
{
public:
ShapesToGeometriesVisitor( osg::TessellationHints* hints )
: osg::NodeVisitor( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN ), _hints(hints)
{
}
void apply( osg::Geode& geode);
protected:
osg::TessellationHints* _hints;
};
#endif