diff --git a/examples/osgimpostor/osgimpostor.cpp b/examples/osgimpostor/osgimpostor.cpp index 35d2dce4e..02fc9239e 100644 --- a/examples/osgimpostor/osgimpostor.cpp +++ b/examples/osgimpostor/osgimpostor.cpp @@ -16,6 +16,8 @@ * THE SOFTWARE. */ +#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 + #include #include #include diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index 8da42229d..36b1c89c6 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -12,7 +12,9 @@ */ #include -// #define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 +//#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS +//#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 +//#endif #include #include @@ -146,11 +148,11 @@ void Geometry::setFogCoordArray(Array* array) if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array); } -#define SET_BINDING(array)\ +#define SET_BINDING(array, ab)\ if (!array) \ { \ + if (ab==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; \ @@ -1095,7 +1097,7 @@ Geometry* osg::createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVe // void Geometry::setNormalBinding(AttributeBinding ab) { - SET_BINDING(_normalArray.get()) + SET_BINDING(_normalArray.get(), ab) dirtyDisplayList(); } @@ -1107,7 +1109,7 @@ Geometry::AttributeBinding Geometry::getNormalBinding() const void Geometry::setColorBinding(AttributeBinding ab) { - SET_BINDING(_colorArray.get()) + SET_BINDING(_colorArray.get(), ab) dirtyDisplayList(); } @@ -1119,7 +1121,7 @@ Geometry::AttributeBinding Geometry::getColorBinding() const void Geometry::setSecondaryColorBinding(AttributeBinding ab) { - SET_BINDING(_secondaryColorArray.get()) + SET_BINDING(_secondaryColorArray.get(), ab) dirtyDisplayList(); } @@ -1131,7 +1133,7 @@ Geometry::AttributeBinding Geometry::getSecondaryColorBinding() const void Geometry::setFogCoordBinding(AttributeBinding ab) { - SET_BINDING(_fogCoordArray.get()) + SET_BINDING(_fogCoordArray.get(), ab) dirtyDisplayList(); } diff --git a/src/osgPlugins/Inventor/ConvertToInventor.cpp b/src/osgPlugins/Inventor/ConvertToInventor.cpp index 3e7f99ae8..40fd35844 100644 --- a/src/osgPlugins/Inventor/ConvertToInventor.cpp +++ b/src/osgPlugins/Inventor/ConvertToInventor.cpp @@ -25,6 +25,9 @@ // but you are not forced to do so. // +#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS +#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 +#endif #include #include diff --git a/src/osgPlugins/ive/Geometry.cpp b/src/osgPlugins/ive/Geometry.cpp index 56893f03c..c1c6fcf63 100644 --- a/src/osgPlugins/ive/Geometry.cpp +++ b/src/osgPlugins/ive/Geometry.cpp @@ -12,7 +12,9 @@ * Copyright 2003 VR-C **********************************************************************/ +#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS #define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 +#endif #include "Exception.h" #include "Geometry.h" diff --git a/src/osgPlugins/md2/ReaderWriterMD2.cpp b/src/osgPlugins/md2/ReaderWriterMD2.cpp index 12a14fd16..ad0d494d6 100644 --- a/src/osgPlugins/md2/ReaderWriterMD2.cpp +++ b/src/osgPlugins/md2/ReaderWriterMD2.cpp @@ -6,6 +6,9 @@ * Author(s): Vladimir Vukicevic * */ +#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS +#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 +#endif #include #include diff --git a/src/osgPlugins/pfb/ConvertFromPerformer.cpp b/src/osgPlugins/pfb/ConvertFromPerformer.cpp index f4dcfdbbc..c2b8d3d25 100644 --- a/src/osgPlugins/pfb/ConvertFromPerformer.cpp +++ b/src/osgPlugins/pfb/ConvertFromPerformer.cpp @@ -1,6 +1,8 @@ // -*-c++-*- +#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS #define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 +#endif #include "ConvertFromPerformer.h" @@ -907,6 +909,9 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* } geom->setColorArray(osg_colors); + + // set the color binding type. + geom->setColorBinding(_gsetBindMap[bind]); } } else @@ -916,9 +921,6 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* bind == PFGS_PER_PRIM ? geoset->getNumPrims() : bind == PFGS_PER_VERTEX ? nv : 0; - // set the normal binding type. - geom->setColorBinding(_gsetBindMap[bind]); - // calc the maximum num of vertex from the index list. int cc; if (ilist) @@ -942,6 +944,10 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* geom->setColorArray(osg_colors); + // set the color binding type. + geom->setColorBinding(_gsetBindMap[bind]); + + if(ilist) { geom->setColorIndices(new osg::UShortArray(nn,ilist)); diff --git a/src/osgPlugins/vrml/ReaderWriterVRML2.h b/src/osgPlugins/vrml/ReaderWriterVRML2.h index d5e6fc835..68eb9e61a 100644 --- a/src/osgPlugins/vrml/ReaderWriterVRML2.h +++ b/src/osgPlugins/vrml/ReaderWriterVRML2.h @@ -21,6 +21,10 @@ #include #include +#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS +#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 +#endif + #include #include diff --git a/src/osgWrappers/deprecated-dotosg/osg/Geometry.cpp b/src/osgWrappers/deprecated-dotosg/osg/Geometry.cpp index fccd6e775..e69118313 100644 --- a/src/osgWrappers/deprecated-dotosg/osg/Geometry.cpp +++ b/src/osgWrappers/deprecated-dotosg/osg/Geometry.cpp @@ -1,4 +1,6 @@ +#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS #define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 +#endif #include #include