Improved the readability and consistency with the rest of the OSG by inserting/removing spaces and line spacing.

This commit is contained in:
Robert Osfield 2017-07-28 13:30:36 +01:00
parent af25f14d73
commit 5a946e218f

View File

@ -21,13 +21,15 @@
namespace osg {
///common interface for IndirectCommandDrawArrayss
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){ }
IndirectCommandDrawArrays(const IndirectCommandDrawArrays& copy,const CopyOp& copyop/*=CopyOp::SHALLOW_COPY*/) :
BufferData(copy, copyop) {}
virtual unsigned int & count(const unsigned int&index)=0;
virtual unsigned int & instanceCount(const unsigned int&index)=0;
@ -37,10 +39,12 @@ public:
virtual unsigned int getElementSize() const = 0;
virtual unsigned int getNumElements() const = 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) {}
@ -52,15 +56,16 @@ public:
virtual unsigned int getElementSize()const = 0;
virtual unsigned int getNumElements() const = 0;
};
/// DrawArraysCommand
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){};
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;
@ -75,15 +80,11 @@ public:
META_Object(osg,DefaultIndirectCommandDrawArrays)
DefaultIndirectCommandDrawArrays() : IndirectCommandDrawArrays(), MixinVector<DrawArraysIndirectCommand>() {}
DefaultIndirectCommandDrawArrays(const DefaultIndirectCommandDrawArrays& copy,const CopyOp& copyop/*=CopyOp::SHALLOW_COPY*/)
:IndirectCommandDrawArrays(copy, copyop),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 getTotalDataSize() const {
return 16u*static_cast<unsigned int>(size());
}
virtual const GLvoid* getDataPointer() const { return empty()?0:&front(); }
virtual unsigned int getTotalDataSize() const { return 16u*static_cast<unsigned int>(size()); }
virtual unsigned int getElementSize()const { return 16u; };
virtual unsigned int & count(const unsigned int&index) { return at(index).count; }
virtual unsigned int & instanceCount(const unsigned int&index) { return at(index).instanceCount; }
@ -95,9 +96,11 @@ public:
/// default implementation of IndirectCommandDrawElements
/// DrawElementsCommand
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){};
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;
@ -110,15 +113,14 @@ class OSG_EXPORT DefaultIndirectCommandDrawElements: public IndirectCommandDrawE
{
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 getTotalDataSize() const {
return 20u*static_cast<unsigned int>(size());
}
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 getTotalDataSize() const { return 20u*static_cast<unsigned int>(size()); }
virtual unsigned int getElementSize()const { return 20u; };
virtual unsigned int & count(const unsigned int&index) { return at(index).count; }
@ -140,17 +142,17 @@ public:
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());
}
DrawElements(rhs,copyop),_firstCommand(rhs._firstCommand), _stride(rhs._stride) { _indirectCommandArray=(DefaultIndirectCommandDrawElements*)copyop(rhs._indirectCommandArray.get()); }
/// set command array of this indirect primitive set
inline void setIndirectCommandArray(IndirectCommandDrawElements*idc) {
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());
}
/// get command array of this indirect primitive set
inline IndirectCommandDrawElements* getIndirectCommandArray() { return _indirectCommandArray; }
inline const IndirectCommandDrawElements* getIndirectCommandArray() const { return _indirectCommandArray; }
@ -160,17 +162,16 @@ public:
/// set offset of the first command to draw in the IndirectCommandDrawArrays
inline void setFirstCommandToDraw( unsigned int i) { _firstCommand = i; }
/// get offset of the first command in the IndirectCommandDrawArrays
inline unsigned int getFirstCommandToDraw() const { return _firstCommand; }
/// stride (to set if you use custom CommandArray)
inline void setStride( GLsizei i) {
_stride=i;
}
inline void setStride( GLsizei i) { _stride=i; }
/// stride (to set if you use custom CommandArray)
inline GLsizei getStride() const {
return _stride;
}
inline GLsizei getStride() const { return _stride; }
virtual unsigned int getNumPrimitives() const=0;
protected:
@ -179,8 +180,8 @@ protected:
unsigned int _firstCommand;
GLsizei _stride;
ref_ptr<IndirectCommandDrawElements> _indirectCommandArray;
};
///////////////////////////////////////////////////////////////////////////////////////
/// \brief The DrawElementsIndirectUByte PrimitiveSet
///
@ -214,64 +215,36 @@ public:
DrawElementsIndirect(MultiDrawElementsUByteIndirectPrimitiveType,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 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 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 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 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();
@ -316,64 +289,35 @@ public:
DrawElementsIndirect(MultiDrawElementsUShortIndirectPrimitiveType,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 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 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 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 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();
@ -417,69 +361,39 @@ public:
DrawElementsIndirect(MultiDrawElementsUIntIndirectPrimitiveType,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 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 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 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 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();
};
///////////////////////////////////////////////////////////////////////////////////////
/// \brief The MultiDrawElementsIndirect PrimitiveSets
///
@ -488,20 +402,15 @@ class OSG_EXPORT MultiDrawElementsIndirectUShort : public DrawElementsIndirectUS
public:
MultiDrawElementsIndirectUShort(GLenum mode = 0,unsigned int firstCommand = 0,unsigned int commandcount = 0, GLsizei stride = 0) :
DrawElementsIndirectUShort(mode,firstCommand,stride),_count(commandcount) { _primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType)); }
MultiDrawElementsIndirectUShort(const MultiDrawElementsIndirectUShort& mdi,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
DrawElementsIndirectUShort(mdi,copyop),_count(mdi._count) {}
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 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;
@ -510,13 +419,10 @@ public:
///if you want to draw a subset of the IndirectCommandElement(FirstCommandToDraw,NumCommandsToDraw)
/// count of Indirect Command to execute
inline void setNumCommandsToDraw( unsigned int i) {
_count=i;
}
inline void setNumCommandsToDraw( unsigned int i) { _count=i; }
/// count of Indirect Command to execute
inline unsigned int getNumCommandsToDraw()const {
return _count;
}
inline unsigned int getNumCommandsToDraw()const { return _count; }
protected:
unsigned int _count;
virtual ~MultiDrawElementsIndirectUShort();
@ -527,71 +433,59 @@ class OSG_EXPORT MultiDrawElementsIndirectUByte : public DrawElementsIndirectUBy
public:
MultiDrawElementsIndirectUByte(GLenum mode = 0,unsigned int firstCommand = 0,unsigned int commandcount = 0, GLsizei stride = 0) :
DrawElementsIndirectUByte(mode,firstCommand,stride),_count(commandcount) { _primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType)); }
MultiDrawElementsIndirectUByte(const MultiDrawElementsIndirectUByte& mdi,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
DrawElementsIndirectUByte(mdi,copyop),_count(mdi._count) {}
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 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;
/// count of Indirect Command to execute
inline void setNumCommandsToDraw( unsigned int i) {
_count=i;
}
inline void setNumCommandsToDraw( unsigned int i) { _count=i; }
/// count of Indirect Command to execute
inline unsigned int getNumCommandsToDraw()const {
return _count;
}
inline unsigned int getNumCommandsToDraw()const { return _count; }
protected:
unsigned int _count;
virtual ~MultiDrawElementsIndirectUByte();
};
class OSG_EXPORT MultiDrawElementsIndirectUInt : public DrawElementsIndirectUInt
{
public:
MultiDrawElementsIndirectUInt(GLenum mode = 0,unsigned int firstCommand = 0,unsigned int commandcount = 0, GLsizei stride = 0) :
DrawElementsIndirectUInt(mode,firstCommand,stride),_count(commandcount) { _primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType)); }
MultiDrawElementsIndirectUInt(const MultiDrawElementsIndirectUInt& mdi,const CopyOp& copyop=CopyOp::SHALLOW_COPY) :
DrawElementsIndirectUInt(mdi,copyop),_count(mdi._count) {}
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 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;
/// count of Indirect Command to execute
inline void setNumCommandsToDraw( unsigned int i) {
_count=i;
}
inline void setNumCommandsToDraw( unsigned int i) { _count=i; }
/// count of Indirect Command to execute
inline unsigned int getNumCommandsToDraw()const {
return _count;
}
inline unsigned int getNumCommandsToDraw()const { return _count; }
protected:
unsigned int _count;
virtual ~MultiDrawElementsIndirectUInt();
};
///////////////////////////////////////////////////////////////////////////////////////
/// \brief The MultiDrawArraysIndirect PrimitiveSet
///
@ -607,24 +501,13 @@ public:
osg::PrimitiveSet(dal,copyop),
_firstCommand(dal._firstCommand),
_stride(dal._stride),
_indirectCommandArray((DefaultIndirectCommandDrawArrays*)copyop( dal._indirectCommandArray.get()))
{}
_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 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;
@ -638,34 +521,26 @@ public:
virtual unsigned int getNumPrimitives() const;
/// stride (to set if you use custom CommandArray)
inline void setStride( GLsizei i) {
_stride=i;
}
/// stride (to set if you use custom CommandArray)
inline GLsizei getStride()const {
return _stride;
}
/// set offset of the first command in the IndirectCommandDrawArrays
inline void setFirstCommandToDraw( unsigned int i) {
_firstCommand=i;
}
/// get offset of the first command in the IndirectCommandDrawArrays
inline unsigned int getFirstCommandToDraw() const {
return _firstCommand;
}
inline void setStride( GLsizei i) { _stride=i; }
inline void setIndirectCommandArray(IndirectCommandDrawArrays*idc) {
/// stride (to set if you use custom CommandArray)
inline GLsizei getStride()const { return _stride; }
/// set offset of the first command in the IndirectCommandDrawArrays
inline void setFirstCommandToDraw( unsigned int i) { _firstCommand=i; }
/// get offset of the first command in the IndirectCommandDrawArrays
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;
}
inline IndirectCommandDrawArrays* getIndirectCommandArray(){
return _indirectCommandArray;
}
inline const IndirectCommandDrawArrays* getIndirectCommandArray() const { return _indirectCommandArray; }
inline IndirectCommandDrawArrays* getIndirectCommandArray() { return _indirectCommandArray; }
protected:
@ -683,26 +558,15 @@ 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);}
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)
{}
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 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;
@ -716,13 +580,10 @@ public:
virtual unsigned int getNumPrimitives() const;
/// count of Indirect Command to execute
inline void setNumCommandsToDraw( unsigned int i) {
_count=i;
}
inline void setNumCommandsToDraw( unsigned int i) { _count=i; }
/// count of Indirect Command to execute
inline unsigned int getNumCommandsToDraw()const {
return _count;
}
inline unsigned int getNumCommandsToDraw()const { return _count; }
protected:
unsigned int _count;
@ -731,4 +592,3 @@ protected:
}
#endif