From aea83494c140188afb4b0a7db831e619aedd3e85 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 17 Jun 2016 10:12:11 +0100 Subject: [PATCH] Removed deprecated_osg::Geometry and cleaned up the deprecated Geometry::set*Binding() calls --- src/osg/Geometry.cpp | 149 ++----------------------------------------- 1 file changed, 7 insertions(+), 142 deletions(-) diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index 1a76d07db..45dc27253 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -1065,14 +1065,15 @@ Geometry* osg::createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVe // Deprecated methods. // #define SET_BINDING(array, ab)\ + osg::Array::Binding binding = static_cast(ab); \ if (!array) \ { \ - if (ab==BIND_OFF) return; \ + if (binding==osg::Array::BIND_OFF) return; \ OSG_NOTICE<<"Warning, can't assign attribute binding as no has been array assigned to set binding for."<getBinding() == static_cast(ab)) return; \ - array->setBinding(static_cast(ab));\ + if (array->getBinding() == binding) return; \ + array->setBinding(binding);\ if (ab==3 /*osg::Geometry::BIND_PER_PRIMITIVE*/) _containsDeprecatedData = true; \ dirtyDisplayList(); @@ -1104,11 +1105,12 @@ void Geometry::setFogCoordBinding(AttributeBinding ab) void Geometry::setVertexAttribBinding(unsigned int index,AttributeBinding ab) { + osg::Array::Binding binding = static_cast(ab); if (index<_vertexAttribList.size() && _vertexAttribList[index].valid()) { - if (_vertexAttribList[index]->getBinding()==static_cast(ab)) return; + if (_vertexAttribList[index]->getBinding()==binding) return; - _vertexAttribList[index]->setBinding(static_cast(ab)); + _vertexAttribList[index]->setBinding(binding); dirtyDisplayList(); } @@ -1760,140 +1762,3 @@ void Geometry::fixDeprecatedData() _containsDeprecatedData = false; } - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// -// deprecated_osg - -void deprecated_osg::Geometry::setNormalBinding(AttributeBinding ab) { SET_BINDING(_normalArray.get(), ab) } -deprecated_osg::Geometry::AttributeBinding deprecated_osg::Geometry::getNormalBinding() const { return static_cast(osg::getBinding(getNormalArray())); } - -void deprecated_osg::Geometry::setColorBinding(deprecated_osg::Geometry::AttributeBinding ab) { SET_BINDING(_colorArray.get(), ab) } -deprecated_osg::Geometry::AttributeBinding deprecated_osg::Geometry::getColorBinding() const { return static_cast(osg::getBinding(getColorArray())); } - -void deprecated_osg::Geometry::setSecondaryColorBinding(deprecated_osg::Geometry::AttributeBinding ab) { SET_BINDING(_secondaryColorArray.get(), ab) } -deprecated_osg::Geometry::AttributeBinding deprecated_osg::Geometry::getSecondaryColorBinding() const { return static_cast(osg::getBinding(getSecondaryColorArray())); } - -void deprecated_osg::Geometry::setFogCoordBinding(deprecated_osg::Geometry::AttributeBinding ab) { SET_BINDING(_fogCoordArray.get(), ab) } -deprecated_osg::Geometry::AttributeBinding deprecated_osg::Geometry::getFogCoordBinding() const { return static_cast(osg::getBinding(getFogCoordArray())); } - - -void deprecated_osg::Geometry::setVertexAttribBinding(unsigned int index,AttributeBinding ab) -{ - if (index<_vertexAttribList.size() && _vertexAttribList[index].valid()) - { - if (_vertexAttribList[index]->getBinding()==static_cast(ab)) return; - - _vertexAttribList[index]->setBinding(static_cast(ab)); - - dirtyDisplayList(); - } - else - { - OSG_NOTICE<<"Warning, can't assign attribute binding as no has been array assigned to set binding for."<(osg::getBinding(getVertexAttribArray(index))); } - -void deprecated_osg::Geometry::setVertexAttribNormalize(unsigned int index,GLboolean norm) -{ - if (index<_vertexAttribList.size() && _vertexAttribList[index].valid()) - { - _vertexAttribList[index]->setNormalize(norm!=GL_FALSE); - - dirtyDisplayList(); - } -} - -GLboolean deprecated_osg::Geometry::getVertexAttribNormalize(unsigned int index) const { return osg::getNormalize(getVertexAttribArray(index)); } - -void deprecated_osg::Geometry::setVertexIndices(osg::IndexArray* array) -{ - if (_vertexArray.valid()) { _vertexArray->setUserData(array); if (array) _containsDeprecatedData = true; } - else { OSG_WARN<<"Geometry::setVertexIndicies(..) function failed as there is no vertex array to associate inidices with."<(_vertexArray->getUserData()); - else return 0; -} - -void deprecated_osg::Geometry::setNormalIndices(osg::IndexArray* array) -{ - if (_normalArray.valid()) { _normalArray->setUserData(array); if (array) _containsDeprecatedData = true; } - else { OSG_WARN<<"Geometry::setNormalIndicies(..) function failed as there is no normal array to associate inidices with."<(_normalArray->getUserData()); - else return 0; -} - -void deprecated_osg::Geometry::setColorIndices(osg::IndexArray* array) -{ - if (_colorArray.valid()) { _colorArray->setUserData(array); if (array) _containsDeprecatedData = true; } - else { OSG_WARN<<"Geometry::setColorIndicies(..) function failed as there is no color array to associate inidices with."<(_colorArray->getUserData()); - else return 0; -} - -void deprecated_osg::Geometry::setSecondaryColorIndices(osg::IndexArray* array) -{ - if (_secondaryColorArray.valid()) { _secondaryColorArray->setUserData(array); if (array) _containsDeprecatedData = true; } - else { OSG_WARN<<"Geometry::setSecondaryColorArray(..) function failed as there is no secondary color array to associate inidices with."<(_secondaryColorArray->getUserData()); - else return 0; -} - -void deprecated_osg::Geometry::setFogCoordIndices(osg::IndexArray* array) -{ - if (_fogCoordArray.valid()) { _fogCoordArray->setUserData(array); if (array) _containsDeprecatedData = true; } - else { OSG_WARN<<"Geometry::setFogCoordIndicies(..) function failed as there is no fog coord array to associate inidices with."<(_fogCoordArray->getUserData()); - else return 0; -} - -void deprecated_osg::Geometry::setTexCoordIndices(unsigned int unit,osg::IndexArray* array) -{ - if (unit<_texCoordList.size() && _texCoordList[unit].valid()) { _texCoordList[unit]->setUserData(array); if (array) _containsDeprecatedData = true; } - else { OSG_WARN<<"Geometry::setTexCoordIndices(..) function failed as there is no texcoord array to associate inidices with."<(_texCoordList[unit]->getUserData()); - else return 0; -} - -void deprecated_osg::Geometry::setVertexAttribIndices(unsigned int index,osg::IndexArray* array) -{ - if (index<_vertexAttribList.size() && _vertexAttribList[index].valid()) { _vertexAttribList[index]->setUserData(array); if (array) _containsDeprecatedData = true; } - else { OSG_WARN<<"Geometry::setVertexAttribIndices(..) function failed as there is no vertex attrib array to associate inidices with."<(_vertexAttribList[index]->getUserData()); - else return 0; -} - - - - - - -