From c242ad4497fe334e20f4b13a344677a63adabee2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 31 Oct 2017 17:55:59 +0000 Subject: [PATCH] Fixed unititialized memory variables and improved readability by adding spacing where appropriate --- include/osg/PrimitiveSetIndirect | 119 +++++++++++++++++++++++-------- 1 file changed, 91 insertions(+), 28 deletions(-) diff --git a/include/osg/PrimitiveSetIndirect b/include/osg/PrimitiveSetIndirect index 8ede4471c..bd724dab0 100644 --- a/include/osg/PrimitiveSetIndirect +++ b/include/osg/PrimitiveSetIndirect @@ -415,31 +415,48 @@ class OSG_EXPORT MultiDrawElementsIndirectUShort : public DrawElementsIndirectUS { public: MultiDrawElementsIndirectUShort(GLenum mode = 0/*,unsigned int firstCommand = 0, GLsizei stride = 0*/) : - DrawElementsIndirectUShort(mode),_count(0) { _primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType)); } + DrawElementsIndirectUShort(mode), + _count(0) + { + _primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType)); + } MultiDrawElementsIndirectUShort(const MultiDrawElementsIndirectUShort& mdi,const CopyOp& copyop=CopyOp::SHALLOW_COPY) : - DrawElementsIndirectUShort(mdi,copyop),_count(mdi._count) {} + DrawElementsIndirectUShort(mdi,copyop), + _count(mdi._count) + { + } + /** * \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used. * \param no Number of intended elements. This will be the size of the underlying vector. * \param ptr Pointer to a GLunsigned int to copy index data from. */ MultiDrawElementsIndirectUShort(GLenum mode, unsigned int no, const GLushort* ptr) : - DrawElementsIndirectUShort(mode,no,ptr) - {_primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType));} + DrawElementsIndirectUShort(mode,no,ptr), + _count(0) + { + _primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType)); + } /** * \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used. * \param no Number of intended elements. This will be the size of the underlying vector. */ MultiDrawElementsIndirectUShort(GLenum mode, unsigned int no) : - DrawElementsIndirectUShort(mode,no) - {_primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType));} + DrawElementsIndirectUShort(mode,no), + _count(0) + { + _primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType)); + } template MultiDrawElementsIndirectUShort(GLenum mode, InputIterator first,InputIterator last) : - DrawElementsIndirectUShort(mode,first,last) - {_primitiveType=(Type(MultiDrawElementsUShortIndirectPrimitiveType));} + 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); } @@ -467,31 +484,49 @@ class OSG_EXPORT MultiDrawElementsIndirectUByte : public DrawElementsIndirectUBy { public: MultiDrawElementsIndirectUByte(GLenum mode = 0) : - DrawElementsIndirectUByte(mode),_count(0) { _primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType)); } + DrawElementsIndirectUByte(mode), + _count(0) + { + _primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType)); + + } MultiDrawElementsIndirectUByte(const MultiDrawElementsIndirectUByte& mdi,const CopyOp& copyop=CopyOp::SHALLOW_COPY) : - DrawElementsIndirectUByte(mdi,copyop),_count(mdi._count) {} + DrawElementsIndirectUByte(mdi,copyop), + _count(mdi._count) + { + } + /** * \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used. * \param no Number of intended elements. This will be the size of the underlying vector. * \param ptr Pointer to a GLunsigned int to copy index data from. */ MultiDrawElementsIndirectUByte(GLenum mode, unsigned int no, const GLubyte* ptr) : - DrawElementsIndirectUByte(mode,no,ptr) - {_primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType));} + DrawElementsIndirectUByte(mode,no,ptr), + _count(0) + { + _primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType)); + } /** * \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used. * \param no Number of intended elements. This will be the size of the underlying vector. */ MultiDrawElementsIndirectUByte(GLenum mode, unsigned int no) : - DrawElementsIndirectUByte(mode,no) - {_primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType));} + DrawElementsIndirectUByte(mode,no), + _count(0) + { + _primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType)); + } template MultiDrawElementsIndirectUByte(GLenum mode, InputIterator first,InputIterator last) : - DrawElementsIndirectUByte(mode,first,last) - {_primitiveType=(Type(MultiDrawElementsUByteIndirectPrimitiveType));} + 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); } @@ -517,31 +552,47 @@ class OSG_EXPORT MultiDrawElementsIndirectUInt : public DrawElementsIndirectUInt { public: MultiDrawElementsIndirectUInt(GLenum mode = 0) : - DrawElementsIndirectUInt(mode),_count(0) { _primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType)); } + DrawElementsIndirectUInt(mode), + _count(0) + { + _primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType)); + } MultiDrawElementsIndirectUInt(const MultiDrawElementsIndirectUInt& mdi,const CopyOp& copyop=CopyOp::SHALLOW_COPY) : - DrawElementsIndirectUInt(mdi,copyop),_count(mdi._count) {} + DrawElementsIndirectUInt(mdi,copyop), + _count(mdi._count) + {} + /** * \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used. * \param no Number of intended elements. This will be the size of the underlying vector. * \param ptr Pointer to a GLunsigned int to copy index data from. */ MultiDrawElementsIndirectUInt(GLenum mode, unsigned int no, const GLuint* ptr) : - DrawElementsIndirectUInt(mode,no,ptr) - {_primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType));} + DrawElementsIndirectUInt(mode,no,ptr), + _count(0) + { + _primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType)); + } /** * \param mode One of osg::PrimitiveSet::Mode. Determines the type of primitives used. * \param no Number of intended elements. This will be the size of the underlying vector. */ MultiDrawElementsIndirectUInt(GLenum mode, unsigned int no) : - DrawElementsIndirectUInt(mode,no) - {_primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType));} + DrawElementsIndirectUInt(mode,no), + _count(0) + { + _primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType)); + } template MultiDrawElementsIndirectUInt(GLenum mode, InputIterator first,InputIterator last) : - DrawElementsIndirectUInt(mode,first,last) - {_primitiveType=(Type(MultiDrawElementsUIntIndirectPrimitiveType));} + 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); } @@ -572,13 +623,19 @@ public: DrawArraysIndirect(GLenum mode=0, unsigned int firstcommand = 0, GLsizei stride = 0) : osg::PrimitiveSet(Type(DrawArraysIndirectPrimitiveType), mode), - _firstCommand(firstcommand), _stride(stride) { setIndirectCommandArray(new DefaultIndirectCommandDrawArrays); } + _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())) {} + _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); } @@ -635,10 +692,16 @@ 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); }