Added #define OSG_USE_DEPRECATED_GEOMETRY_METHODS usage into code to allow code to compile enen when CMake configuration has set the #define to off in include/osg/Config.

This commit is contained in:
Robert Osfield 2013-06-18 19:09:33 +00:00
parent b2fa36f02b
commit 297a8a221b
8 changed files with 34 additions and 10 deletions

View File

@ -16,6 +16,8 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/Material> #include <osg/Material>
#include <osg/MatrixTransform> #include <osg/MatrixTransform>

View File

@ -12,7 +12,9 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
//#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
//#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 //#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
//#endif
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/ArrayDispatchers> #include <osg/ArrayDispatchers>
@ -146,11 +148,11 @@ void Geometry::setFogCoordArray(Array* array)
if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array); if (_useVertexBufferObjects && array) addVertexBufferObjectIfRequired(array);
} }
#define SET_BINDING(array)\ #define SET_BINDING(array, ab)\
if (!array) \ 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."<<std::endl; \ OSG_NOTICE<<"Warning, can't assign attribute binding as no has been array assigned to set binding for."<<std::endl; \
abort(); \
return; \ return; \
} \ } \
if (array->getBinding() == static_cast<osg::Array::Binding>(ab)) return; \ if (array->getBinding() == static_cast<osg::Array::Binding>(ab)) return; \
@ -1095,7 +1097,7 @@ Geometry* osg::createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVe
// //
void Geometry::setNormalBinding(AttributeBinding ab) void Geometry::setNormalBinding(AttributeBinding ab)
{ {
SET_BINDING(_normalArray.get()) SET_BINDING(_normalArray.get(), ab)
dirtyDisplayList(); dirtyDisplayList();
} }
@ -1107,7 +1109,7 @@ Geometry::AttributeBinding Geometry::getNormalBinding() const
void Geometry::setColorBinding(AttributeBinding ab) void Geometry::setColorBinding(AttributeBinding ab)
{ {
SET_BINDING(_colorArray.get()) SET_BINDING(_colorArray.get(), ab)
dirtyDisplayList(); dirtyDisplayList();
} }
@ -1119,7 +1121,7 @@ Geometry::AttributeBinding Geometry::getColorBinding() const
void Geometry::setSecondaryColorBinding(AttributeBinding ab) void Geometry::setSecondaryColorBinding(AttributeBinding ab)
{ {
SET_BINDING(_secondaryColorArray.get()) SET_BINDING(_secondaryColorArray.get(), ab)
dirtyDisplayList(); dirtyDisplayList();
} }
@ -1131,7 +1133,7 @@ Geometry::AttributeBinding Geometry::getSecondaryColorBinding() const
void Geometry::setFogCoordBinding(AttributeBinding ab) void Geometry::setFogCoordBinding(AttributeBinding ab)
{ {
SET_BINDING(_fogCoordArray.get()) SET_BINDING(_fogCoordArray.get(), ab)
dirtyDisplayList(); dirtyDisplayList();
} }

View File

@ -25,6 +25,9 @@
// but you are not forced to do so. // but you are not forced to do so.
// //
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include <osg/BlendFunc> #include <osg/BlendFunc>
#include <osg/Billboard> #include <osg/Billboard>

View File

@ -12,7 +12,9 @@
* Copyright 2003 VR-C * Copyright 2003 VR-C
**********************************************************************/ **********************************************************************/
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 #define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include "Exception.h" #include "Exception.h"
#include "Geometry.h" #include "Geometry.h"

View File

@ -6,6 +6,9 @@
* Author(s): Vladimir Vukicevic <vladimir@pobox.com> * Author(s): Vladimir Vukicevic <vladimir@pobox.com>
* *
*/ */
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include <osg/TexEnv> #include <osg/TexEnv>
#include <osg/CullFace> #include <osg/CullFace>

View File

@ -1,6 +1,8 @@
// -*-c++-*- // -*-c++-*-
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 #define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include "ConvertFromPerformer.h" #include "ConvertFromPerformer.h"
@ -907,6 +909,9 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet*
} }
geom->setColorArray(osg_colors); geom->setColorArray(osg_colors);
// set the color binding type.
geom->setColorBinding(_gsetBindMap[bind]);
} }
} }
else else
@ -916,9 +921,6 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet*
bind == PFGS_PER_PRIM ? geoset->getNumPrims() : bind == PFGS_PER_PRIM ? geoset->getNumPrims() :
bind == PFGS_PER_VERTEX ? nv : 0; 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. // calc the maximum num of vertex from the index list.
int cc; int cc;
if (ilist) if (ilist)
@ -942,6 +944,10 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet*
geom->setColorArray(osg_colors); geom->setColorArray(osg_colors);
// set the color binding type.
geom->setColorBinding(_gsetBindMap[bind]);
if(ilist) if(ilist)
{ {
geom->setColorIndices(new osg::UShortArray(nn,ilist)); geom->setColorIndices(new osg::UShortArray(nn,ilist));

View File

@ -21,6 +21,10 @@
#include <string> #include <string>
#include <map> #include <map>
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include <osg/Node> #include <osg/Node>
#include <osg/Geometry> #include <osg/Geometry>

View File

@ -1,4 +1,6 @@
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 #define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/Notify> #include <osg/Notify>