From ed57c8718c6e92c2df491d56c0395eb800603829 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 12 Jan 2015 10:30:50 +0000 Subject: [PATCH] Added ability to populate a local vertex cache for when one computes final vertex position in a vertex shader but still want to the Primitive functors to work with the transformed positions. git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14655 16af8721-9629-0410-8352-f15c8da7e697 --- include/osg/PrimitiveSet | 16 ++++++++++++++++ include/osg/TemplatePrimitiveFunctor | 2 -- include/osg/TriangleFunctor | 2 -- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/include/osg/PrimitiveSet b/include/osg/PrimitiveSet index 3c1156f2a..df7df534d 100644 --- a/include/osg/PrimitiveSet +++ b/include/osg/PrimitiveSet @@ -119,6 +119,14 @@ public: /// Mimics the OpenGL \c glEnd() function. virtual void end() = 0; + + void useVertexCacheAsVertexArray() + { + setVertexArray(_vertexCache.size(),&_vertexCache.front()); + } + + std::vector _vertexCache; + bool _treatVertexDataAsTemporary; }; class PrimitiveIndexFunctor @@ -143,6 +151,14 @@ public: virtual void begin(GLenum mode) = 0; virtual void vertex(unsigned int pos) = 0; virtual void end() = 0; + + void useVertexCacheAsVertexArray() + { + setVertexArray(_vertexCache.size(),&_vertexCache.front()); + } + + std::vector _vertexCache; + bool _treatVertexDataAsTemporary; }; class DrawElements; diff --git a/include/osg/TemplatePrimitiveFunctor b/include/osg/TemplatePrimitiveFunctor index 699e0c817..4d446b944 100644 --- a/include/osg/TemplatePrimitiveFunctor +++ b/include/osg/TemplatePrimitiveFunctor @@ -307,8 +307,6 @@ namespace osg { const Vec3* _vertexArrayPtr; GLenum _modeCache; - std::vector _vertexCache; - bool _treatVertexDataAsTemporary; }; diff --git a/include/osg/TriangleFunctor b/include/osg/TriangleFunctor index a60af0940..4f7338a99 100644 --- a/include/osg/TriangleFunctor +++ b/include/osg/TriangleFunctor @@ -387,8 +387,6 @@ protected: const Vec3* _vertexArrayPtr; GLenum _modeCache; - std::vector _vertexCache; - bool _treatVertexDataAsTemporary; };