From David Callu, further work in support of shapefile support in VirtualPlanetBuilder
This commit is contained in:
38
include/osgUtil/DrawElementTypeSimplifier
Normal file
38
include/osgUtil/DrawElementTypeSimplifier
Normal file
@@ -0,0 +1,38 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
||||
*
|
||||
* 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
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
#ifndef OSGUTIL_DRAWELEMENTTYPESIMPLIFIER
|
||||
#define OSGUTIL_DRAWELEMENTTYPESIMPLIFIER
|
||||
|
||||
|
||||
#include <osg/Geometry>
|
||||
#include <osg/NodeVisitor>
|
||||
|
||||
namespace osgUtil
|
||||
{
|
||||
|
||||
class DrawElementTypeSimplifier
|
||||
{
|
||||
public:
|
||||
void simplify(osg::Geometry & geometry) const;
|
||||
};
|
||||
|
||||
class DrawElementTypeSimplifierVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
void apply(osg::Geode& node);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // ** OSGUTIL_DRAWELEMENTTYPESIMPLIFIER ** //
|
||||
@@ -25,6 +25,9 @@
|
||||
#include <osg/Geometry>
|
||||
#include <osg/ref_ptr>
|
||||
|
||||
#include <osgUtil/Export>
|
||||
|
||||
|
||||
namespace osgUtil {
|
||||
|
||||
struct dereference_less
|
||||
@@ -55,7 +58,8 @@ namespace osgUtil {
|
||||
}
|
||||
};
|
||||
|
||||
class EdgeCollector
|
||||
|
||||
class OSGUTIL_EXPORT EdgeCollector
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -92,7 +96,7 @@ public:
|
||||
|
||||
unsigned int _index;
|
||||
|
||||
osg::Vec3 _vertex;
|
||||
osg::Vec3d _vertex;
|
||||
TriangleSet _triangles;
|
||||
|
||||
void clear() { _triangles.clear(); }
|
||||
|
||||
@@ -65,7 +65,7 @@ struct AddRangeOperator
|
||||
typedef typename ArrayType::ElementDataType ElementDataType;
|
||||
|
||||
ElementDataType convertedVector;
|
||||
osgUtil::ConvertVec<osg::Vec3, ElementDataType>::convert(_vector, convertedVector);
|
||||
osgUtil::ConvertVec<osg::Vec3d, ElementDataType>::convert(_vector, convertedVector);
|
||||
|
||||
typename ArrayType::iterator it = array.begin();
|
||||
std::advance(it, _begin);
|
||||
@@ -80,7 +80,7 @@ struct AddRangeOperator
|
||||
unsigned int _begin;
|
||||
unsigned int _count;
|
||||
|
||||
osg::Vec3 _vector;
|
||||
osg::Vec3d _vector;
|
||||
};
|
||||
typedef OperationArrayFunctor<AddRangeOperator> AddRangeFunctor;
|
||||
|
||||
@@ -92,7 +92,7 @@ struct MultiplyRangeOperator
|
||||
typedef typename ArrayType::ElementDataType ElementDataType;
|
||||
|
||||
ElementDataType convertedVector;
|
||||
osgUtil::ConvertVec<osg::Vec3, ElementDataType>::convert(_vector, convertedVector);
|
||||
osgUtil::ConvertVec<osg::Vec3d, ElementDataType>::convert(_vector, convertedVector);
|
||||
|
||||
typename ArrayType::iterator it = array.begin();
|
||||
std::advance(it, _begin);
|
||||
@@ -107,7 +107,7 @@ struct MultiplyRangeOperator
|
||||
unsigned int _begin;
|
||||
unsigned int _count;
|
||||
|
||||
osg::Vec3 _vector;
|
||||
osg::Vec3d _vector;
|
||||
};
|
||||
typedef OperationArrayFunctor<MultiplyRangeOperator> MultiplyRangeFunctor;
|
||||
|
||||
|
||||
@@ -22,54 +22,36 @@ namespace osgUtil {
|
||||
|
||||
class ReversePrimitiveFunctor : public osg::PrimitiveIndexFunctor
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~ReversePrimitiveFunctor() {}
|
||||
|
||||
osg::PrimitiveSet * getReversedPrimitiveSet() { return _reversedPrimitiveSet.get(); }
|
||||
public:
|
||||
|
||||
virtual void setVertexArray(unsigned int /*count*/,const osg::Vec2* /*vertices*/)
|
||||
{ osg::notify(osg::WARN) << "ReversePrimitiveFunctor : not implemented " << std::endl; }
|
||||
|
||||
virtual void setVertexArray(unsigned int /*count*/,const osg::Vec3* /*vertices*/)
|
||||
{ osg::notify(osg::WARN) << "ReversePrimitiveFunctor : not implemented " << std::endl; }
|
||||
|
||||
virtual void setVertexArray(unsigned int /*count*/,const osg::Vec4* /*vertices*/)
|
||||
{ osg::notify(osg::WARN) << "ReversePrimitiveFunctor : not implemented " << std::endl; }
|
||||
|
||||
virtual void setVertexArray(unsigned int /*count*/,const osg::Vec2d* /*vertices*/)
|
||||
{ osg::notify(osg::WARN) << "ReversePrimitiveFunctor : not implemented " << std::endl; }
|
||||
|
||||
virtual void setVertexArray(unsigned int /*count*/,const osg::Vec3d* /*vertices*/)
|
||||
{ osg::notify(osg::WARN) << "ReversePrimitiveFunctor : not implemented " << std::endl; }
|
||||
|
||||
virtual void setVertexArray(unsigned int /*count*/,const osg::Vec4d* /*vertices*/)
|
||||
{ osg::notify(osg::WARN) << "ReversePrimitiveFunctor : not implemented " << std::endl; }
|
||||
|
||||
virtual void drawArrays(GLenum /*mode*/,GLint /*first*/,GLsizei /*count*/)
|
||||
{ osg::notify(osg::WARN) << "ReversePrimitiveFunctor : not implemented " << std::endl; }
|
||||
|
||||
virtual void drawElements(GLenum mode,GLsizei count,const GLubyte* indices);
|
||||
|
||||
virtual void drawElements(GLenum mode,GLsizei count,const GLushort* indices);
|
||||
|
||||
virtual void drawElements(GLenum mode,GLsizei count,const GLuint* indices);
|
||||
|
||||
|
||||
/// Mimics the OpenGL \c glBegin() function.
|
||||
virtual void begin(GLenum /*mode*/)
|
||||
{ osg::notify(osg::WARN) << "ReversePrimitiveFunctor : not implemented " << std::endl; }
|
||||
|
||||
virtual void vertex(unsigned int /*pos*/)
|
||||
{ osg::notify(osg::WARN) << "ReversePrimitiveFunctor : not implemented " << std::endl; }
|
||||
|
||||
virtual void end()
|
||||
{ osg::notify(osg::WARN) << "ReversePrimitiveFunctor : not implemented " << std::endl; }
|
||||
virtual ~ReversePrimitiveFunctor() {}
|
||||
|
||||
osg::PrimitiveSet * getReversedPrimitiveSet() { return _reversedPrimitiveSet.get(); }
|
||||
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec2* ) {}
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec3* ) {}
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec4* ) {}
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec2d* ) {}
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec3d* ) {}
|
||||
virtual void setVertexArray(unsigned int , const osg::Vec4d* ) {}
|
||||
|
||||
osg::ref_ptr<osg::PrimitiveSet> _reversedPrimitiveSet;
|
||||
virtual void drawArrays(GLenum mode,GLint first,GLsizei count);
|
||||
virtual void drawElements(GLenum mode,GLsizei count, const GLubyte* indices);
|
||||
virtual void drawElements(GLenum mode,GLsizei count, const GLushort* indices);
|
||||
virtual void drawElements(GLenum mode,GLsizei count, const GLuint* indices);
|
||||
|
||||
|
||||
/// Mimics the OpenGL \c glBegin() function.
|
||||
virtual void begin(GLenum mode);
|
||||
virtual void vertex(unsigned int /*pos*/);
|
||||
virtual void end();
|
||||
|
||||
|
||||
osg::ref_ptr<osg::PrimitiveSet> _reversedPrimitiveSet;
|
||||
|
||||
private:
|
||||
|
||||
bool _running;
|
||||
};
|
||||
|
||||
} // end osgUtil namespace
|
||||
|
||||
Reference in New Issue
Block a user