From 33201a8f2547f4d34ef861f996b97c5713c61e5d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 9 Feb 2004 10:14:06 +0000 Subject: [PATCH] Added new TriangleIndexFunctor. --- include/osg/TriangleIndexFunctor | 345 +++++++++++++++++++++++++++++++ src/osgUtil/TriStripVisitor.cpp | 324 +---------------------------- 2 files changed, 350 insertions(+), 319 deletions(-) create mode 100644 include/osg/TriangleIndexFunctor diff --git a/include/osg/TriangleIndexFunctor b/include/osg/TriangleIndexFunctor new file mode 100644 index 000000000..b02879738 --- /dev/null +++ b/include/osg/TriangleIndexFunctor @@ -0,0 +1,345 @@ +/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 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 OSG_TRIANGLINDEXEFUNCTOR +#define OSG_TRIANGLINDEXEFUNCTOR 1 + +#include +#include + +namespace osg { + +template +class TriangleIndexFunctor : public Drawable::PrimitiveFunctor, public T +{ +public: + + + virtual void setVertexArray(unsigned int,const Vec2*) + { + notify(WARN)<<"TriangleIndexFunctor does not support Vec2* vertex arrays"< -#include +#include #include #include @@ -164,15 +164,13 @@ class RemapArray : public osg::ArrayVisitor virtual void apply(osg::Vec4Array& array) { remap(array); } }; -class TriangleIndexFunctor : public osg::Drawable::PrimitiveFunctor +struct MyTriangleOperator { -public: - IndexList _remapIndices; triangle_stripper::tri_stripper::indices _in_indices; - inline void triangle(unsigned int p1, unsigned int p2, unsigned int p3) + inline void operator()(unsigned int p1, unsigned int p2, unsigned int p3) { if (_remapIndices.empty()) { @@ -188,320 +186,8 @@ public: } } - virtual void setVertexArray(unsigned int,const Vec2*) - { - notify(WARN)<<"TriangleIndexFunctor does not support Vec2* vertex arrays"< MyTriangleIndexFunctor; void TriStripVisitor::stripify(Geometry& geom) { @@ -653,7 +339,7 @@ void TriStripVisitor::stripify(Geometry& geom) } - TriangleIndexFunctor taf; + MyTriangleIndexFunctor taf; taf._remapIndices.swap(finalMapping); Geometry::PrimitiveSetList new_primitives;