PrimitiveSetIndirect
Go to the documentation of this file.
/* -*-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.
*
* osg/PrimitiveSetIndirect
* Author: Julien Valentin 2016-2017
*/
#ifndef OSG_INDIRECTPRIMITIVESET
#define OSG_INDIRECTPRIMITIVESET 1
#include <osg/PrimitiveSet>
namespace osg {
class OSG_EXPORT IndirectCommandDrawArrays: public BufferData
{
public:
IndirectCommandDrawArrays() : BufferData() { setBufferObject(new DrawIndirectBufferObject()); }
IndirectCommandDrawArrays(const IndirectCommandDrawArrays& copy,const CopyOp& copyop/*=CopyOp::SHALLOW_COPY*/) :
BufferData(copy, copyop) {}
virtual unsigned int getTotalDataSize() const { return getNumElements()*getElementSize(); }
virtual unsigned int & count(const unsigned int&index)=0;
virtual unsigned int & instanceCount(const unsigned int&index)=0;
virtual unsigned int & first(const unsigned int&index)=0;
virtual unsigned int & baseInstance(const unsigned int&index)=0;
virtual unsigned int getElementSize() const = 0;
virtual unsigned int getNumElements() const = 0;
virtual void reserveElements(const unsigned int) = 0;
virtual void resizeElements(const unsigned int) = 0;
};
class OSG_EXPORT IndirectCommandDrawElements: public BufferData
{
public:
IndirectCommandDrawElements() : BufferData() { setBufferObject(new DrawIndirectBufferObject()); }
IndirectCommandDrawElements(const IndirectCommandDrawElements& copy,const CopyOp& copyop/*=CopyOp::SHALLOW_COPY*/)
: BufferData(copy, copyop) {}
virtual unsigned int getTotalDataSize() const { return getNumElements()*getElementSize(); }
virtual unsigned int & count(const unsigned int&index)=0;
virtual unsigned int & instanceCount(const unsigned int&index)=0;
virtual unsigned int & firstIndex(const unsigned int&index)=0;
virtual unsigned int & baseVertex(const unsigned int&index)=0;
virtual unsigned int & baseInstance(const unsigned int&index)=0;
virtual unsigned int getElementSize()const = 0;
virtual unsigned int getNumElements() const = 0;
virtual void reserveElements(const unsigned int) = 0;
virtual void resizeElements(const unsigned int) = 0;
};
struct DrawArraysIndirectCommand
{
DrawArraysIndirectCommand(unsigned int pcount = 0, unsigned int pinstanceCount = 0, unsigned int pfirst = 0, unsigned int pbaseInstance = 0) :
count(pcount), instanceCount(pinstanceCount), first(pfirst), baseInstance(pbaseInstance) {}
unsigned int count;
unsigned int instanceCount;
unsigned int first;
unsigned int baseInstance;
};
class DefaultIndirectCommandDrawArrays: public IndirectCommandDrawArrays, public MixinVector<DrawArraysIndirectCommand>
{
public:
META_Object(osg,DefaultIndirectCommandDrawArrays)
DefaultIndirectCommandDrawArrays() : IndirectCommandDrawArrays(), MixinVector<DrawArraysIndirectCommand>() {}
DefaultIndirectCommandDrawArrays(const DefaultIndirectCommandDrawArrays& copy,const CopyOp& copyop/*=CopyOp::SHALLOW_COPY*/) :
IndirectCommandDrawArrays(copy, copyop),MixinVector<DrawArraysIndirectCommand>() {}
virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
virtual unsigned int getElementSize()const { return 16u; };
virtual unsigned int getNumElements() const { return static_cast<unsigned int>(size()); }
virtual void reserveElements(const unsigned int n) {reserve(n);}
virtual void resizeElements(const unsigned int n) {resize(n);}
virtual unsigned int & count(const unsigned int&index) { return at(index).count; }
virtual unsigned int & instanceCount(const unsigned int&index) { return at(index).instanceCount; }
virtual unsigned int & first(const unsigned int&index) { return at(index).first; }
virtual unsigned int & baseInstance(const unsigned int&index) { return at(index).baseInstance; }
};
struct DrawElementsIndirectCommand
{
DrawElementsIndirectCommand(unsigned int pcount = 0, unsigned int pinstanceCount = 0, unsigned int pfirstIndex = 0, unsigned int pbaseVertex = 0, unsigned int pbaseInstance = 0) :
count(pcount), instanceCount(pinstanceCount), firstIndex(pfirstIndex), baseVertex(pbaseVertex), baseInstance(pbaseInstance) {}
unsigned int count;
unsigned int instanceCount;
unsigned int firstIndex;
unsigned int baseVertex;
unsigned int baseInstance;
};
class DefaultIndirectCommandDrawElements: public IndirectCommandDrawElements, public MixinVector<DrawElementsIndirectCommand>
{
public:
META_Object(osg,DefaultIndirectCommandDrawElements)
DefaultIndirectCommandDrawElements() : IndirectCommandDrawElements(), MixinVector<DrawElementsIndirectCommand>() {}
DefaultIndirectCommandDrawElements(const DefaultIndirectCommandDrawElements& copy,const CopyOp& copyop/*=CopyOp::SHALLOW_COPY*/) :
IndirectCommandDrawElements(copy, copyop), MixinVector<DrawElementsIndirectCommand>() {}
virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
virtual unsigned int getNumElements() const { return static_cast<unsigned int>(size()); }
virtual unsigned int getElementSize()const { return 20u; };
virtual void reserveElements(const unsigned int n) {reserve(n);}
virtual void resizeElements(const unsigned int n) {resize(n);}
virtual unsigned int & count(const unsigned int&index) { return at(index).count; }
virtual unsigned int & instanceCount(const unsigned int&index) { return at(index).instanceCount; }
virtual unsigned int & firstIndex(const unsigned int&index) { return at(index).firstIndex; }
virtual unsigned int & baseVertex(const unsigned int&index) { return at(index).baseVertex; }
virtual unsigned int & baseInstance(const unsigned int&index) { return at(index).baseInstance; }
};
class OSG_EXPORT DrawElementsIndirect : public DrawElements
{
public:
DrawElementsIndirect(Type primType=PrimitiveType, GLenum mode = 0,unsigned int firstCommand = 0, GLsizei stride = 0) :
DrawElements(primType,mode, 0),_firstCommand(firstCommand),_stride(stride) { setIndirectCommandArray(new DefaultIndirectCommandDrawElements()); }
DrawElementsIndirect(const DrawElementsIndirect& rhs,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
DrawElements(rhs,copyop),_firstCommand(rhs._firstCommand), _stride(rhs._stride) { _indirectCommandArray=(DefaultIndirectCommandDrawElements*)copyop(rhs._indirectCommandArray.get()); }
inline void setIndirectCommandArray(IndirectCommandDrawElements*idc)
{
_indirectCommandArray = idc;
//ensure bo of idc is of the correct type
if(!dynamic_cast<DrawIndirectBufferObject* >(_indirectCommandArray->getBufferObject()))
_indirectCommandArray->setBufferObject(new DrawIndirectBufferObject());
}
inline IndirectCommandDrawElements* getIndirectCommandArray() { return _indirectCommandArray.get(); }
inline const IndirectCommandDrawElements* getIndirectCommandArray() const { return _indirectCommandArray.get(); }
inline void setFirstCommandToDraw( unsigned int i) { _firstCommand = i; }
inline unsigned int getFirstCommandToDraw() const { return _firstCommand; }
inline void setStride( GLsizei i) { _stride=i; }
inline GLsizei getStride() const { return _stride; }
virtual unsigned int getNumPrimitives() const=0;
protected:
virtual ~DrawElementsIndirect() {}
unsigned int _firstCommand;
GLsizei _stride;
ref_ptr<IndirectCommandDrawElements> _indirectCommandArray;
};
class OSG_EXPORT DrawElementsIndirectUByte : public DrawElementsIndirect, public VectorGLubyte
{
public:
typedef VectorGLubyte vector_type;
DrawElementsIndirectUByte(GLenum mode = 0/*,unsigned int firstCommand = 0, GLsizei stride = 0*/) :
DrawElementsIndirect(DrawElementsUByteIndirectPrimitiveType,mode) {}
DrawElementsIndirectUByte(const DrawElementsIndirectUByte& array, const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
DrawElementsIndirect(array,copyop),
vector_type(array) {}
DrawElementsIndirectUByte(GLenum mode, unsigned int no, const GLubyte* ptr) :
DrawElementsIndirect(DrawElementsUByteIndirectPrimitiveType,mode),
vector_type(ptr,ptr+no) {}
DrawElementsIndirectUByte(GLenum mode, unsigned int no) :
DrawElementsIndirect(DrawElementsUByteIndirectPrimitiveType,mode),
vector_type(no) {}
virtual Object* cloneType() const { return new DrawElementsIndirectUByte(); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsIndirectUByte(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsIndirectUByte*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawElementsIndirectUByte"; }
virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
virtual unsigned int getTotalDataSize() const { return static_cast<unsigned int>(size()); }
virtual bool supportsBufferObject() const { return false; }
virtual void draw(State& state, bool useVertexBufferObjects) const;
virtual void accept(PrimitiveFunctor& functor) const;
virtual void accept(PrimitiveIndexFunctor& functor) const;
virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
virtual void offsetIndices(int offset);
virtual GLenum getDataType() { return GL_UNSIGNED_BYTE; }
virtual void resizeElements(unsigned int numIndices) { resize(numIndices); }
virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
virtual void addElement(unsigned int v) { push_back(GLubyte(v)); }
virtual unsigned int getNumPrimitives() const;
protected:
virtual ~DrawElementsIndirectUByte();
};
class OSG_EXPORT DrawElementsIndirectUShort : public DrawElementsIndirect, public VectorGLushort
{
public:
typedef VectorGLushort vector_type;
DrawElementsIndirectUShort(GLenum mode = 0/*,unsigned int firstCommand = 0, GLsizei stride = 0*/) :
DrawElementsIndirect(DrawElementsUShortIndirectPrimitiveType,mode) {}
DrawElementsIndirectUShort(const DrawElementsIndirectUShort& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
DrawElementsIndirect(array,copyop),
vector_type(array) {}
DrawElementsIndirectUShort(GLenum mode, unsigned int no, const GLushort* ptr) :
DrawElementsIndirect(DrawElementsUShortIndirectPrimitiveType,mode),
vector_type(ptr,ptr+no) {}
DrawElementsIndirectUShort(GLenum mode, unsigned int no) :
DrawElementsIndirect(DrawElementsUShortIndirectPrimitiveType,mode),
vector_type(no) {}
template <class InputIterator>
DrawElementsIndirectUShort(GLenum mode, InputIterator first,InputIterator last) :
DrawElementsIndirect(DrawElementsUShortIndirectPrimitiveType,mode),
vector_type(first,last) {}
virtual Object* cloneType() const { return new DrawElementsIndirectUShort(); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsIndirectUShort(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsIndirectUShort*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawElementsIndirectUShort"; }
virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
virtual unsigned int getTotalDataSize() const { return 2u*static_cast<unsigned int>(size()); }
virtual bool supportsBufferObject() const { return false; }
virtual void draw(State& state, bool useVertexBufferObjects) const;
virtual void accept(PrimitiveFunctor& functor) const;
virtual void accept(PrimitiveIndexFunctor& functor) const;
virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
virtual void offsetIndices(int offset);
virtual GLenum getDataType() { return GL_UNSIGNED_SHORT; }
virtual void resizeElements(unsigned int numIndices) { resize(numIndices); }
virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
virtual void addElement(unsigned int v) { push_back(GLushort(v)); }
virtual unsigned int getNumPrimitives() const;
protected:
virtual ~DrawElementsIndirectUShort();
};
class OSG_EXPORT DrawElementsIndirectUInt : public DrawElementsIndirect, public VectorGLuint
{
public:
typedef VectorGLuint vector_type;
DrawElementsIndirectUInt(GLenum mode = 0/*,unsigned int firstCommand = 0, GLsizei stride = 0*/) :
DrawElementsIndirect(DrawElementsUIntIndirectPrimitiveType,mode) {}
DrawElementsIndirectUInt(const DrawElementsIndirectUInt& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
DrawElementsIndirect(array,copyop),
vector_type(array) {}
DrawElementsIndirectUInt(GLenum mode, unsigned int no, const GLuint* ptr) :
DrawElementsIndirect(DrawElementsUIntIndirectPrimitiveType,mode),
vector_type(ptr,ptr+no) {}
DrawElementsIndirectUInt(GLenum mode, unsigned int no) :
DrawElementsIndirect(DrawElementsUIntIndirectPrimitiveType,mode),
vector_type(no) {}
template <class InputIterator>
DrawElementsIndirectUInt(GLenum mode, InputIterator first,InputIterator last) :
DrawElementsIndirect(DrawElementsUIntIndirectPrimitiveType,mode),
vector_type(first,last) {}
virtual Object* cloneType() const { return new DrawElementsIndirectUInt(); }
virtual Object* clone(const CopyOp& copyop) const { return new DrawElementsIndirectUInt(*this,copyop); }
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const DrawElementsIndirectUInt*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawElementsIndirectUInt"; }
virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
virtual unsigned int getTotalDataSize() const { return 4u*static_cast<unsigned int>(size()); }
virtual bool supportsBufferObject() const { return false; }
virtual void draw(State& state, bool useVertexBufferObjects) const;
virtual void accept(PrimitiveFunctor& functor) const;
virtual void accept(PrimitiveIndexFunctor& functor) const;
virtual unsigned int getNumIndices() const { return static_cast<unsigned int>(size()); }
virtual unsigned int index(unsigned int pos) const { return (*this)[pos]; }
virtual void offsetIndices(int offset);
virtual GLenum getDataType() { return GL_UNSIGNED_INT; }
virtual void resizeElements(unsigned int numIndices) { resize(numIndices); }
virtual void reserveElements(unsigned int numIndices) { reserve(numIndices); }
virtual void setElement(unsigned int i, unsigned int v) { (*this)[i] = v; }
virtual unsigned int getElement(unsigned int i) { return (*this)[i]; }
virtual void addElement(unsigned int v) { push_back(GLuint(v)); }
virtual unsigned int getNumPrimitives() const;
protected:
virtual ~DrawElementsIndirectUInt();
};
class OSG_EXPORT MultiDrawElementsIndirectUShort : public DrawElementsIndirectUShort
{
public:
MultiDrawElementsIndirectUShort(GLenum mode = 0/*,unsigned int firstCommand = 0, GLsizei stride = 0*/) :
DrawElementsIndirectUShort(mode),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType));
}
MultiDrawElementsIndirectUShort(const MultiDrawElementsIndirectUShort& mdi,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
DrawElementsIndirectUShort(mdi,copyop),
_count(mdi._count)
{
}
MultiDrawElementsIndirectUShort(GLenum mode, unsigned int no, const GLushort* ptr) :
DrawElementsIndirectUShort(mode,no,ptr),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType));
}
MultiDrawElementsIndirectUShort(GLenum mode, unsigned int no) :
DrawElementsIndirectUShort(mode,no),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType));
}
template <class InputIterator>
MultiDrawElementsIndirectUShort(GLenum mode, InputIterator first,InputIterator last) :
DrawElementsIndirectUShort(mode,first,last),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType));
}
virtual osg::Object* cloneType() const { return new MultiDrawElementsIndirectUShort(); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new MultiDrawElementsIndirectUShort(*this,copyop); }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const MultiDrawElementsIndirectUShort*>(obj)!=NULL; }
virtual const char* className() const { return "MultiDrawElementsIndirectUShort"; }
virtual void draw(State& state, bool useVertexBufferObjects) const;
virtual void accept(PrimitiveFunctor& functor) const;
virtual void accept(PrimitiveIndexFunctor& functor) const;
virtual unsigned int getNumPrimitives() const;
inline void setNumCommandsToDraw( unsigned int i) { _count=i; }
inline unsigned int getNumCommandsToDraw()const { return _count; }
protected:
unsigned int _count;
virtual ~MultiDrawElementsIndirectUShort();
};
class OSG_EXPORT MultiDrawElementsIndirectUByte : public DrawElementsIndirectUByte
{
public:
MultiDrawElementsIndirectUByte(GLenum mode = 0) :
DrawElementsIndirectUByte(mode),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType));
}
MultiDrawElementsIndirectUByte(const MultiDrawElementsIndirectUByte& mdi,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
DrawElementsIndirectUByte(mdi,copyop),
_count(mdi._count)
{
}
MultiDrawElementsIndirectUByte(GLenum mode, unsigned int no, const GLubyte* ptr) :
DrawElementsIndirectUByte(mode,no,ptr),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType));
}
MultiDrawElementsIndirectUByte(GLenum mode, unsigned int no) :
DrawElementsIndirectUByte(mode,no),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType));
}
template <class InputIterator>
MultiDrawElementsIndirectUByte(GLenum mode, InputIterator first,InputIterator last) :
DrawElementsIndirectUByte(mode,first,last),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType));
}
virtual osg::Object* cloneType() const { return new MultiDrawElementsIndirectUByte(); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new MultiDrawElementsIndirectUByte(*this,copyop); }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const MultiDrawElementsIndirectUByte*>(obj)!=NULL; }
virtual const char* className() const { return "MultiDrawElementsIndirectUByte"; }
virtual void draw(State& state, bool useVertexBufferObjects) const;
virtual void accept(PrimitiveFunctor& functor) const;
virtual void accept(PrimitiveIndexFunctor& functor) const;
virtual unsigned int getNumPrimitives() const;
inline void setNumCommandsToDraw( unsigned int i) { _count=i; }
inline unsigned int getNumCommandsToDraw()const { return _count; }
protected:
unsigned int _count;
virtual ~MultiDrawElementsIndirectUByte();
};
class OSG_EXPORT MultiDrawElementsIndirectUInt : public DrawElementsIndirectUInt
{
public:
MultiDrawElementsIndirectUInt(GLenum mode = 0) :
DrawElementsIndirectUInt(mode),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType));
}
MultiDrawElementsIndirectUInt(const MultiDrawElementsIndirectUInt& mdi,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
DrawElementsIndirectUInt(mdi,copyop),
_count(mdi._count)
{}
MultiDrawElementsIndirectUInt(GLenum mode, unsigned int no, const GLuint* ptr) :
DrawElementsIndirectUInt(mode,no,ptr),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType));
}
MultiDrawElementsIndirectUInt(GLenum mode, unsigned int no) :
DrawElementsIndirectUInt(mode,no),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType));
}
template <class InputIterator>
MultiDrawElementsIndirectUInt(GLenum mode, InputIterator first,InputIterator last) :
DrawElementsIndirectUInt(mode,first,last),
_count(0)
{
_primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType));
}
virtual osg::Object* cloneType() const { return new MultiDrawElementsIndirectUInt(); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new MultiDrawElementsIndirectUInt(*this,copyop); }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const MultiDrawElementsIndirectUInt*>(obj)!=NULL; }
virtual const char* className() const { return "MultiDrawElementsIndirectUInt"; }
virtual void draw(State& state, bool useVertexBufferObjects) const;
virtual void accept(PrimitiveFunctor& functor) const;
virtual void accept(PrimitiveIndexFunctor& functor) const;
virtual unsigned int getNumPrimitives() const;
inline void setNumCommandsToDraw( unsigned int i) { _count=i; }
inline unsigned int getNumCommandsToDraw()const { return _count; }
protected:
unsigned int _count;
virtual ~MultiDrawElementsIndirectUInt();
};
class OSG_EXPORT DrawArraysIndirect : public osg::PrimitiveSet
{
public:
DrawArraysIndirect(GLenum mode=0, unsigned int firstcommand = 0, GLsizei stride = 0) :
osg::PrimitiveSet(Type(DrawArraysIndirectPrimitiveType), mode),
_firstCommand(firstcommand),
_stride(stride)
{
setIndirectCommandArray(new DefaultIndirectCommandDrawArrays);
}
DrawArraysIndirect(const DrawArraysIndirect& dal,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
osg::PrimitiveSet(dal,copyop),
_firstCommand(dal._firstCommand),
_stride(dal._stride),
_indirectCommandArray((DefaultIndirectCommandDrawArrays*)copyop( dal._indirectCommandArray.get()))
{
}
virtual osg::Object* cloneType() const { return new DrawArraysIndirect(); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new DrawArraysIndirect(*this,copyop); }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const DrawArraysIndirect*>(obj)!=NULL; }
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "DrawArraysIndirect"; }
virtual void draw(State& state, bool useVertexBufferObjects) const;
virtual void accept(PrimitiveFunctor& functor) const;
virtual void accept(PrimitiveIndexFunctor& functor) const;
virtual unsigned int getNumIndices() const;
virtual unsigned int index(unsigned int pos) const;
virtual void offsetIndices(int offset);
virtual unsigned int getNumPrimitives() const;
inline void setStride( GLsizei i) { _stride=i; }
inline GLsizei getStride()const { return _stride; }
inline void setFirstCommandToDraw( unsigned int i) { _firstCommand=i; }
inline unsigned int getFirstCommandToDraw() const { return _firstCommand; }
inline void setIndirectCommandArray(IndirectCommandDrawArrays*idc)
{
_indirectCommandArray = idc;
//ensure bo of idc is of the correct type
if(!dynamic_cast<DrawIndirectBufferObject* >(_indirectCommandArray->getBufferObject()))
_indirectCommandArray->setBufferObject(new DrawIndirectBufferObject());
}
inline const IndirectCommandDrawArrays* getIndirectCommandArray() const { return _indirectCommandArray.get(); }
inline IndirectCommandDrawArrays* getIndirectCommandArray() { return _indirectCommandArray.get(); }
protected:
unsigned int _firstCommand;
GLsizei _stride;
ref_ptr<IndirectCommandDrawArrays> _indirectCommandArray;
};
class OSG_EXPORT MultiDrawArraysIndirect : public DrawArraysIndirect
{
public:
MultiDrawArraysIndirect(GLenum mode=0, unsigned int firstcommand = 0, unsigned int count = 0, GLsizei stride = 0) :
osg::DrawArraysIndirect(mode, firstcommand, stride),
_count(count)
{
_primitiveType=Type(MultiDrawArraysIndirectPrimitiveType);
}
MultiDrawArraysIndirect(const MultiDrawArraysIndirect& dal,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
osg::DrawArraysIndirect(dal,copyop),
_count(dal._count)
{}
virtual osg::Object* cloneType() const { return new MultiDrawArraysIndirect(); }
virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new MultiDrawArraysIndirect(*this,copyop); }
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const MultiDrawArraysIndirect*>(obj)!=NULL; }
virtual const char* className() const { return "MultiDrawArraysIndirect"; }
virtual void draw(State& state, bool useVertexBufferObjects) const;
virtual void accept(PrimitiveFunctor& functor) const;
virtual void accept(PrimitiveIndexFunctor& functor) const;
virtual unsigned int getNumIndices() const;
virtual unsigned int index(unsigned int pos) const;
virtual void offsetIndices(int offset);
virtual unsigned int getNumPrimitives() const;
inline void setNumCommandsToDraw( unsigned int i) { _count=i; }
inline unsigned int getNumCommandsToDraw()const { return _count; }
protected:
unsigned int _count;
};
}
#endif
PrimitiveSet
osg::BufferData::BufferData
BufferData()
Definition BufferObject:498
osg::BufferData::setBufferObject
void setBufferObject(BufferObject *bufferObject)
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::DefaultIndirectCommandDrawArrays
Definition PrimitiveSetIndirect:86
osg::DefaultIndirectCommandDrawArrays::instanceCount
virtual unsigned int & instanceCount(const unsigned int &index)
Definition PrimitiveSetIndirect:101
osg::DefaultIndirectCommandDrawArrays::getDataPointer
virtual const GLvoid * getDataPointer() const
Definition PrimitiveSetIndirect:94
osg::DefaultIndirectCommandDrawArrays::count
virtual unsigned int & count(const unsigned int &index)
Definition PrimitiveSetIndirect:100
osg::DefaultIndirectCommandDrawArrays::getNumElements
virtual unsigned int getNumElements() const
Definition PrimitiveSetIndirect:96
osg::DefaultIndirectCommandDrawArrays::resizeElements
virtual void resizeElements(const unsigned int n)
Definition PrimitiveSetIndirect:98
osg::DefaultIndirectCommandDrawArrays::reserveElements
virtual void reserveElements(const unsigned int n)
Definition PrimitiveSetIndirect:97
osg::DefaultIndirectCommandDrawArrays::baseInstance
virtual unsigned int & baseInstance(const unsigned int &index)
Definition PrimitiveSetIndirect:103
osg::DefaultIndirectCommandDrawArrays::DefaultIndirectCommandDrawArrays
DefaultIndirectCommandDrawArrays(const DefaultIndirectCommandDrawArrays &copy, const CopyOp &copyop)
Definition PrimitiveSetIndirect:91
osg::DefaultIndirectCommandDrawArrays::META_Object
META_Object(osg, DefaultIndirectCommandDrawArrays) DefaultIndirectCommandDrawArrays()
Definition PrimitiveSetIndirect:88
osg::DefaultIndirectCommandDrawArrays::first
virtual unsigned int & first(const unsigned int &index)
Definition PrimitiveSetIndirect:102
osg::DefaultIndirectCommandDrawArrays::getElementSize
virtual unsigned int getElementSize() const
Definition PrimitiveSetIndirect:95
osg::DefaultIndirectCommandDrawElements
vector of DrawElementsCommand to be hosted on GPU
Definition PrimitiveSetIndirect:124
osg::DefaultIndirectCommandDrawElements::firstIndex
virtual unsigned int & firstIndex(const unsigned int &index)
Definition PrimitiveSetIndirect:141
osg::DefaultIndirectCommandDrawElements::baseInstance
virtual unsigned int & baseInstance(const unsigned int &index)
Definition PrimitiveSetIndirect:143
osg::DefaultIndirectCommandDrawElements::META_Object
META_Object(osg, DefaultIndirectCommandDrawElements) DefaultIndirectCommandDrawElements()
Definition PrimitiveSetIndirect:126
osg::DefaultIndirectCommandDrawElements::reserveElements
virtual void reserveElements(const unsigned int n)
Definition PrimitiveSetIndirect:136
osg::DefaultIndirectCommandDrawElements::getDataPointer
virtual const GLvoid * getDataPointer() const
Definition PrimitiveSetIndirect:133
osg::DefaultIndirectCommandDrawElements::resizeElements
virtual void resizeElements(const unsigned int n)
Definition PrimitiveSetIndirect:137
osg::DefaultIndirectCommandDrawElements::count
virtual unsigned int & count(const unsigned int &index)
Definition PrimitiveSetIndirect:139
osg::DefaultIndirectCommandDrawElements::getNumElements
virtual unsigned int getNumElements() const
Definition PrimitiveSetIndirect:134
osg::DefaultIndirectCommandDrawElements::baseVertex
virtual unsigned int & baseVertex(const unsigned int &index)
Definition PrimitiveSetIndirect:142
osg::DefaultIndirectCommandDrawElements::instanceCount
virtual unsigned int & instanceCount(const unsigned int &index)
Definition PrimitiveSetIndirect:140
osg::DefaultIndirectCommandDrawElements::DefaultIndirectCommandDrawElements
DefaultIndirectCommandDrawElements(const DefaultIndirectCommandDrawElements &copy, const CopyOp &copyop)
Definition PrimitiveSetIndirect:130
osg::DefaultIndirectCommandDrawElements::getElementSize
virtual unsigned int getElementSize() const
Definition PrimitiveSetIndirect:135
osg::DrawArraysIndirect::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition PrimitiveSetIndirect:642
osg::DrawArraysIndirect::setFirstCommandToDraw
void setFirstCommandToDraw(unsigned int i)
set offset of the first command in the IndirectCommandDrawArrays
Definition PrimitiveSetIndirect:664
osg::DrawArraysIndirect::draw
virtual void draw(State &state, bool useVertexBufferObjects) const
osg::DrawArraysIndirect::clone
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition PrimitiveSetIndirect:641
osg::DrawArraysIndirect::accept
virtual void accept(PrimitiveFunctor &functor) const
osg::DrawArraysIndirect::setIndirectCommandArray
void setIndirectCommandArray(IndirectCommandDrawArrays *idc)
Definition PrimitiveSetIndirect:669
osg::DrawArraysIndirect::getIndirectCommandArray
const IndirectCommandDrawArrays * getIndirectCommandArray() const
Definition PrimitiveSetIndirect:676
osg::DrawArraysIndirect::getIndirectCommandArray
IndirectCommandDrawArrays * getIndirectCommandArray()
Definition PrimitiveSetIndirect:677
osg::DrawArraysIndirect::accept
virtual void accept(PrimitiveIndexFunctor &functor) const
osg::DrawArraysIndirect::className
virtual const char * className() const
Definition PrimitiveSetIndirect:644
osg::DrawArraysIndirect::index
virtual unsigned int index(unsigned int pos) const
osg::DrawArraysIndirect::libraryName
virtual const char * libraryName() const
Definition PrimitiveSetIndirect:643
osg::DrawArraysIndirect::getNumIndices
virtual unsigned int getNumIndices() const
osg::DrawArraysIndirect::cloneType
virtual osg::Object * cloneType() const
Definition PrimitiveSetIndirect:640
osg::DrawArraysIndirect::DrawArraysIndirect
DrawArraysIndirect(const DrawArraysIndirect &dal, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSetIndirect:632
osg::DrawArraysIndirect::_firstCommand
unsigned int _firstCommand
Definition PrimitiveSetIndirect:681
osg::DrawArraysIndirect::setStride
void setStride(GLsizei i)
stride (to set if you use custom CommandArray)
Definition PrimitiveSetIndirect:658
osg::DrawArraysIndirect::_stride
GLsizei _stride
Definition PrimitiveSetIndirect:682
osg::DrawArraysIndirect::_indirectCommandArray
ref_ptr< IndirectCommandDrawArrays > _indirectCommandArray
Definition PrimitiveSetIndirect:683
osg::DrawArraysIndirect::getStride
GLsizei getStride() const
stride (to set if you use custom CommandArray)
Definition PrimitiveSetIndirect:661
osg::DrawArraysIndirect::getFirstCommandToDraw
unsigned int getFirstCommandToDraw() const
get offset of the first command in the IndirectCommandDrawArrays
Definition PrimitiveSetIndirect:667
osg::DrawArraysIndirect::getNumPrimitives
virtual unsigned int getNumPrimitives() const
osg::DrawArraysIndirect::offsetIndices
virtual void offsetIndices(int offset)
osg::DrawArraysIndirect::DrawArraysIndirect
DrawArraysIndirect(GLenum mode=0, unsigned int firstcommand=0, GLsizei stride=0)
Definition PrimitiveSetIndirect:624
osg::DrawElementsIndirectUByte::DrawElementsIndirectUByte
DrawElementsIndirectUByte(const DrawElementsIndirectUByte &array, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSetIndirect:211
osg::DrawElementsIndirectUByte::reserveElements
virtual void reserveElements(unsigned int numIndices)
Definition PrimitiveSetIndirect:254
osg::DrawElementsIndirectUByte::DrawElementsIndirectUByte
DrawElementsIndirectUByte(GLenum mode, unsigned int no, const GLubyte *ptr)
Definition PrimitiveSetIndirect:220
osg::DrawElementsIndirectUByte::className
virtual const char * className() const
Definition PrimitiveSetIndirect:236
osg::DrawElementsIndirectUByte::getTotalDataSize
virtual unsigned int getTotalDataSize() const
Definition PrimitiveSetIndirect:239
osg::DrawElementsIndirectUByte::DrawElementsIndirectUByte
DrawElementsIndirectUByte(GLenum mode=0)
Definition PrimitiveSetIndirect:208
osg::DrawElementsIndirectUByte::vector_type
VectorGLubyte vector_type
Definition PrimitiveSetIndirect:206
osg::DrawElementsIndirectUByte::libraryName
virtual const char * libraryName() const
Definition PrimitiveSetIndirect:235
osg::DrawElementsIndirectUByte::setElement
virtual void setElement(unsigned int i, unsigned int v)
Definition PrimitiveSetIndirect:256
osg::DrawElementsIndirectUByte::getNumIndices
virtual unsigned int getNumIndices() const
Definition PrimitiveSetIndirect:247
osg::DrawElementsIndirectUByte::DrawElementsIndirectUByte
DrawElementsIndirectUByte(GLenum mode, unsigned int no)
Definition PrimitiveSetIndirect:228
osg::DrawElementsIndirectUByte::clone
virtual Object * clone(const CopyOp &copyop) const
Definition PrimitiveSetIndirect:233
osg::DrawElementsIndirectUByte::getDataPointer
virtual const GLvoid * getDataPointer() const
Definition PrimitiveSetIndirect:238
osg::DrawElementsIndirectUByte::getElement
virtual unsigned int getElement(unsigned int i)
Definition PrimitiveSetIndirect:257
osg::DrawElementsIndirectUByte::accept
virtual void accept(PrimitiveIndexFunctor &functor) const
osg::DrawElementsIndirectUByte::cloneType
virtual Object * cloneType() const
Definition PrimitiveSetIndirect:232
osg::DrawElementsIndirectUByte::index
virtual unsigned int index(unsigned int pos) const
Definition PrimitiveSetIndirect:248
osg::DrawElementsIndirectUByte::getNumPrimitives
virtual unsigned int getNumPrimitives() const
osg::DrawElementsIndirectUByte::accept
virtual void accept(PrimitiveFunctor &functor) const
osg::DrawElementsIndirectUByte::resizeElements
virtual void resizeElements(unsigned int numIndices)
Definition PrimitiveSetIndirect:253
osg::DrawElementsIndirectUByte::supportsBufferObject
virtual bool supportsBufferObject() const
Definition PrimitiveSetIndirect:240
osg::DrawElementsIndirectUByte::draw
virtual void draw(State &state, bool useVertexBufferObjects) const
osg::DrawElementsIndirectUByte::getDataType
virtual GLenum getDataType()
Definition PrimitiveSetIndirect:251
osg::DrawElementsIndirectUByte::offsetIndices
virtual void offsetIndices(int offset)
osg::DrawElementsIndirectUByte::addElement
virtual void addElement(unsigned int v)
Definition PrimitiveSetIndirect:259
osg::DrawElementsIndirectUByte::~DrawElementsIndirectUByte
virtual ~DrawElementsIndirectUByte()
osg::DrawElementsIndirectUByte::isSameKindAs
virtual bool isSameKindAs(const Object *obj) const
Definition PrimitiveSetIndirect:234
osg::DrawElementsIndirectUInt::DrawElementsIndirectUInt
DrawElementsIndirectUInt(const DrawElementsIndirectUInt &array, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSetIndirect:352
osg::DrawElementsIndirectUInt::DrawElementsIndirectUInt
DrawElementsIndirectUInt(GLenum mode, unsigned int no, const GLuint *ptr)
Definition PrimitiveSetIndirect:361
osg::DrawElementsIndirectUInt::className
virtual const char * className() const
Definition PrimitiveSetIndirect:382
osg::DrawElementsIndirectUInt::libraryName
virtual const char * libraryName() const
Definition PrimitiveSetIndirect:381
osg::DrawElementsIndirectUInt::cloneType
virtual Object * cloneType() const
Definition PrimitiveSetIndirect:378
osg::DrawElementsIndirectUInt::accept
virtual void accept(PrimitiveFunctor &functor) const
osg::DrawElementsIndirectUInt::draw
virtual void draw(State &state, bool useVertexBufferObjects) const
osg::DrawElementsIndirectUInt::setElement
virtual void setElement(unsigned int i, unsigned int v)
Definition PrimitiveSetIndirect:400
osg::DrawElementsIndirectUInt::index
virtual unsigned int index(unsigned int pos) const
Definition PrimitiveSetIndirect:394
osg::DrawElementsIndirectUInt::getDataType
virtual GLenum getDataType()
Definition PrimitiveSetIndirect:397
osg::DrawElementsIndirectUInt::supportsBufferObject
virtual bool supportsBufferObject() const
Definition PrimitiveSetIndirect:386
osg::DrawElementsIndirectUInt::addElement
virtual void addElement(unsigned int v)
Definition PrimitiveSetIndirect:402
osg::DrawElementsIndirectUInt::isSameKindAs
virtual bool isSameKindAs(const Object *obj) const
Definition PrimitiveSetIndirect:380
osg::DrawElementsIndirectUInt::getNumPrimitives
virtual unsigned int getNumPrimitives() const
osg::DrawElementsIndirectUInt::vector_type
VectorGLuint vector_type
Definition PrimitiveSetIndirect:347
osg::DrawElementsIndirectUInt::DrawElementsIndirectUInt
DrawElementsIndirectUInt(GLenum mode=0)
Definition PrimitiveSetIndirect:349
osg::DrawElementsIndirectUInt::getNumIndices
virtual unsigned int getNumIndices() const
Definition PrimitiveSetIndirect:393
osg::DrawElementsIndirectUInt::getTotalDataSize
virtual unsigned int getTotalDataSize() const
Definition PrimitiveSetIndirect:385
osg::DrawElementsIndirectUInt::accept
virtual void accept(PrimitiveIndexFunctor &functor) const
osg::DrawElementsIndirectUInt::resizeElements
virtual void resizeElements(unsigned int numIndices)
Definition PrimitiveSetIndirect:398
osg::DrawElementsIndirectUInt::DrawElementsIndirectUInt
DrawElementsIndirectUInt(GLenum mode, unsigned int no)
Definition PrimitiveSetIndirect:369
osg::DrawElementsIndirectUInt::getDataPointer
virtual const GLvoid * getDataPointer() const
Definition PrimitiveSetIndirect:384
osg::DrawElementsIndirectUInt::getElement
virtual unsigned int getElement(unsigned int i)
Definition PrimitiveSetIndirect:401
osg::DrawElementsIndirectUInt::DrawElementsIndirectUInt
DrawElementsIndirectUInt(GLenum mode, InputIterator first, InputIterator last)
Definition PrimitiveSetIndirect:374
osg::DrawElementsIndirectUInt::~DrawElementsIndirectUInt
virtual ~DrawElementsIndirectUInt()
osg::DrawElementsIndirectUInt::reserveElements
virtual void reserveElements(unsigned int numIndices)
Definition PrimitiveSetIndirect:399
osg::DrawElementsIndirectUInt::clone
virtual Object * clone(const CopyOp &copyop) const
Definition PrimitiveSetIndirect:379
osg::DrawElementsIndirectUInt::offsetIndices
virtual void offsetIndices(int offset)
osg::DrawElementsIndirectUShort::DrawElementsIndirectUShort
DrawElementsIndirectUShort(GLenum mode, unsigned int no, const GLushort *ptr)
Definition PrimitiveSetIndirect:289
osg::DrawElementsIndirectUShort::getNumPrimitives
virtual unsigned int getNumPrimitives() const
osg::DrawElementsIndirectUShort::reserveElements
virtual void reserveElements(unsigned int numIndices)
Definition PrimitiveSetIndirect:327
osg::DrawElementsIndirectUShort::className
virtual const char * className() const
Definition PrimitiveSetIndirect:310
osg::DrawElementsIndirectUShort::getNumIndices
virtual unsigned int getNumIndices() const
Definition PrimitiveSetIndirect:321
osg::DrawElementsIndirectUShort::getDataPointer
virtual const GLvoid * getDataPointer() const
Definition PrimitiveSetIndirect:312
osg::DrawElementsIndirectUShort::~DrawElementsIndirectUShort
virtual ~DrawElementsIndirectUShort()
osg::DrawElementsIndirectUShort::supportsBufferObject
virtual bool supportsBufferObject() const
Definition PrimitiveSetIndirect:314
osg::DrawElementsIndirectUShort::addElement
virtual void addElement(unsigned int v)
Definition PrimitiveSetIndirect:332
osg::DrawElementsIndirectUShort::resizeElements
virtual void resizeElements(unsigned int numIndices)
Definition PrimitiveSetIndirect:326
osg::DrawElementsIndirectUShort::DrawElementsIndirectUShort
DrawElementsIndirectUShort(const DrawElementsIndirectUShort &array, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSetIndirect:280
osg::DrawElementsIndirectUShort::cloneType
virtual Object * cloneType() const
Definition PrimitiveSetIndirect:306
osg::DrawElementsIndirectUShort::DrawElementsIndirectUShort
DrawElementsIndirectUShort(GLenum mode=0)
Definition PrimitiveSetIndirect:277
osg::DrawElementsIndirectUShort::index
virtual unsigned int index(unsigned int pos) const
Definition PrimitiveSetIndirect:322
osg::DrawElementsIndirectUShort::DrawElementsIndirectUShort
DrawElementsIndirectUShort(GLenum mode, unsigned int no)
Definition PrimitiveSetIndirect:297
osg::DrawElementsIndirectUShort::clone
virtual Object * clone(const CopyOp &copyop) const
Definition PrimitiveSetIndirect:307
osg::DrawElementsIndirectUShort::DrawElementsIndirectUShort
DrawElementsIndirectUShort(GLenum mode, InputIterator first, InputIterator last)
Definition PrimitiveSetIndirect:302
osg::DrawElementsIndirectUShort::getElement
virtual unsigned int getElement(unsigned int i)
Definition PrimitiveSetIndirect:330
osg::DrawElementsIndirectUShort::accept
virtual void accept(PrimitiveFunctor &functor) const
osg::DrawElementsIndirectUShort::setElement
virtual void setElement(unsigned int i, unsigned int v)
Definition PrimitiveSetIndirect:329
osg::DrawElementsIndirectUShort::getDataType
virtual GLenum getDataType()
Definition PrimitiveSetIndirect:325
osg::DrawElementsIndirectUShort::vector_type
VectorGLushort vector_type
Definition PrimitiveSetIndirect:275
osg::DrawElementsIndirectUShort::draw
virtual void draw(State &state, bool useVertexBufferObjects) const
osg::DrawElementsIndirectUShort::offsetIndices
virtual void offsetIndices(int offset)
osg::DrawElementsIndirectUShort::isSameKindAs
virtual bool isSameKindAs(const Object *obj) const
Definition PrimitiveSetIndirect:308
osg::DrawElementsIndirectUShort::getTotalDataSize
virtual unsigned int getTotalDataSize() const
Definition PrimitiveSetIndirect:313
osg::DrawElementsIndirectUShort::libraryName
virtual const char * libraryName() const
Definition PrimitiveSetIndirect:309
osg::DrawElementsIndirectUShort::accept
virtual void accept(PrimitiveIndexFunctor &functor) const
osg::DrawElementsIndirect::getFirstCommandToDraw
unsigned int getFirstCommandToDraw() const
get offset of the first command in the IndirectCommandDrawArrays
Definition PrimitiveSetIndirect:181
osg::DrawElementsIndirect::DrawElementsIndirect
DrawElementsIndirect(Type primType=PrimitiveType, GLenum mode=0, unsigned int firstCommand=0, GLsizei stride=0)
Definition PrimitiveSetIndirect:155
osg::DrawElementsIndirect::~DrawElementsIndirect
virtual ~DrawElementsIndirect()
Definition PrimitiveSetIndirect:192
osg::DrawElementsIndirect::_stride
GLsizei _stride
Definition PrimitiveSetIndirect:195
osg::DrawElementsIndirect::setFirstCommandToDraw
void setFirstCommandToDraw(unsigned int i)
set offset of the first command to draw in the IndirectCommandDrawArrays
Definition PrimitiveSetIndirect:178
osg::DrawElementsIndirect::getIndirectCommandArray
const IndirectCommandDrawElements * getIndirectCommandArray() const
Definition PrimitiveSetIndirect:172
osg::DrawElementsIndirect::getIndirectCommandArray
IndirectCommandDrawElements * getIndirectCommandArray()
get command array of this indirect primitive set
Definition PrimitiveSetIndirect:171
osg::DrawElementsIndirect::setIndirectCommandArray
void setIndirectCommandArray(IndirectCommandDrawElements *idc)
set command array of this indirect primitive set
Definition PrimitiveSetIndirect:162
osg::DrawElementsIndirect::getStride
GLsizei getStride() const
stride (to set if you use custom CommandArray)
Definition PrimitiveSetIndirect:187
osg::DrawElementsIndirect::_indirectCommandArray
ref_ptr< IndirectCommandDrawElements > _indirectCommandArray
Definition PrimitiveSetIndirect:196
osg::DrawElementsIndirect::DrawElementsIndirect
DrawElementsIndirect(const DrawElementsIndirect &rhs, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSetIndirect:158
osg::DrawElementsIndirect::getNumPrimitives
virtual unsigned int getNumPrimitives() const =0
osg::DrawElementsIndirect::_firstCommand
unsigned int _firstCommand
Definition PrimitiveSetIndirect:194
osg::DrawElementsIndirect::setStride
void setStride(GLsizei i)
stride (to set if you use custom CommandArray)
Definition PrimitiveSetIndirect:184
osg::DrawElements::DrawElements
DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0)
Definition PrimitiveSet:340
osg::DrawIndirectBufferObject
Definition BufferObject:645
osg::IndirectCommandDrawArrays
common interface for IndirectCommandDrawArrayss
Definition PrimitiveSetIndirect:27
osg::IndirectCommandDrawArrays::first
virtual unsigned int & first(const unsigned int &index)=0
osg::IndirectCommandDrawArrays::getNumElements
virtual unsigned int getNumElements() const =0
osg::IndirectCommandDrawArrays::instanceCount
virtual unsigned int & instanceCount(const unsigned int &index)=0
osg::IndirectCommandDrawArrays::baseInstance
virtual unsigned int & baseInstance(const unsigned int &index)=0
osg::IndirectCommandDrawArrays::getTotalDataSize
virtual unsigned int getTotalDataSize() const
Definition PrimitiveSetIndirect:34
osg::IndirectCommandDrawArrays::IndirectCommandDrawArrays
IndirectCommandDrawArrays()
Definition PrimitiveSetIndirect:29
osg::IndirectCommandDrawArrays::count
virtual unsigned int & count(const unsigned int &index)=0
osg::IndirectCommandDrawArrays::getElementSize
virtual unsigned int getElementSize() const =0
osg::IndirectCommandDrawArrays::reserveElements
virtual void reserveElements(const unsigned int)=0
osg::IndirectCommandDrawArrays::IndirectCommandDrawArrays
IndirectCommandDrawArrays(const IndirectCommandDrawArrays &copy, const CopyOp &copyop)
Definition PrimitiveSetIndirect:31
osg::IndirectCommandDrawArrays::resizeElements
virtual void resizeElements(const unsigned int)=0
osg::IndirectCommandDrawElements
Definition PrimitiveSetIndirect:48
osg::IndirectCommandDrawElements::reserveElements
virtual void reserveElements(const unsigned int)=0
osg::IndirectCommandDrawElements::IndirectCommandDrawElements
IndirectCommandDrawElements(const IndirectCommandDrawElements &copy, const CopyOp &copyop)
Definition PrimitiveSetIndirect:52
osg::IndirectCommandDrawElements::instanceCount
virtual unsigned int & instanceCount(const unsigned int &index)=0
osg::IndirectCommandDrawElements::IndirectCommandDrawElements
IndirectCommandDrawElements()
Definition PrimitiveSetIndirect:50
osg::IndirectCommandDrawElements::getElementSize
virtual unsigned int getElementSize() const =0
osg::IndirectCommandDrawElements::count
virtual unsigned int & count(const unsigned int &index)=0
osg::IndirectCommandDrawElements::getNumElements
virtual unsigned int getNumElements() const =0
osg::IndirectCommandDrawElements::getTotalDataSize
virtual unsigned int getTotalDataSize() const
Definition PrimitiveSetIndirect:55
osg::IndirectCommandDrawElements::resizeElements
virtual void resizeElements(const unsigned int)=0
osg::IndirectCommandDrawElements::firstIndex
virtual unsigned int & firstIndex(const unsigned int &index)=0
osg::IndirectCommandDrawElements::baseInstance
virtual unsigned int & baseInstance(const unsigned int &index)=0
osg::IndirectCommandDrawElements::baseVertex
virtual unsigned int & baseVertex(const unsigned int &index)=0
osg::MixinVector< DrawArraysIndirectCommand >::size
size_type size() const
Definition MixinVector:92
osg::MixinVector< DrawArraysIndirectCommand >::resize
void resize(size_type new_size, const value_type &fill_value=value_type())
Definition MixinVector:85
osg::MixinVector< DrawArraysIndirectCommand >::front
const_reference front() const
Definition MixinVector:138
osg::MixinVector< DrawArraysIndirectCommand >::reserve
void reserve(size_type new_capacity)
Definition MixinVector:86
osg::MixinVector< DrawArraysIndirectCommand >::at
const_reference at(size_type index) const
Definition MixinVector:110
osg::MixinVector< GLubyte >::push_back
void push_back(const value_type &value)
Definition MixinVector:117
osg::MixinVector< DrawArraysIndirectCommand >::MixinVector
MixinVector()
Definition MixinVector:45
osg::MixinVector< DrawArraysIndirectCommand >::empty
bool empty() const
Definition MixinVector:91
osg::MultiDrawArraysIndirect::_count
unsigned int _count
Definition PrimitiveSetIndirect:728
osg::MultiDrawArraysIndirect::cloneType
virtual osg::Object * cloneType() const
Definition PrimitiveSetIndirect:706
osg::MultiDrawArraysIndirect::clone
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition PrimitiveSetIndirect:707
osg::MultiDrawArraysIndirect::accept
virtual void accept(PrimitiveIndexFunctor &functor) const
osg::MultiDrawArraysIndirect::MultiDrawArraysIndirect
MultiDrawArraysIndirect(GLenum mode=0, unsigned int firstcommand=0, unsigned int count=0, GLsizei stride=0)
Definition PrimitiveSetIndirect:694
osg::MultiDrawArraysIndirect::MultiDrawArraysIndirect
MultiDrawArraysIndirect(const MultiDrawArraysIndirect &dal, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSetIndirect:701
osg::MultiDrawArraysIndirect::getNumIndices
virtual unsigned int getNumIndices() const
osg::MultiDrawArraysIndirect::getNumPrimitives
virtual unsigned int getNumPrimitives() const
osg::MultiDrawArraysIndirect::index
virtual unsigned int index(unsigned int pos) const
osg::MultiDrawArraysIndirect::accept
virtual void accept(PrimitiveFunctor &functor) const
osg::MultiDrawArraysIndirect::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition PrimitiveSetIndirect:708
osg::MultiDrawArraysIndirect::draw
virtual void draw(State &state, bool useVertexBufferObjects) const
osg::MultiDrawArraysIndirect::offsetIndices
virtual void offsetIndices(int offset)
osg::MultiDrawArraysIndirect::getNumCommandsToDraw
unsigned int getNumCommandsToDraw() const
count of Indirect Command to execute
Definition PrimitiveSetIndirect:725
osg::MultiDrawArraysIndirect::className
virtual const char * className() const
Definition PrimitiveSetIndirect:709
osg::MultiDrawArraysIndirect::setNumCommandsToDraw
void setNumCommandsToDraw(unsigned int i)
count of Indirect Command to execute
Definition PrimitiveSetIndirect:723
osg::MultiDrawElementsIndirectUByte::className
virtual const char * className() const
Definition PrimitiveSetIndirect:534
osg::MultiDrawElementsIndirectUByte::_count
unsigned int _count
Definition PrimitiveSetIndirect:547
osg::MultiDrawElementsIndirectUByte::cloneType
virtual osg::Object * cloneType() const
Definition PrimitiveSetIndirect:531
osg::MultiDrawElementsIndirectUByte::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition PrimitiveSetIndirect:533
osg::MultiDrawElementsIndirectUByte::MultiDrawElementsIndirectUByte
MultiDrawElementsIndirectUByte(GLenum mode=0)
Definition PrimitiveSetIndirect:486
osg::MultiDrawElementsIndirectUByte::MultiDrawElementsIndirectUByte
MultiDrawElementsIndirectUByte(GLenum mode, InputIterator first, InputIterator last)
Definition PrimitiveSetIndirect:524
osg::MultiDrawElementsIndirectUByte::getNumCommandsToDraw
unsigned int getNumCommandsToDraw() const
count of Indirect Command to execute
Definition PrimitiveSetIndirect:544
osg::MultiDrawElementsIndirectUByte::accept
virtual void accept(PrimitiveFunctor &functor) const
osg::MultiDrawElementsIndirectUByte::getNumPrimitives
virtual unsigned int getNumPrimitives() const
osg::MultiDrawElementsIndirectUByte::draw
virtual void draw(State &state, bool useVertexBufferObjects) const
osg::MultiDrawElementsIndirectUByte::setNumCommandsToDraw
void setNumCommandsToDraw(unsigned int i)
count of Indirect Command to execute
Definition PrimitiveSetIndirect:542
osg::MultiDrawElementsIndirectUByte::clone
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition PrimitiveSetIndirect:532
osg::MultiDrawElementsIndirectUByte::MultiDrawElementsIndirectUByte
MultiDrawElementsIndirectUByte(GLenum mode, unsigned int no, const GLubyte *ptr)
Definition PrimitiveSetIndirect:505
osg::MultiDrawElementsIndirectUByte::accept
virtual void accept(PrimitiveIndexFunctor &functor) const
osg::MultiDrawElementsIndirectUByte::~MultiDrawElementsIndirectUByte
virtual ~MultiDrawElementsIndirectUByte()
osg::MultiDrawElementsIndirectUByte::MultiDrawElementsIndirectUByte
MultiDrawElementsIndirectUByte(GLenum mode, unsigned int no)
Definition PrimitiveSetIndirect:516
osg::MultiDrawElementsIndirectUByte::MultiDrawElementsIndirectUByte
MultiDrawElementsIndirectUByte(const MultiDrawElementsIndirectUByte &mdi, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSetIndirect:494
osg::MultiDrawElementsIndirectUInt::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition PrimitiveSetIndirect:599
osg::MultiDrawElementsIndirectUInt::~MultiDrawElementsIndirectUInt
virtual ~MultiDrawElementsIndirectUInt()
osg::MultiDrawElementsIndirectUInt::getNumPrimitives
virtual unsigned int getNumPrimitives() const
osg::MultiDrawElementsIndirectUInt::MultiDrawElementsIndirectUInt
MultiDrawElementsIndirectUInt(GLenum mode=0)
Definition PrimitiveSetIndirect:554
osg::MultiDrawElementsIndirectUInt::className
virtual const char * className() const
Definition PrimitiveSetIndirect:600
osg::MultiDrawElementsIndirectUInt::MultiDrawElementsIndirectUInt
MultiDrawElementsIndirectUInt(GLenum mode, unsigned int no, const GLuint *ptr)
Definition PrimitiveSetIndirect:571
osg::MultiDrawElementsIndirectUInt::MultiDrawElementsIndirectUInt
MultiDrawElementsIndirectUInt(GLenum mode, unsigned int no)
Definition PrimitiveSetIndirect:582
osg::MultiDrawElementsIndirectUInt::clone
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition PrimitiveSetIndirect:598
osg::MultiDrawElementsIndirectUInt::MultiDrawElementsIndirectUInt
MultiDrawElementsIndirectUInt(GLenum mode, InputIterator first, InputIterator last)
Definition PrimitiveSetIndirect:590
osg::MultiDrawElementsIndirectUInt::setNumCommandsToDraw
void setNumCommandsToDraw(unsigned int i)
count of Indirect Command to execute
Definition PrimitiveSetIndirect:608
osg::MultiDrawElementsIndirectUInt::accept
virtual void accept(PrimitiveFunctor &functor) const
osg::MultiDrawElementsIndirectUInt::MultiDrawElementsIndirectUInt
MultiDrawElementsIndirectUInt(const MultiDrawElementsIndirectUInt &mdi, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSetIndirect:561
osg::MultiDrawElementsIndirectUInt::cloneType
virtual osg::Object * cloneType() const
Definition PrimitiveSetIndirect:597
osg::MultiDrawElementsIndirectUInt::_count
unsigned int _count
Definition PrimitiveSetIndirect:613
osg::MultiDrawElementsIndirectUInt::draw
virtual void draw(State &state, bool useVertexBufferObjects) const
osg::MultiDrawElementsIndirectUInt::accept
virtual void accept(PrimitiveIndexFunctor &functor) const
osg::MultiDrawElementsIndirectUInt::getNumCommandsToDraw
unsigned int getNumCommandsToDraw() const
count of Indirect Command to execute
Definition PrimitiveSetIndirect:610
osg::MultiDrawElementsIndirectUShort::getNumCommandsToDraw
unsigned int getNumCommandsToDraw() const
count of Indirect Command to execute
Definition PrimitiveSetIndirect:476
osg::MultiDrawElementsIndirectUShort::MultiDrawElementsIndirectUShort
MultiDrawElementsIndirectUShort(GLenum mode, InputIterator first, InputIterator last)
Definition PrimitiveSetIndirect:454
osg::MultiDrawElementsIndirectUShort::_count
unsigned int _count
Definition PrimitiveSetIndirect:479
osg::MultiDrawElementsIndirectUShort::draw
virtual void draw(State &state, bool useVertexBufferObjects) const
osg::MultiDrawElementsIndirectUShort::clone
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition PrimitiveSetIndirect:462
osg::MultiDrawElementsIndirectUShort::MultiDrawElementsIndirectUShort
MultiDrawElementsIndirectUShort(GLenum mode, unsigned int no)
Definition PrimitiveSetIndirect:446
osg::MultiDrawElementsIndirectUShort::setNumCommandsToDraw
void setNumCommandsToDraw(unsigned int i)
if you want to draw a subset of the IndirectCommandElement(FirstCommandToDraw,NumCommandsToDraw)
Definition PrimitiveSetIndirect:474
osg::MultiDrawElementsIndirectUShort::accept
virtual void accept(PrimitiveFunctor &functor) const
osg::MultiDrawElementsIndirectUShort::accept
virtual void accept(PrimitiveIndexFunctor &functor) const
osg::MultiDrawElementsIndirectUShort::className
virtual const char * className() const
Definition PrimitiveSetIndirect:464
osg::MultiDrawElementsIndirectUShort::MultiDrawElementsIndirectUShort
MultiDrawElementsIndirectUShort(GLenum mode=0)
Definition PrimitiveSetIndirect:417
osg::MultiDrawElementsIndirectUShort::MultiDrawElementsIndirectUShort
MultiDrawElementsIndirectUShort(const MultiDrawElementsIndirectUShort &mdi, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PrimitiveSetIndirect:424
osg::MultiDrawElementsIndirectUShort::isSameKindAs
virtual bool isSameKindAs(const osg::Object *obj) const
Definition PrimitiveSetIndirect:463
osg::MultiDrawElementsIndirectUShort::cloneType
virtual osg::Object * cloneType() const
Definition PrimitiveSetIndirect:461
osg::MultiDrawElementsIndirectUShort::MultiDrawElementsIndirectUShort
MultiDrawElementsIndirectUShort(GLenum mode, unsigned int no, const GLushort *ptr)
Definition PrimitiveSetIndirect:435
osg::MultiDrawElementsIndirectUShort::getNumPrimitives
virtual unsigned int getNumPrimitives() const
osg::MultiDrawElementsIndirectUShort::~MultiDrawElementsIndirectUShort
virtual ~MultiDrawElementsIndirectUShort()
osg::Object
Definition Object:61
osg::PrimitiveFunctor
Definition PrimitiveSet:54
osg::PrimitiveIndexFunctor
Definition PrimitiveSet:103
osg::PrimitiveSet
Definition PrimitiveSet:125
osg::PrimitiveSet::_primitiveType
Type _primitiveType
Definition PrimitiveSet:216
osg::PrimitiveSet::Type
Type
Definition PrimitiveSet:129
osg::PrimitiveSet::DrawElementsUByteIndirectPrimitiveType
@ DrawElementsUByteIndirectPrimitiveType
Definition PrimitiveSet:138
osg::PrimitiveSet::MultiDrawElementsUByteIndirectPrimitiveType
@ MultiDrawElementsUByteIndirectPrimitiveType
Definition PrimitiveSet:142
osg::PrimitiveSet::PrimitiveType
@ PrimitiveType
Definition PrimitiveSet:130
osg::PrimitiveSet::DrawArraysIndirectPrimitiveType
@ DrawArraysIndirectPrimitiveType
Definition PrimitiveSet:137
osg::PrimitiveSet::MultiDrawElementsUIntIndirectPrimitiveType
@ MultiDrawElementsUIntIndirectPrimitiveType
Definition PrimitiveSet:144
osg::PrimitiveSet::DrawElementsUIntIndirectPrimitiveType
@ DrawElementsUIntIndirectPrimitiveType
Definition PrimitiveSet:140
osg::PrimitiveSet::DrawElementsUShortIndirectPrimitiveType
@ DrawElementsUShortIndirectPrimitiveType
Definition PrimitiveSet:139
osg::PrimitiveSet::MultiDrawElementsUShortIndirectPrimitiveType
@ MultiDrawElementsUShortIndirectPrimitiveType
Definition PrimitiveSet:143
osg::PrimitiveSet::MultiDrawArraysIndirectPrimitiveType
@ MultiDrawArraysIndirectPrimitiveType
Definition PrimitiveSet:141
osg::PrimitiveSet::PrimitiveSet
PrimitiveSet(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0)
Definition PrimitiveSet:166
osg::State
Definition State:80
osg::ref_ptr
Definition ref_ptr:32
osg
Definition AlphaFunc:19
osg::get
T * get(unsigned int contextID)
Definition ContextData:152
osg::VectorGLuint
MixinVector< GLuint > VectorGLuint
Definition PrimitiveSet:39
osg::VectorGLushort
MixinVector< GLushort > VectorGLushort
Definition PrimitiveSet:38
osg::VectorGLubyte
MixinVector< GLubyte > VectorGLubyte
Definition PrimitiveSet:37
NULL
#define NULL
Definition osg/Export:55
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39
osg::DrawArraysIndirectCommand
DrawArraysCommand.
Definition PrimitiveSetIndirect:73
osg::DrawArraysIndirectCommand::first
unsigned int first
Definition PrimitiveSetIndirect:79
osg::DrawArraysIndirectCommand::DrawArraysIndirectCommand
DrawArraysIndirectCommand(unsigned int pcount=0, unsigned int pinstanceCount=0, unsigned int pfirst=0, unsigned int pbaseInstance=0)
Definition PrimitiveSetIndirect:74
osg::DrawArraysIndirectCommand::count
unsigned int count
Definition PrimitiveSetIndirect:77
osg::DrawArraysIndirectCommand::baseInstance
unsigned int baseInstance
Definition PrimitiveSetIndirect:80
osg::DrawArraysIndirectCommand::instanceCount
unsigned int instanceCount
Definition PrimitiveSetIndirect:78
osg::DrawElementsIndirectCommand
Definition PrimitiveSetIndirect:111
osg::DrawElementsIndirectCommand::baseInstance
unsigned int baseInstance
Definition PrimitiveSetIndirect:119
osg::DrawElementsIndirectCommand::instanceCount
unsigned int instanceCount
Definition PrimitiveSetIndirect:116
osg::DrawElementsIndirectCommand::firstIndex
unsigned int firstIndex
Definition PrimitiveSetIndirect:117
osg::DrawElementsIndirectCommand::DrawElementsIndirectCommand
DrawElementsIndirectCommand(unsigned int pcount=0, unsigned int pinstanceCount=0, unsigned int pfirstIndex=0, unsigned int pbaseVertex=0, unsigned int pbaseInstance=0)
Definition PrimitiveSetIndirect:112
osg::DrawElementsIndirectCommand::baseVertex
unsigned int baseVertex
Definition PrimitiveSetIndirect:118
osg::DrawElementsIndirectCommand::count
unsigned int count
Definition PrimitiveSetIndirect:115