From 8f81cf2ac6a7cbd1f49d4ae89dc5edd093baf0af Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 16 Dec 2002 17:00:05 +0000 Subject: [PATCH] Moved TriangleFunctor from Drawable into its own header file. --- include/osg/Drawable | 321 ------------------------ include/osg/TriangleFunctor | 336 ++++++++++++++++++++++++++ src/Demos/osggeometry/osggeometry.cpp | 1 + src/osgUtil/IntersectVisitor.cpp | 1 + src/osgUtil/SmoothingVisitor.cpp | 2 + src/osgUtil/TriStripVisitor.cpp | 2 +- 6 files changed, 341 insertions(+), 322 deletions(-) create mode 100644 include/osg/TriangleFunctor diff --git a/include/osg/Drawable b/include/osg/Drawable index e17ecd98f..8d7456339 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -439,327 +439,6 @@ inline void Drawable::draw(State& state) } }; -template -class TriangleFunctor : public Drawable::PrimitiveFunctor, public T -{ -public: - - TriangleFunctor() - { - _vertexArraySize=0; - _vertexArrayPtr=0; - _modeCache=0; - } - - virtual ~TriangleFunctor() {} - - virtual void setVertexArray(unsigned int count,const Vec3* vertices) - { - _vertexArraySize = count; - _vertexArrayPtr = vertices; - } - - virtual void drawArrays(GLenum mode,GLint first,GLsizei count) - { - if (_vertexArrayPtr==0 && count==0) return; - - switch(mode) - { - case(GL_TRIANGLES): - { - const Vec3* vlast = &_vertexArrayPtr[first+count]; - for(const Vec3* vptr=&_vertexArrayPtr[first];vptr _vertexCache; - -}; - } diff --git a/include/osg/TriangleFunctor b/include/osg/TriangleFunctor new file mode 100644 index 000000000..9405096cd --- /dev/null +++ b/include/osg/TriangleFunctor @@ -0,0 +1,336 @@ +//C++ header - Open Scene Graph - Copyright (C) 1998-2002 Robert Osfield +//Distributed under the terms of the GNU Library General Public License (LGPL) +//as published by the Free Software Foundation. + +#ifndef OSG_TRIANGLEFUNCTOR +#define OSG_TRIANGLEFUNCTOR 1 + +#include + +namespace osg { + +template +class TriangleFunctor : public Drawable::PrimitiveFunctor, public T +{ +public: + + TriangleFunctor() + { + _vertexArraySize=0; + _vertexArrayPtr=0; + _modeCache=0; + } + + virtual ~TriangleFunctor() {} + + virtual void setVertexArray(unsigned int count,const Vec3* vertices) + { + _vertexArraySize = count; + _vertexArrayPtr = vertices; + } + + virtual void drawArrays(GLenum mode,GLint first,GLsizei count) + { + if (_vertexArrayPtr==0 && count==0) return; + + switch(mode) + { + case(GL_TRIANGLES): + { + const Vec3* vlast = &_vertexArrayPtr[first+count]; + for(const Vec3* vptr=&_vertexArrayPtr[first];vptr _vertexCache; + +}; + + +} + +#endif diff --git a/src/Demos/osggeometry/osggeometry.cpp b/src/Demos/osggeometry/osggeometry.cpp index 3e526c5b6..b37083d18 100644 --- a/src/Demos/osggeometry/osggeometry.cpp +++ b/src/Demos/osggeometry/osggeometry.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/src/osgUtil/IntersectVisitor.cpp b/src/osgUtil/IntersectVisitor.cpp index ddc89c18d..98909c859 100644 --- a/src/osgUtil/IntersectVisitor.cpp +++ b/src/osgUtil/IntersectVisitor.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include diff --git a/src/osgUtil/SmoothingVisitor.cpp b/src/osgUtil/SmoothingVisitor.cpp index 26c3ec64c..969c799bf 100644 --- a/src/osgUtil/SmoothingVisitor.cpp +++ b/src/osgUtil/SmoothingVisitor.cpp @@ -1,3 +1,5 @@ +#include + #include #include diff --git a/src/osgUtil/TriStripVisitor.cpp b/src/osgUtil/TriStripVisitor.cpp index 2b399d6cb..898ee2e3e 100644 --- a/src/osgUtil/TriStripVisitor.cpp +++ b/src/osgUtil/TriStripVisitor.cpp @@ -1,6 +1,6 @@ - #include #include +#include #include