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
This commit is contained in:
Robert Osfield 2015-01-12 10:30:50 +00:00
parent d409ffcb91
commit ed57c8718c
3 changed files with 16 additions and 4 deletions

View File

@ -119,6 +119,14 @@ public:
/// Mimics the OpenGL \c glEnd() function.
virtual void end() = 0;
void useVertexCacheAsVertexArray()
{
setVertexArray(_vertexCache.size(),&_vertexCache.front());
}
std::vector<Vec3> _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<Vec3> _vertexCache;
bool _treatVertexDataAsTemporary;
};
class DrawElements;

View File

@ -307,8 +307,6 @@ namespace osg {
const Vec3* _vertexArrayPtr;
GLenum _modeCache;
std::vector<Vec3> _vertexCache;
bool _treatVertexDataAsTemporary;
};

View File

@ -387,8 +387,6 @@ protected:
const Vec3* _vertexArrayPtr;
GLenum _modeCache;
std::vector<Vec3> _vertexCache;
bool _treatVertexDataAsTemporary;
};