diff --git a/include/osg/Drawable b/include/osg/Drawable index deb149d90..f0b7eb017 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -271,14 +271,14 @@ class OSG_EXPORT Drawable : public Object /** When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation method to use OpenGL vertex buffer objects for rendering.*/ - void setUseVertexBufferObjects(bool flag); + virtual void setUseVertexBufferObjects(bool flag); /** Return whether OpenGL vertex buffer objects should be used when supported by OpenGL driver.*/ inline bool getUseVertexBufferObjects() const { return _useVertexBufferObjects; } /** Force a recompile on next draw() of any OpenGL display list associated with this geoset.*/ - void dirtyDisplayList(); + virtual void dirtyDisplayList(); /** Return the estimated size of GLObjects (display lists/vertex buffer objects) that are associated with this drawable. diff --git a/include/osg/Geometry b/include/osg/Geometry index 2941c0be9..190279ed8 100644 --- a/include/osg/Geometry +++ b/include/osg/Geometry @@ -142,18 +142,18 @@ class OSG_EXPORT Geometry : public Drawable */ static const ArrayData s_InvalidArrayData; - typedef std::vector< ArrayData > ArrayList; + typedef std::vector< ArrayData > ArrayDataList; - void setVertexArray(Array* array) { _vertexData.array = array; computeFastPathsUsed(); dirtyDisplayList(); dirtyBound(); } + void setVertexArray(Array* array); Array* getVertexArray() { return _vertexData.array.get(); } const Array* getVertexArray() const { return _vertexData.array.get(); } - void setVertexIndices(IndexArray* array) { _vertexData.indices = array; computeFastPathsUsed(); dirtyDisplayList(); dirtyBound(); } + void setVertexIndices(IndexArray* array); IndexArray* getVertexIndices() { return _vertexData.indices.get(); } const IndexArray* getVertexIndices() const { return _vertexData.indices.get(); } - void setVertexData(const ArrayData& arrayData) { _vertexData = arrayData; computeFastPathsUsed(); dirtyDisplayList(); dirtyBound(); } + void setVertexData(const ArrayData& arrayData); ArrayData& getVertexData() { return _vertexData; } const ArrayData& getVertexData() const { return _vertexData; } @@ -161,30 +161,30 @@ class OSG_EXPORT Geometry : public Drawable void setNormalBinding(AttributeBinding ab); AttributeBinding getNormalBinding() const { return _normalData.binding; } - void setNormalArray(Array* array) { _normalData.array = array; if (!_normalData.array.valid()) _normalData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); } + void setNormalArray(Array* array); Array* getNormalArray() { return _normalData.array.get(); } const Array* getNormalArray() const { return _normalData.array.get(); } - void setNormalIndices(IndexArray* array) { _normalData.indices = array; computeFastPathsUsed(); dirtyDisplayList(); } + void setNormalIndices(IndexArray* array); IndexArray* getNormalIndices() { return _normalData.indices.get(); } const IndexArray* getNormalIndices() const { return _normalData.indices.get(); } - void setNormalData(const ArrayData& arrayData) { _normalData = arrayData; computeFastPathsUsed(); dirtyDisplayList();} + void setNormalData(const ArrayData& arrayData); ArrayData& getNormalData() { return _normalData; } const ArrayData& getNormalData() const { return _normalData; } void setColorBinding(AttributeBinding ab); AttributeBinding getColorBinding() const { return _colorData.binding; } - void setColorArray(Array* array) { _colorData.array = array; if (!_colorData.array.valid()) _colorData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); } + void setColorArray(Array* array); Array* getColorArray() { return _colorData.array.get(); } const Array* getColorArray() const { return _colorData.array.get(); } - void setColorIndices(IndexArray* array) { _colorData.indices = array; computeFastPathsUsed(); dirtyDisplayList(); } + void setColorIndices(IndexArray* array); IndexArray* getColorIndices() { return _colorData.indices.get(); } const IndexArray* getColorIndices() const { return _colorData.indices.get(); } - void setColorData(const ArrayData& arrayData) { _colorData = arrayData; computeFastPathsUsed(); dirtyDisplayList();} + void setColorData(const ArrayData& arrayData); ArrayData& getColorData() { return _colorData; } const ArrayData& getColorData() const { return _colorData; } @@ -192,15 +192,15 @@ class OSG_EXPORT Geometry : public Drawable void setSecondaryColorBinding(AttributeBinding ab); AttributeBinding getSecondaryColorBinding() const { return _secondaryColorData.binding; } - void setSecondaryColorArray(Array* array) { _secondaryColorData.array = array; if (!_secondaryColorData.array.valid()) _secondaryColorData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); } + void setSecondaryColorArray(Array* array); Array* getSecondaryColorArray() { return _secondaryColorData.array.get(); } const Array* getSecondaryColorArray() const { return _secondaryColorData.array.get(); } - void setSecondaryColorIndices(IndexArray* array) { _secondaryColorData.indices = array; computeFastPathsUsed(); dirtyDisplayList(); } + void setSecondaryColorIndices(IndexArray* array); IndexArray* getSecondaryColorIndices() { return _secondaryColorData.indices.get(); } const IndexArray* getSecondaryColorIndices() const { return _secondaryColorData.indices.get(); } - void setSecondaryColorData(const ArrayData& arrayData) { _secondaryColorData = arrayData; computeFastPathsUsed(); dirtyDisplayList(); } + void setSecondaryColorData(const ArrayData& arrayData); ArrayData& getSecondaryColorData() { return _secondaryColorData; } const ArrayData& getSecondaryColorData() const { return _secondaryColorData; } @@ -208,19 +208,18 @@ class OSG_EXPORT Geometry : public Drawable void setFogCoordBinding(AttributeBinding ab); AttributeBinding getFogCoordBinding() const { return _fogCoordData.binding; } - void setFogCoordArray(Array* array) { _fogCoordData.array = array; if (!_fogCoordData.array.valid()) _fogCoordData.binding=BIND_OFF; computeFastPathsUsed(); dirtyDisplayList(); } + void setFogCoordArray(Array* array); Array* getFogCoordArray() { return _fogCoordData.array.get(); } const Array* getFogCoordArray() const { return _fogCoordData.array.get(); } - void setFogCoordIndices(IndexArray* array) { _fogCoordData.indices = array; computeFastPathsUsed(); dirtyDisplayList(); } + void setFogCoordIndices(IndexArray* array); IndexArray* getFogCoordIndices() { return _fogCoordData.indices.get(); } const IndexArray* getFogCoordIndices() const { return _fogCoordData.indices.get(); } - void setFogCoordData(const ArrayData& arrayData) { _fogCoordData = arrayData; computeFastPathsUsed(); dirtyDisplayList(); } + void setFogCoordData(const ArrayData& arrayData); ArrayData& getFogCoordData() { return _fogCoordData; } const ArrayData& getFogCoordData() const { return _fogCoordData; } - void setTexCoordArray(unsigned int unit,Array*); Array* getTexCoordArray(unsigned int unit); @@ -235,8 +234,8 @@ class OSG_EXPORT Geometry : public Drawable const ArrayData& getTexCoordData(unsigned int index) const; unsigned int getNumTexCoordArrays() const { return _texCoordList.size(); } - ArrayList& getTexCoordArrayList() { return _texCoordList; } - const ArrayList& getTexCoordArrayList() const { return _texCoordList; } + ArrayDataList& getTexCoordArrayList() { return _texCoordList; } + const ArrayDataList& getTexCoordArrayList() const { return _texCoordList; } @@ -259,8 +258,8 @@ class OSG_EXPORT Geometry : public Drawable const ArrayData& getVertexAttribData(unsigned int index) const; unsigned int getNumVertexAttribArrays() const { return _vertexAttribList.size(); } - ArrayList& getVertexAttribArrayList() { return _vertexAttribList; } - const ArrayList& getVertexAttribArrayList() const { return _vertexAttribList; } + ArrayDataList& getVertexAttribArrayList() { return _vertexAttribList; } + const ArrayDataList& getVertexAttribArrayList() const { return _vertexAttribList; } @@ -293,6 +292,25 @@ class OSG_EXPORT Geometry : public Drawable unsigned int getPrimitiveSetIndex(const PrimitiveSet* primitiveset) const; + /** When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation + method to use OpenGL vertex buffer objects for rendering.*/ + virtual void setUseVertexBufferObjects(bool flag); + + /** Force a recompile on next draw() of any OpenGL display list associated with this geoset.*/ + virtual void dirtyDisplayList(); + + + typedef std::vector ArrayList; + bool getArrayList(ArrayList& arrayList); + + typedef std::vector DrawElementsList; + bool getDrawElementsList(DrawElementsList& drawElementsList); + + osg::VertexBufferObject* getOrCreateVertexBufferObject(); + + osg::ElementsBufferObject* getOrCreateElementsBufferObject(); + + /** Set whether fast paths should be used when supported. */ void setFastPathHint(bool on) { _fastPathHint = on; } @@ -375,6 +393,9 @@ class OSG_EXPORT Geometry : public Drawable void computeCorrectBindingsAndArraySizes(ArrayData& arrayData,const char* arrayName); void computeCorrectBindingsAndArraySizes(Vec3ArrayData& arrayData,const char* arrayName); + void addVertexBufferObjectIfRequired(osg::Array* array); + void addElementsBufferObjectIfRequired(osg::PrimitiveSet* primitiveSet); + PrimitiveSetList _primitives; ArrayData _vertexData; @@ -382,8 +403,8 @@ class OSG_EXPORT Geometry : public Drawable ArrayData _colorData; ArrayData _secondaryColorData; ArrayData _fogCoordData; - ArrayList _texCoordList; - ArrayList _vertexAttribList; + ArrayDataList _texCoordList; + ArrayDataList _vertexAttribList; mutable bool _fastPath; bool _fastPathHint; diff --git a/include/osg/PrimitiveSet b/include/osg/PrimitiveSet index 65df1ed3b..0be430867 100644 --- a/include/osg/PrimitiveSet +++ b/include/osg/PrimitiveSet @@ -171,6 +171,8 @@ public: virtual void end() = 0; }; +class DrawElements; + class OSG_EXPORT PrimitiveSet : public Object { public: @@ -220,6 +222,9 @@ class OSG_EXPORT PrimitiveSet : public Object virtual const GLvoid* getDataPointer() const { return 0; } virtual unsigned int getTotalDataSize() const { return 0; } virtual bool supportsBufferObject() const { return false; } + + virtual DrawElements* getDrawElements() { return 0; } + virtual const DrawElements* getDrawElements() const { return 0; } void setMode(GLenum mode) { _mode = mode; } GLenum getMode() const { return _mode; } @@ -415,6 +420,9 @@ class DrawElements : public PrimitiveSet _eboIndex(0) {} + virtual DrawElements* getDrawElements() { return this; } + virtual const DrawElements* getDrawElements() const { return this; } + /** Set the ElementsBufferObject.*/ inline void setElementsBufferObject(osg::ElementsBufferObject* ebo) { diff --git a/src/osg/Drawable.cpp b/src/osg/Drawable.cpp index fd0f62d0f..046b1aadd 100644 --- a/src/osg/Drawable.cpp +++ b/src/osg/Drawable.cpp @@ -603,6 +603,8 @@ void Drawable::setUseDisplayList(bool flag) void Drawable::setUseVertexBufferObjects(bool flag) { + osg::notify(osg::NOTICE)<<"Drawable::setUseVertexBufferObjects("<getDrawElements(); + if (de) drawElementsList.push_back(de); + } + + return drawElementsList.size()!=startSize; +} + +void Geometry::addVertexBufferObjectIfRequired(osg::Array* array) +{ + if (_useVertexBufferObjects) + { + if (!array->getVertexBufferObject()) + { + array->setVertexBufferObject(getOrCreateVertexBufferObject()); + } + } +} + +void Geometry::addElementsBufferObjectIfRequired(osg::PrimitiveSet* primitiveSet) +{ + if (_useVertexBufferObjects) + { + osg::DrawElements* drawElements = primitiveSet->getDrawElements(); + if (drawElements && !drawElements->getElementsBufferObject()) + { + drawElements->setElementsBufferObject(getOrCreateElementsBufferObject()); + } + } +} + +osg::VertexBufferObject* Geometry::getOrCreateVertexBufferObject() +{ + ArrayList arrayList; + getArrayList(arrayList); + + osg::VertexBufferObject* vbo = 0; + + ArrayList::iterator vitr; + for(vitr = arrayList.begin(); + vitr != arrayList.end() && !vbo; + ++vitr) + { + osg::Array* array = *vitr; + if (!array->getVertexBufferObject()) vbo = array->getVertexBufferObject(); + } + + if (!vbo) vbo = new osg::VertexBufferObject; + + return vbo; +} + +osg::ElementsBufferObject* Geometry::getOrCreateElementsBufferObject() +{ + DrawElementsList drawElementsList; + getDrawElementsList(drawElementsList); + + osg::ElementsBufferObject* ebo = 0; + + DrawElementsList::iterator deitr; + for(deitr = drawElementsList.begin(); + deitr != drawElementsList.end(); + ++deitr) + { + osg::DrawElements* elements = *deitr; + if (!elements->getElementsBufferObject()) ebo = elements->getElementsBufferObject(); + } + + if (!ebo) ebo = new osg::ElementsBufferObject; + + return ebo; +} + +void Geometry::setUseVertexBufferObjects(bool flag) +{ + osg::notify(osg::NOTICE)<<"Geometry::setUseVertexBufferObjects("< VertexBufferObjectList; + typedef std::vector ElementsBufferObjectList; + + if (_useVertexBufferObjects) + { + if (!arrayList.empty()) + { + + VertexBufferObjectList vboList; + + osg::VertexBufferObject* vbo = 0; + + ArrayList::iterator vitr; + for(vitr = arrayList.begin(); + vitr != arrayList.end() && !vbo; + ++vitr) + { + osg::Array* array = *vitr; + if (!array->getVertexBufferObject()) vbo = array->getVertexBufferObject(); + } + + if (!vbo) vbo = new osg::VertexBufferObject; + + for(vitr = arrayList.begin(); + vitr != arrayList.end(); + ++vitr) + { + osg::Array* array = *vitr; + if (!array->getVertexBufferObject()) array->setVertexBufferObject(vbo); + } + } + + if (!drawElementsList.empty()) + { + ElementsBufferObjectList eboList; + + osg::ElementsBufferObject* ebo = 0; + + DrawElementsList::iterator deitr; + for(deitr = drawElementsList.begin(); + deitr != drawElementsList.end(); + ++deitr) + { + osg::DrawElements* elements = *deitr; + if (!elements->getElementsBufferObject()) ebo = elements->getElementsBufferObject(); + } + + if (!ebo) ebo = new osg::ElementsBufferObject; + + for(deitr = drawElementsList.begin(); + deitr != drawElementsList.end(); + ++deitr) + { + osg::DrawElements* elements = *deitr; + if (!elements->getElementsBufferObject()) elements->setElementsBufferObject(ebo); + } + } + } + else + { + for(ArrayList::iterator vitr = arrayList.begin(); + vitr != arrayList.end(); + ++vitr) + { + osg::Array* array = *vitr; + if (!array->getVertexBufferObject()) array->setVertexBufferObject(0); + } + + for(DrawElementsList::iterator deitr = drawElementsList.begin(); + deitr != drawElementsList.end(); + ++deitr) + { + osg::DrawElements* elements = *deitr; + if (!elements->getElementsBufferObject()) elements->setElementsBufferObject(0); + } + } +} + +void Geometry::dirtyDisplayList() +{ + Drawable::dirtyDisplayList(); +} + void Geometry::drawImplementation(RenderInfo& renderInfo) const { State& state = *renderInfo.getState(); @@ -962,12 +1303,73 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const if (areFastPathsUsed()) { + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // fast path. // if (usingVertexBufferObjects) { + + // first up lets check for new VBO support: + unsigned int numArraysWithVBO = 0; + unsigned int numArraysWithoutVBO = 0; + if (_vertexData.array.valid()) + { + if (_vertexData.array->getVertexBufferObject()) + ++numArraysWithVBO; + else + ++numArraysWithoutVBO; + } + + if (_normalData.array.valid()) + { + if (_normalData.array->getVertexBufferObject()) + ++numArraysWithVBO; + else + ++numArraysWithoutVBO; + } + + + if (_colorData.array.valid()) + { + if (_colorData.array->getVertexBufferObject()) + ++numArraysWithVBO; + else + ++numArraysWithoutVBO; + } + + + unsigned int unit; + for(unit=0;unit<_texCoordList.size();++unit) + { + if (_texCoordList[unit].array.valid()) + { + if (_texCoordList[unit].array->getVertexBufferObject()) + ++numArraysWithVBO; + else + ++numArraysWithoutVBO; + } + } + + if( handleVertexAttributes ) + { + for(unit=0;unit<_vertexAttribList.size();++unit) + { + if (_vertexAttribList[unit].array.valid()) + { + if (_vertexAttribList[unit].array->getVertexBufferObject()) + ++numArraysWithVBO; + else + ++numArraysWithoutVBO; + } + } + } + + osg::notify(osg::NOTICE)<<"Geometry::drawImplementation "<glBindBuffer(GL_ARRAY_BUFFER_ARB,buffer); if( _vertexData.array.valid() ) state.setVertexPointer(_vertexData.array->getDataSize(),_vertexData.array->getDataType(),0,(const GLvoid*)_vertexData.offset); @@ -1104,7 +1508,6 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const else state.disableFogCoordPointer(); - unsigned int unit; for(unit=0;unit<_texCoordList.size();++unit) { const Array* array = _texCoordList[unit].array.get(); @@ -2501,14 +2904,14 @@ bool Geometry::verifyBindings() const if (!verifyBindings(_secondaryColorData)) return false; if (!verifyBindings(_fogCoordData)) return false; - for(ArrayList::const_iterator titr=_texCoordList.begin(); + for(ArrayDataList::const_iterator titr=_texCoordList.begin(); titr!=_texCoordList.end(); ++titr) { if (!verifyBindings(*titr)) return false; } - for(ArrayList::const_iterator vitr=_vertexAttribList.begin(); + for(ArrayDataList::const_iterator vitr=_vertexAttribList.begin(); vitr!=_vertexAttribList.end(); ++vitr) { @@ -2527,14 +2930,14 @@ void Geometry::computeCorrectBindingsAndArraySizes() computeCorrectBindingsAndArraySizes(_secondaryColorData,"_secondaryColorData"); computeCorrectBindingsAndArraySizes(_fogCoordData,"_fogCoordData"); - for(ArrayList::iterator titr=_texCoordList.begin(); + for(ArrayDataList::iterator titr=_texCoordList.begin(); titr!=_texCoordList.end(); ++titr) { computeCorrectBindingsAndArraySizes(*titr,"_texCoordList[]"); } - for(ArrayList::iterator vitr=_vertexAttribList.begin(); + for(ArrayDataList::iterator vitr=_vertexAttribList.begin(); vitr!=_vertexAttribList.end(); ++vitr) { diff --git a/src/osgPlugins/ive/Geometry.cpp b/src/osgPlugins/ive/Geometry.cpp index fd189a444..c2767e48d 100644 --- a/src/osgPlugins/ive/Geometry.cpp +++ b/src/osgPlugins/ive/Geometry.cpp @@ -128,7 +128,7 @@ void Geometry::write(DataOutputStream* out){ out->writeArray(getFogCoordIndices()); } // Write texture coord arrays - Geometry::ArrayList& tcal = getTexCoordArrayList(); + Geometry::ArrayDataList& tcal = getTexCoordArrayList(); out->writeInt(tcal.size()); unsigned int j; for(j=0;jwriteInt(vaal.size()); for(j=0;j #include +#include #include #include #include @@ -26,10 +27,14 @@ #undef OUT #endif -TYPE_NAME_ALIAS(std::vector< osg::Geometry::ArrayData >, osg::Geometry::ArrayList) +TYPE_NAME_ALIAS(std::vector< osg::Geometry::ArrayData >, osg::Geometry::ArrayDataList) TYPE_NAME_ALIAS(std::vector< osg::ref_ptr< osg::PrimitiveSet > >, osg::Geometry::PrimitiveSetList) +TYPE_NAME_ALIAS(std::vector< osg::Array * >, osg::Geometry::ArrayList) + +TYPE_NAME_ALIAS(std::vector< osg::DrawElements * >, osg::Geometry::DrawElementsList) + BEGIN_ENUM_REFLECTOR(osg::Geometry::AttributeBinding) I_EnumLabel(osg::Geometry::BIND_OFF); I_EnumLabel(osg::Geometry::BIND_OVERALL); @@ -402,14 +407,14 @@ BEGIN_OBJECT_REFLECTOR(osg::Geometry) __unsigned_int__getNumTexCoordArrays, "", ""); - I_Method0(osg::Geometry::ArrayList &, getTexCoordArrayList, + I_Method0(osg::Geometry::ArrayDataList &, getTexCoordArrayList, Properties::NON_VIRTUAL, - __ArrayList_R1__getTexCoordArrayList, + __ArrayDataList_R1__getTexCoordArrayList, "", ""); - I_Method0(const osg::Geometry::ArrayList &, getTexCoordArrayList, + I_Method0(const osg::Geometry::ArrayDataList &, getTexCoordArrayList, Properties::NON_VIRTUAL, - __C5_ArrayList_R1__getTexCoordArrayList, + __C5_ArrayDataList_R1__getTexCoordArrayList, "", ""); I_Method2(void, setVertexAttribArray, IN, unsigned int, index, IN, osg::Array *, array, @@ -482,14 +487,14 @@ BEGIN_OBJECT_REFLECTOR(osg::Geometry) __unsigned_int__getNumVertexAttribArrays, "", ""); - I_Method0(osg::Geometry::ArrayList &, getVertexAttribArrayList, + I_Method0(osg::Geometry::ArrayDataList &, getVertexAttribArrayList, Properties::NON_VIRTUAL, - __ArrayList_R1__getVertexAttribArrayList, + __ArrayDataList_R1__getVertexAttribArrayList, "", ""); - I_Method0(const osg::Geometry::ArrayList &, getVertexAttribArrayList, + I_Method0(const osg::Geometry::ArrayDataList &, getVertexAttribArrayList, Properties::NON_VIRTUAL, - __C5_ArrayList_R1__getVertexAttribArrayList, + __C5_ArrayDataList_R1__getVertexAttribArrayList, "", ""); I_Method1(void, setPrimitiveSetList, IN, const osg::Geometry::PrimitiveSetList &, primitives, @@ -547,6 +552,36 @@ BEGIN_OBJECT_REFLECTOR(osg::Geometry) __unsigned_int__getPrimitiveSetIndex__C5_PrimitiveSet_P1, "Get the index number of a primitive set, return a value between 0 and getNumPrimitiveSet()-1 if found, if not found then return getNumPrimitiveSet(). ", "When checking for a valid find value use if ((value=geometry->getPrimitiveSetIndex(primitive))!=geometry.getNumPrimitiveSet())"); + I_Method1(void, setUseVertexBufferObjects, IN, bool, flag, + Properties::VIRTUAL, + __void__setUseVertexBufferObjects__bool, + "When set to true, ignore the setUseDisplayList() settings, and hints to the drawImplementation method to use OpenGL vertex buffer objects for rendering. ", + ""); + I_Method0(void, dirtyDisplayList, + Properties::VIRTUAL, + __void__dirtyDisplayList, + "Force a recompile on next draw() of any OpenGL display list associated with this geoset. ", + ""); + I_Method1(bool, getArrayList, IN, osg::Geometry::ArrayList &, arrayList, + Properties::NON_VIRTUAL, + __bool__getArrayList__ArrayList_R1, + "", + ""); + I_Method1(bool, getDrawElementsList, IN, osg::Geometry::DrawElementsList &, drawElementsList, + Properties::NON_VIRTUAL, + __bool__getDrawElementsList__DrawElementsList_R1, + "", + ""); + I_Method0(osg::VertexBufferObject *, getOrCreateVertexBufferObject, + Properties::NON_VIRTUAL, + __osg_VertexBufferObject_P1__getOrCreateVertexBufferObject, + "", + ""); + I_Method0(osg::ElementsBufferObject *, getOrCreateElementsBufferObject, + Properties::NON_VIRTUAL, + __osg_ElementsBufferObject_P1__getOrCreateElementsBufferObject, + "", + ""); I_Method1(void, setFastPathHint, IN, bool, on, Properties::NON_VIRTUAL, __void__setFastPathHint__bool, @@ -686,6 +721,18 @@ BEGIN_OBJECT_REFLECTOR(osg::Geometry) __void__computeCorrectBindingsAndArraySizes__Vec3ArrayData_R1__C5_char_P1, "", ""); + I_ProtectedMethod1(void, addVertexBufferObjectIfRequired, IN, osg::Array *, array, + Properties::NON_VIRTUAL, + Properties::NON_CONST, + __void__addVertexBufferObjectIfRequired__osg_Array_P1, + "", + ""); + I_ProtectedMethod1(void, addElementsBufferObjectIfRequired, IN, osg::PrimitiveSet *, primitiveSet, + Properties::NON_VIRTUAL, + Properties::NON_CONST, + __void__addElementsBufferObjectIfRequired__osg_PrimitiveSet_P1, + "", + ""); I_SimpleProperty(osg::Array *, ColorArray, __Array_P1__getColorArray, __void__setColorArray__Array_P1); @@ -760,8 +807,8 @@ BEGIN_OBJECT_REFLECTOR(osg::Geometry) 0, 0, 0); - I_SimpleProperty(osg::Geometry::ArrayList &, TexCoordArrayList, - __ArrayList_R1__getTexCoordArrayList, + I_SimpleProperty(osg::Geometry::ArrayDataList &, TexCoordArrayList, + __ArrayDataList_R1__getTexCoordArrayList, 0); I_ArrayProperty(const osg::Geometry::ArrayData &, TexCoordData, __C5_ArrayData_R1__getTexCoordData__unsigned_int, @@ -777,6 +824,9 @@ BEGIN_OBJECT_REFLECTOR(osg::Geometry) 0, 0, 0); + I_SimpleProperty(bool, UseVertexBufferObjects, + 0, + __void__setUseVertexBufferObjects__bool); I_SimpleProperty(osg::Array *, VertexArray, __Array_P1__getVertexArray, __void__setVertexArray__Array_P1); @@ -787,8 +837,8 @@ BEGIN_OBJECT_REFLECTOR(osg::Geometry) 0, 0, 0); - I_SimpleProperty(osg::Geometry::ArrayList &, VertexAttribArrayList, - __ArrayList_R1__getVertexAttribArrayList, + I_SimpleProperty(osg::Geometry::ArrayDataList &, VertexAttribArrayList, + __ArrayDataList_R1__getVertexAttribArrayList, 0); I_ArrayProperty(osg::Geometry::AttributeBinding, VertexAttribBinding, __AttributeBinding__getVertexAttribBinding__unsigned_int, @@ -921,6 +971,10 @@ BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osg::PrimitiveSet >) 0); END_REFLECTOR +STD_VECTOR_REFLECTOR(std::vector< osg::Array * >) + +STD_VECTOR_REFLECTOR(std::vector< osg::DrawElements * >) + STD_VECTOR_REFLECTOR(std::vector< osg::Geometry::ArrayData >) STD_VECTOR_REFLECTOR(std::vector< osg::ref_ptr< osg::PrimitiveSet > >) diff --git a/src/osgWrappers/osg/PrimitiveSet.cpp b/src/osgWrappers/osg/PrimitiveSet.cpp index b28a1b9e2..055774d06 100644 --- a/src/osgWrappers/osg/PrimitiveSet.cpp +++ b/src/osgWrappers/osg/PrimitiveSet.cpp @@ -241,6 +241,16 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::DrawElements) ____DrawElements__C5_DrawElements_R1__C5_CopyOp_R1, "", ""); + I_Method0(osg::DrawElements *, getDrawElements, + Properties::VIRTUAL, + __DrawElements_P1__getDrawElements, + "", + ""); + I_Method0(const osg::DrawElements *, getDrawElements, + Properties::VIRTUAL, + __C5_DrawElements_P1__getDrawElements, + "", + ""); I_Method1(void, setElementsBufferObject, IN, osg::ElementsBufferObject *, ebo, Properties::NON_VIRTUAL, __void__setElementsBufferObject__osg_ElementsBufferObject_P1, @@ -266,6 +276,9 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::DrawElements) __unsigned_int__getElementsBufferObjectIndex, "Get the index into the ElementsBufferObject, if used. ", ""); + I_SimpleProperty(osg::DrawElements *, DrawElements, + __DrawElements_P1__getDrawElements, + 0); I_SimpleProperty(osg::ElementsBufferObject *, ElementsBufferObject, __osg_ElementsBufferObject_P1__getElementsBufferObject, __void__setElementsBufferObject__osg_ElementsBufferObject_P1); @@ -823,6 +836,16 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::PrimitiveSet) __bool__supportsBufferObject, "", ""); + I_Method0(osg::DrawElements *, getDrawElements, + Properties::VIRTUAL, + __DrawElements_P1__getDrawElements, + "", + ""); + I_Method0(const osg::DrawElements *, getDrawElements, + Properties::VIRTUAL, + __C5_DrawElements_P1__getDrawElements, + "", + ""); I_Method1(void, setMode, IN, GLenum, mode, Properties::NON_VIRTUAL, __void__setMode__GLenum, @@ -901,6 +924,9 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::PrimitiveSet) I_SimpleProperty(const GLvoid *, DataPointer, __C5_GLvoid_P1__getDataPointer, 0); + I_SimpleProperty(osg::DrawElements *, DrawElements, + __DrawElements_P1__getDrawElements, + 0); I_SimpleProperty(GLenum, Mode, __GLenum__getMode, __void__setMode__GLenum);