From 7d34e8f441d5e689eef65c19d06b2630f9e3a463 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 17 Jun 2016 12:49:44 +0100 Subject: [PATCH] Build fixes to reflect removal of deprecated_osg::Geometry --- include/osg/Geometry | 69 ---------- .../deprecated-dotosg/osg/Geometry.cpp | 130 ++++++------------ 2 files changed, 44 insertions(+), 155 deletions(-) diff --git a/include/osg/Geometry b/include/osg/Geometry index 3289ae707..fc61445fb 100644 --- a/include/osg/Geometry +++ b/include/osg/Geometry @@ -288,73 +288,4 @@ inline Geometry* createTexturedQuadGeometry(const Vec3& corner,const Vec3& width } // namespace osg - - -/** Contains deprecated features of namespace osg. */ -namespace deprecated_osg { - -/** Geometry class contaning deprecated features. - * Users should only use deprecated_osg::Geometry when absolutely necessary for keeping things compiling, - * it is recommended that you should migrate your code to work just with osg::Geometry as existing - * deprecated_osg::Geometry will be removed in future release. -*/ -class OSG_EXPORT Geometry : public osg::Geometry -{ - public: - Geometry() : osg::Geometry() {} - Geometry(const Geometry& geometry,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : osg::Geometry(geometry, copyop) {} - - /** Same values as Array::Binding.*/ - enum AttributeBinding - { - BIND_OFF=0, - BIND_OVERALL=1, - BIND_PER_PRIMITIVE_SET=2, - BIND_PER_PRIMITIVE=3, - BIND_PER_VERTEX=4 - }; - - void setNormalBinding(AttributeBinding ab); - AttributeBinding getNormalBinding() const; - - void setColorBinding(AttributeBinding ab); - AttributeBinding getColorBinding() const; - - void setSecondaryColorBinding(AttributeBinding ab); - AttributeBinding getSecondaryColorBinding() const; - - void setFogCoordBinding(AttributeBinding ab); - AttributeBinding getFogCoordBinding() const; - - void setVertexAttribBinding(unsigned int index,AttributeBinding ab); - AttributeBinding getVertexAttribBinding(unsigned int index) const; - - void setVertexAttribNormalize(unsigned int index,GLboolean norm); - GLboolean getVertexAttribNormalize(unsigned int index) const; - - void setVertexIndices(osg::IndexArray* array); - const osg::IndexArray* getVertexIndices() const; - - void setNormalIndices(osg::IndexArray* array); - const osg::IndexArray* getNormalIndices() const; - - void setColorIndices(osg::IndexArray* array); - const osg::IndexArray* getColorIndices() const; - - void setSecondaryColorIndices(osg::IndexArray* array); - const osg::IndexArray* getSecondaryColorIndices() const; - - void setFogCoordIndices(osg::IndexArray* array); - const osg::IndexArray* getFogCoordIndices() const; - - void setTexCoordIndices(unsigned int unit,osg::IndexArray* array); - const osg::IndexArray* getTexCoordIndices(unsigned int unit) const; - - void setVertexAttribIndices(unsigned int index,osg::IndexArray* array); - const osg::IndexArray* getVertexAttribIndices(unsigned int index) const; - -}; - -} // namespace deprecated_osg - #endif diff --git a/src/osgWrappers/deprecated-dotosg/osg/Geometry.cpp b/src/osgWrappers/deprecated-dotosg/osg/Geometry.cpp index fe1e2bb8d..6229454c9 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Geometry.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Geometry.cpp @@ -20,8 +20,8 @@ using namespace osgDB; bool Geometry_readLocalData(Object& obj, Input& fr); bool Geometry_writeLocalData(const Object& obj, Output& fw); -bool Geometry_matchBindingTypeStr(const char* str,deprecated_osg::Geometry::AttributeBinding& mode); -const char* Geometry_getBindingTypeStr(deprecated_osg::Geometry::AttributeBinding mode); +bool Geometry_matchBindingTypeStr(const char* str,osg::Array::Binding& mode); +const char* Geometry_getBindingTypeStr(const osg::Array* array); bool Geometry_matchPrimitiveModeStr(const char* str,GLenum& mode); const char* Geometry_getPrimitiveModeStr(GLenum mode); @@ -45,7 +45,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr) { bool iteratorAdvanced = false; - deprecated_osg::Geometry& geom = static_cast(obj); + osg::Geometry& geom = static_cast(obj); if (fr.matchSequence("Primitives %i {") || fr.matchSequence("PrimitiveSets %i {") ) { @@ -127,14 +127,14 @@ bool Geometry_readLocalData(Object& obj, Input& fr) IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); if (indices) { - geom.setVertexIndices(indices); + OSG_WARN<<"Warning: Geometry with vertex indices no longer supported."<(Array_readLocalData(fr)); if (indices) { - geom.setNormalIndices(indices); + OSG_WARN<<"Warning: Geometry with normal indices no longer supported."<(Array_readLocalData(fr)); if (indices) { - geom.setColorIndices(indices); + OSG_WARN<<"Warning: Geometry with color indices no longer supported."<(Array_readLocalData(fr)); if (indices) { - geom.setSecondaryColorIndices(indices); + OSG_WARN<<"Warning: Geometry with secondary color indices no longer supported."<(Array_readLocalData(fr)); if (indices) { - geom.setFogCoordIndices(indices); + OSG_WARN<<"Warning: Geometry with fog coord indices no longer supported."<(Array_readLocalData(fr)); if (indices) { - geom.setTexCoordIndices(unit,indices); + OSG_WARN<<"Warning: Geometry with texture coord indices no longer supported."<setBinding(vertexAttribBinding); + vertexattrib->setNormalize(vertexAttribNormalize); + geom.setVertexAttribArray(unit,vertexattrib); - geom.setVertexAttribBinding(unit,vertexAttribBinding); - geom.setVertexAttribNormalize(unit,vertexAttribNormalize); } iteratorAdvanced = true; @@ -370,7 +367,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr) IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); if (indices) { - geom.setVertexAttribIndices(unit,indices); + OSG_WARN<<"Warning: Geometry with vertex attrib indices no longer supported."<(obj); + const osg::Geometry& geom = static_cast(obj); const Geometry::PrimitiveSetList& primitives = geom.getPrimitiveSetList(); if (!primitives.empty()) @@ -1305,16 +1302,11 @@ bool Geometry_writeLocalData(const Object& obj, Output& fw) Array_writeLocalData(*geom.getVertexArray(),fw); } - if (geom.getVertexIndices()) - { - fw.indent()<<"VertexIndices "; - Array_writeLocalData(*geom.getVertexIndices(),fw); - } if (geom.getNormalArray()) { - fw.indent()<<"NormalBinding "<(array->getUserData()) : 0; - if (indices) - { - fw.indent()<<"TexCoordIndices "<(array->getBinding()))<getNormalize()) fw.indent()<<"VertexAttribNormalize "<(array->getUserData()) : 0; - if (indices) - { - fw.indent()<<"VertexAttribIndices "<getBinding() : osg::Array::BIND_OFF; + switch(binding) { - case (deprecated_osg::Geometry::BIND_OVERALL) : return "OVERALL"; - case (deprecated_osg::Geometry::BIND_PER_PRIMITIVE) : return "PER_PRIMITIVE"; - case (deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET) : return "PER_PRIMITIVE_SET"; - case (deprecated_osg::Geometry::BIND_PER_VERTEX) : return "PER_VERTEX"; - case (deprecated_osg::Geometry::BIND_OFF) : - default : return "OFF"; + case (osg::Array::BIND_OVERALL) : return "OVERALL"; + case (osg::Array::BIND_PER_PRIMITIVE_SET) : return "PER_PRIMITIVE_SET"; + case (osg::Array::BIND_PER_VERTEX) : return "PER_VERTEX"; + case (osg::Array::BIND_OFF) : + default : return "OFF"; } }