With assistance from Sukender, moved the depreacted osg::Geometry vertex indices and AttributeBinding definitions out into a separated namespace/class so to use

deprecated features you should now use deprecated_osg::Geometry in place of osg::Geometry.
This commit is contained in:
Robert Osfield 2013-06-25 16:10:24 +00:00
parent ceb97fe230
commit 1793466442
26 changed files with 479 additions and 494 deletions

View File

@ -470,8 +470,6 @@ OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixe
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON) OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
OPTION(OSG_USE_DEPRECATED_GEOMETRY_METHODS "Set to ON to enable use of deprecated osg::Geometry functions." ON)
################################################################################ ################################################################################
# Set Config file # Set Config file

View File

@ -22,11 +22,6 @@
* exist in the triangulation. * exist in the triangulation.
*/ */
#include <osg/Config>
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include <osgDB/ReadFile> #include <osgDB/ReadFile>
#include <osgUtil/Optimizer> #include <osgUtil/Optimizer>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
@ -50,21 +45,21 @@
class WallConstraint: public osgUtil::DelaunayConstraint { // forces lines to eb edge class WallConstraint: public osgUtil::DelaunayConstraint { // forces lines to eb edge
// wall constraint - can generate a wall at the coordinates of the constraint // wall constraint - can generate a wall at the coordinates of the constraint
public: public:
/** if you derive a class from DelaunayConstraint then you can create /** if you derive a class from DelaunayConstraint then you can create
* a specific geometry creation routine. * a specific geometry creation routine.
*/ */
WallConstraint() : height(0), txxrepWall(10), txyrepWall(10) { } WallConstraint() : height(0), txxrepWall(10), txyrepWall(10) { }
/** or create a wall around the constraint area: */ /** or create a wall around the constraint area: */
virtual osg::Geometry * makeWallGeometry(void) const; virtual osg::Geometry * makeWallGeometry(void) const;
/** for basic purposes, you can call these routines to make simple fill in geometries */ /** for basic purposes, you can call these routines to make simple fill in geometries */
virtual osg::DrawArrays* makeWall(void ) const { // build a wall height high around the constraint virtual osg::DrawArrays* makeWall(void ) const { // build a wall height high around the constraint
const osg::Vec3Array *_line= dynamic_cast<const osg::Vec3Array*>(getVertexArray()); const osg::Vec3Array *_line= dynamic_cast<const osg::Vec3Array*>(getVertexArray());
return (new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2*_line->size())); return (new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2*_line->size()));
} }
virtual osg::Vec3Array *getWall(const float height) const; virtual osg::Vec3Array *getWall(const float height) const;
virtual osg::Vec2Array *getWallTexcoords(const float height) const; virtual osg::Vec2Array *getWallTexcoords(const float height) const;
virtual osg::Vec3Array *getWallNormals(void) const { virtual osg::Vec3Array *getWallNormals(void) const {
@ -72,7 +67,7 @@ public:
const osg::Vec3Array *vertices= dynamic_cast<const osg::Vec3Array*>(getVertexArray()); const osg::Vec3Array *vertices= dynamic_cast<const osg::Vec3Array*>(getVertexArray());
for (unsigned int ipr=0; ipr<getNumPrimitiveSets(); ipr++) { for (unsigned int ipr=0; ipr<getNumPrimitiveSets(); ipr++) {
const osg::PrimitiveSet* prset=getPrimitiveSet(ipr); const osg::PrimitiveSet* prset=getPrimitiveSet(ipr);
if (prset->getMode()==osg::PrimitiveSet::LINE_LOOP || if (prset->getMode()==osg::PrimitiveSet::LINE_LOOP ||
prset->getMode()==osg::PrimitiveSet::LINE_STRIP) { // loops and walls prset->getMode()==osg::PrimitiveSet::LINE_STRIP) { // loops and walls
// start with the last point on the loop // start with the last point on the loop
osg::Vec3 prevp=(*vertices)[prset->index (prset->getNumIndices()-1)]; osg::Vec3 prevp=(*vertices)[prset->index (prset->getNumIndices()-1)];
@ -93,12 +88,12 @@ public:
} }
return nrms.release(); return nrms.release();
} }
// geometry creation parameters // geometry creation parameters
void setWallTexrep(const float w,const float h) { txxrepWall=w;txyrepWall=h;} void setWallTexrep(const float w,const float h) { txxrepWall=w;txyrepWall=h;}
/** Wall Geometry will return with this texture applied: */ /** Wall Geometry will return with this texture applied: */
void setTexture(const char *tx) { texture=tx;} void setTexture(const char *tx) { texture=tx;}
/** fence/wall height */ /** fence/wall height */
@ -111,18 +106,18 @@ protected:
class ArealConstraint: public osgUtil::DelaunayConstraint { // forces edges of an area to fit triangles class ArealConstraint: public osgUtil::DelaunayConstraint { // forces edges of an area to fit triangles
// areal constraint - general nonuniform field, forest, lake etc. // areal constraint - general nonuniform field, forest, lake etc.
public: public:
/** if you derive a class from DelaunayConstraint then you can create /** if you derive a class from DelaunayConstraint then you can create
* a specific geometry creation routine. * a specific geometry creation routine.
*/ */
ArealConstraint() : txxrepArea(10), txyrepArea(10),txxrepWall(10), txyrepWall(10) { } ArealConstraint() : txxrepArea(10), txyrepArea(10),txxrepWall(10), txyrepWall(10) { }
/** return a geometry that fills the constraint. /** return a geometry that fills the constraint.
*/ */
virtual osg::Geometry * makeAreal( osg::Vec3Array *points); virtual deprecated_osg::Geometry * makeAreal( osg::Vec3Array *points);
/** or create a wall around the constraint area: */ /** or create a wall around the constraint area: */
virtual osg::Geometry * makeWallGeometry( osg::Vec3Array *points) ; virtual deprecated_osg::Geometry * makeWallGeometry( osg::Vec3Array *points) ;
/** for basic purposes, you can call these routines to make simple fill in geometries */ /** for basic purposes, you can call these routines to make simple fill in geometries */
virtual osg::DrawArrays* makeWall(void ) const; virtual osg::DrawArrays* makeWall(void ) const;
virtual osg::Vec3Array *getWall(const float height) const; virtual osg::Vec3Array *getWall(const float height) const;
@ -134,7 +129,7 @@ public:
virtual osg::Vec3Array *getCanopy(const osg::Vec3Array *points,const float height) const; virtual osg::Vec3Array *getCanopy(const osg::Vec3Array *points,const float height) const;
virtual osg::Vec2Array *getCanopyTexcoords(const osg::Vec3Array *points) const; virtual osg::Vec2Array *getCanopyTexcoords(const osg::Vec3Array *points) const;
virtual osg::Vec3Array *getCanopyNormals(const osg::Vec3Array *points) const; virtual osg::Vec3Array *getCanopyNormals(const osg::Vec3Array *points) const;
// geometry creation parameters // geometry creation parameters
void setTexrep(const float w,const float h) { txxrepArea=w;txyrepArea=h;} void setTexrep(const float w,const float h) { txxrepArea=w;txyrepArea=h;}
void setWallTexrep(const float w,const float h) { txxrepWall=w;txyrepWall=h;} void setWallTexrep(const float w,const float h) { txxrepWall=w;txyrepWall=h;}
@ -152,39 +147,39 @@ protected:
float txxrepWall, txyrepWall; float txxrepWall, txyrepWall;
}; };
class LinearConstraint: public osgUtil::DelaunayConstraint { class LinearConstraint: public osgUtil::DelaunayConstraint {
/** forces edges of a "road" to fit triangles /** forces edges of a "road" to fit triangles
* if 2 roads cross, then the overlap will be replaced by a 'cross road' * if 2 roads cross, then the overlap will be replaced by a 'cross road'
* and the roads built up to the cross roads with a texture along its length. */ * and the roads built up to the cross roads with a texture along its length. */
public: public:
LinearConstraint() : osgUtil::DelaunayConstraint(), txxrepAlong(10), txyrepAcross(10), width(2) { } LinearConstraint() : osgUtil::DelaunayConstraint(), txxrepAlong(10), txyrepAcross(10), width(2) { }
/** geometry creation parameters */ /** geometry creation parameters */
/* Width of linear feature (eg road, railway) */ /* Width of linear feature (eg road, railway) */
void setWidth(const float w) { width=w;} void setWidth(const float w) { width=w;}
/** Texture repeat distance across linear (often equal to width) and along its length */ /** Texture repeat distance across linear (often equal to width) and along its length */
virtual void setTexrep(const float w,const float h) { txyrepAcross=h;txxrepAlong=w; } virtual void setTexrep(const float w,const float h) { txyrepAcross=h;txxrepAlong=w; }
/** generate constant width around line - creates the area to be cut into the terrain. */ /** generate constant width around line - creates the area to be cut into the terrain. */
virtual void setVertices( osg::Vec3Array *lp, const float width); virtual void setVertices( osg::Vec3Array *lp, const float width);
/** return a geometry that fills the constraint. /** return a geometry that fills the constraint.
*/ */
virtual osg::Geometry *makeGeometry(const osg::Vec3Array *points) ; virtual deprecated_osg::Geometry *makeGeometry(const osg::Vec3Array *points) ;
/** return normals array - flat shaded */ /** return normals array - flat shaded */
osg::Vec3Array* getNormals(const osg::Vec3Array *points); osg::Vec3Array* getNormals(const osg::Vec3Array *points);
/** Roads apply a texture proportional to length along the road line. */ /** Roads apply a texture proportional to length along the road line. */
virtual osg::DrawArrays* makeRoad( ) const; virtual osg::DrawArrays* makeRoad( ) const;
virtual osg::Vec3Array *getRoadVertices() const; virtual osg::Vec3Array *getRoadVertices() const;
virtual osg::Vec2Array *getRoadTexcoords(const osg::Vec3Array *points) ; virtual osg::Vec2Array *getRoadTexcoords(const osg::Vec3Array *points) ;
virtual osg::Vec3Array *getRoadNormals(const osg::Vec3Array *points) const; virtual osg::Vec3Array *getRoadNormals(const osg::Vec3Array *points) const;
/** Geometry will return with this texture applied: */ /** Geometry will return with this texture applied: */
void setTexture(const char *tx) { texture=tx;} void setTexture(const char *tx) { texture=tx;}
protected: protected:
osg::ref_ptr<osg::Vec2Array> _tcoords; osg::ref_ptr<osg::Vec2Array> _tcoords;
osg::ref_ptr<osg::Vec3Array> _edgecoords; osg::ref_ptr<osg::Vec3Array> _edgecoords;
@ -201,19 +196,19 @@ class pyramid : public osgUtil::DelaunayConstraint {
* geometry of an Egyptian pyramid to fit the hole. */ * geometry of an Egyptian pyramid to fit the hole. */
public: public:
pyramid() : _side(100.) {} pyramid() : _side(100.) {}
void setpos(const osg::Vec3 p, const float size) { _pos=p;_side=size;} void setpos(const osg::Vec3 p, const float size) { _pos=p;_side=size;}
virtual osg::Geometry * makeGeometry(void) const virtual osg::Geometry * makeGeometry(void) const
{ {
// create pyramid geometry. Centre plus points around base // create pyramid geometry. Centre plus points around base
const osg::Vec3Array *_line= dynamic_cast<const osg::Vec3Array*>(getVertexArray()); const osg::Vec3Array *_line= dynamic_cast<const osg::Vec3Array*>(getVertexArray());
osg::Geometry *gm=new osg::Geometry; deprecated_osg::Geometry *gm=new deprecated_osg::Geometry;
osg::Vec3Array *pts=new osg::Vec3Array; osg::Vec3Array *pts=new osg::Vec3Array;
osg::Vec3Array *norms=new osg::Vec3Array; osg::Vec3Array *norms=new osg::Vec3Array;
osg::Vec2Array *tcoords=new osg::Vec2Array; osg::Vec2Array *tcoords=new osg::Vec2Array;
int ip; int ip;
pts->push_back(_pos+osg::Vec3(0,0,_side)*0.5); pts->push_back(_pos+osg::Vec3(0,0,_side)*0.5);
for (ip=0; ip<4; ip++) { for (ip=0; ip<4; ip++) {
pts->push_back((*_line)[ip]); pts->push_back((*_line)[ip]);
@ -223,12 +218,12 @@ public:
nrm.normalize( ); nrm.normalize( );
norms->push_back(nrm); norms->push_back(nrm);
} }
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE); gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
gm->setVertexArray(pts); gm->setVertexArray(pts);
osg::StateSet *dstate= gm->getOrCreateStateSet( ); osg::StateSet *dstate= gm->getOrCreateStateSet( );
dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON ); dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON );
osg::Image* image = osgDB::readImageFile("Images/Brick-Std-Orange.TGA"); osg::Image* image = osgDB::readImageFile("Images/Brick-Std-Orange.TGA");
if (image) if (image)
{ {
@ -288,66 +283,66 @@ osg::Vec3d getpt(const int np)
osg::Node* createHUD(const int ndcs,std::string what) osg::Node* createHUD(const int ndcs,std::string what)
{ // add a string reporting the type of winding rule tessellation applied { // add a string reporting the type of winding rule tessellation applied
osg::Geode* geode = new osg::Geode(); osg::Geode* geode = new osg::Geode();
std::string timesFont("fonts/arial.ttf"); std::string timesFont("fonts/arial.ttf");
// turn lighting off for the text and disable depth test to ensure its always ontop. // turn lighting off for the text and disable depth test to ensure its always ontop.
osg::StateSet* stateset = geode->getOrCreateStateSet(); osg::StateSet* stateset = geode->getOrCreateStateSet();
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF); stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
// Disable depth test, and make sure that the hud is drawn after everything // Disable depth test, and make sure that the hud is drawn after everything
// else so that it always appears ontop. // else so that it always appears ontop.
stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
stateset->setRenderBinDetails(11,"RenderBin"); stateset->setRenderBinDetails(11,"RenderBin");
osg::Vec3 position(50.0f,900.0f,0.0f); osg::Vec3 position(50.0f,900.0f,0.0f);
osg::Vec3 delta(0.0f,-35.0f,0.0f); osg::Vec3 delta(0.0f,-35.0f,0.0f);
{ {
osgText::Text* text = new osgText::Text; osgText::Text* text = new osgText::Text;
geode->addDrawable( text ); geode->addDrawable( text );
std::ostringstream cue; std::ostringstream cue;
cue<<"Delaunay triangulation with constraints level "<<ndcs <<"\n"<< what; cue<<"Delaunay triangulation with constraints level "<<ndcs <<"\n"<< what;
text->setFont(timesFont); text->setFont(timesFont);
text->setPosition(position); text->setPosition(position);
text->setText(cue.str()); text->setText(cue.str());
text->setColor(osg::Vec4(1.0,1.0,0.8,1.0)); text->setColor(osg::Vec4(1.0,1.0,0.8,1.0));
position += delta*(ndcs+2); position += delta*(ndcs+2);
#if 0 #if 0
text = new osgText::Text; text = new osgText::Text;
geode->addDrawable( text ); geode->addDrawable( text );
text->setFont(timesFont); text->setFont(timesFont);
text->setPosition(position); text->setPosition(position);
text->setText("(use 'W' wireframe & 'T' texture to visualise mesh)"); text->setText("(use 'W' wireframe & 'T' texture to visualise mesh)");
text->setColor(osg::Vec4(1.0,1.0,0.8,1.0)); text->setColor(osg::Vec4(1.0,1.0,0.8,1.0));
position += delta; position += delta;
#endif #endif
} }
{ {
osgText::Text* text = new osgText::Text; osgText::Text* text = new osgText::Text;
geode->addDrawable( text ); geode->addDrawable( text );
text->setFont(timesFont); text->setFont(timesFont);
text->setPosition(position); text->setPosition(position);
text->setText("Press 'n' to add another constraint."); text->setText("Press 'n' to add another constraint.");
} }
// create the hud. // create the hud.
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform; osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF); modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
modelview_abs->setMatrix(osg::Matrix::identity()); modelview_abs->setMatrix(osg::Matrix::identity());
modelview_abs->addChild(geode); modelview_abs->addChild(geode);
osg::Projection* projection = new osg::Projection; osg::Projection* projection = new osg::Projection;
projection->setMatrix(osg::Matrix::ortho2D(0,1280,0,1024)); projection->setMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
projection->addChild(modelview_abs); projection->addChild(modelview_abs);
return projection; return projection;
} }
osg::Group *makedelaunay(const int ndcs) osg::Group *makedelaunay(const int ndcs)
{ // create a terrain tile. This is just an example! { // create a terrain tile. This is just an example!
@ -356,9 +351,9 @@ osg::Group *makedelaunay(const int ndcs)
osg::ref_ptr<osg::Geode> geode=new osg::Geode; osg::ref_ptr<osg::Geode> geode=new osg::Geode;
osg::ref_ptr<osgUtil::DelaunayTriangulator> trig=new osgUtil::DelaunayTriangulator(); osg::ref_ptr<osgUtil::DelaunayTriangulator> trig=new osgUtil::DelaunayTriangulator();
osg::StateSet *stateset=geode->getOrCreateStateSet(); osg::StateSet *stateset=geode->getOrCreateStateSet();
osg::Vec3Array *points=new osg::Vec3Array; osg::Vec3Array *points=new osg::Vec3Array;
osg::Image* image = osgDB::readImageFile("Images/blueFlowers.png"); osg::Image* image = osgDB::readImageFile("Images/blueFlowers.png");
if (image) if (image)
{ {
@ -368,10 +363,10 @@ osg::Group *makedelaunay(const int ndcs)
texture->setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::REPEAT ); texture->setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::REPEAT );
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
} }
geode->setStateSet( stateset ); geode->setStateSet( stateset );
unsigned int i; unsigned int i;
int eod=0; int eod=0;
while (eod>=0) { while (eod>=0) {
osg::Vec3d pos=getpt(eod); osg::Vec3d pos=getpt(eod);
@ -405,7 +400,7 @@ osg::Group *makedelaunay(const int ndcs)
} }
dc->setVertexArray(bounds); dc->setVertexArray(bounds);
dc->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP,0,nmax) ); dc->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP,0,nmax) );
trig->addInputConstraint(dc.get()); trig->addInputConstraint(dc.get());
what << nmax << " point simple constraint\n"; what << nmax << " point simple constraint\n";
} }
@ -431,10 +426,10 @@ osg::Group *makedelaunay(const int ndcs)
} }
dc->setVertexArray(bounds); dc->setVertexArray(bounds);
dc->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,12) ); dc->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,12) );
trig->addInputConstraint(dc.get()); trig->addInputConstraint(dc.get());
what << 12 << " point closed loop"; what << 12 << " point closed loop";
if (ndcs>2) { if (ndcs>2) {
wc=new WallConstraint; // This example does not remove the interior wc=new WallConstraint; // This example does not remove the interior
// eg to force terrain edges that are on ridges in the terrain etc. // eg to force terrain edges that are on ridges in the terrain etc.
@ -452,7 +447,7 @@ osg::Group *makedelaunay(const int ndcs)
trig->addInputConstraint(wc.get()); trig->addInputConstraint(wc.get());
what << " with interior removed\n"; what << " with interior removed\n";
what << 5 << " point wall derived constraint\n"; what << 5 << " point wall derived constraint\n";
if (ndcs>3) { if (ndcs>3) {
// add a removed area and replace it with a different texture // add a removed area and replace it with a different texture
dc2=new ArealConstraint; dc2=new ArealConstraint;
@ -466,7 +461,7 @@ osg::Group *makedelaunay(const int ndcs)
dc2->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,18) ); dc2->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,18) );
trig->addInputConstraint(dc2.get()); trig->addInputConstraint(dc2.get());
what << 18 << " point area replaced\n"; what << 18 << " point area replaced\n";
if (ndcs>4) { if (ndcs>4) {
dc3=new LinearConstraint; dc3=new LinearConstraint;
// a linear feature or 'road' // a linear feature or 'road'
@ -500,7 +495,7 @@ osg::Group *makedelaunay(const int ndcs)
forest->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,12) ); forest->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,12) );
if (ndcs==6) trig->addInputConstraint(forest.get()); if (ndcs==6) trig->addInputConstraint(forest.get());
what << 12 << " point forest constraint\n"; what << 12 << " point forest constraint\n";
if (ndcs>6) { // add roads that intersect forest if (ndcs>6) { // add roads that intersect forest
osg::ref_ptr<osgUtil::DelaunayConstraint> forestplus=new osgUtil::DelaunayConstraint; osg::ref_ptr<osgUtil::DelaunayConstraint> forestplus=new osgUtil::DelaunayConstraint;
forestroad=new LinearConstraint; forestroad=new LinearConstraint;
@ -610,17 +605,17 @@ osg::Group *makedelaunay(const int ndcs)
} }
} // ndcs>0 } // ndcs>0
trig->setInputPointArray(points); trig->setInputPointArray(points);
/** NB you need to supply a vec3 array for the triangulator to calculate normals into */ /** NB you need to supply a vec3 array for the triangulator to calculate normals into */
osg::Vec3Array *norms=new osg::Vec3Array; osg::Vec3Array *norms=new osg::Vec3Array;
trig->setOutputNormalArray(norms); trig->setOutputNormalArray(norms);
trig->triangulate(); trig->triangulate();
osg::notify(osg::WARN) << " End of trig\n " <<std::endl; osg::notify(osg::WARN) << " End of trig\n " <<std::endl;
// Calculate the texture coordinates after triangulation as // Calculate the texture coordinates after triangulation as
//the points may get disordered by the triangulate function //the points may get disordered by the triangulate function
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; osg::ref_ptr<deprecated_osg::Geometry> gm=new deprecated_osg::Geometry;
gm->setVertexArray(points); // points may have been modified in order by triangulation. gm->setVertexArray(points); // points may have been modified in order by triangulation.
/** calculate texture coords for terrain points */ /** calculate texture coords for terrain points */
if (image) { if (image) {
@ -634,17 +629,17 @@ osg::Group *makedelaunay(const int ndcs)
} }
gm->addPrimitiveSet(trig->getTriangles()); gm->addPrimitiveSet(trig->getTriangles());
gm->setNormalArray(trig->getOutputNormalArray()); gm->setNormalArray(trig->getOutputNormalArray());
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE); gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
geode->addDrawable(gm.get()); geode->addDrawable(gm.get());
if (ndcs>0) { if (ndcs>0) {
for ( std::vector < pyramid* >::iterator itr=pyrlist.begin(); itr!=pyrlist.end(); itr++) { for ( std::vector < pyramid* >::iterator itr=pyrlist.begin(); itr!=pyrlist.end(); itr++) {
trig->removeInternalTriangles(*itr); trig->removeInternalTriangles(*itr);
geode->addDrawable((*itr)->makeGeometry()); // this fills the holes of each pyramid with geometry geode->addDrawable((*itr)->makeGeometry()); // this fills the holes of each pyramid with geometry
} }
if (ndcs>2) { if (ndcs>2) {
trig->removeInternalTriangles(dc.get()); trig->removeInternalTriangles(dc.get());
wc->setTexture("Images/Brick-Norman-Brown.TGA"); // wall looks like brick wc->setTexture("Images/Brick-Norman-Brown.TGA"); // wall looks like brick
geode->addDrawable(wc->makeWallGeometry()); // this creates wall at wc drawarrays geode->addDrawable(wc->makeWallGeometry()); // this creates wall at wc drawarrays
if (ndcs>3) { if (ndcs>3) {
@ -652,13 +647,13 @@ osg::Group *makedelaunay(const int ndcs)
osg::ref_ptr<osg::Vec3Array> arpts=dc2->getPoints(points); osg::ref_ptr<osg::Vec3Array> arpts=dc2->getPoints(points);
dc2->setTexture("Images/purpleFlowers.png"); dc2->setTexture("Images/purpleFlowers.png");
geode->addDrawable(dc2->makeAreal(arpts.get())); // this creates fill in geometry geode->addDrawable(dc2->makeAreal(arpts.get())); // this creates fill in geometry
if (ndcs>4) { // a simple "road" if (ndcs>4) { // a simple "road"
trig->removeInternalTriangles(dc3.get()); trig->removeInternalTriangles(dc3.get());
dc3->setTexture ("Images/road.png"); dc3->setTexture ("Images/road.png");
dc3->setTexrep(40,9.5); // texture is repeated at this frequency dc3->setTexrep(40,9.5); // texture is repeated at this frequency
geode->addDrawable(dc3->makeGeometry(points)); // this creates road geometry geode->addDrawable(dc3->makeGeometry(points)); // this creates road geometry
if (ndcs>5) { if (ndcs>5) {
if (ndcs>6) { // road & forest overlap - order of removal is important if (ndcs>6) { // road & forest overlap - order of removal is important
trig->removeInternalTriangles(forestroad.get()); trig->removeInternalTriangles(forestroad.get());
@ -666,11 +661,11 @@ osg::Group *makedelaunay(const int ndcs)
trig->removeInternalTriangles(forestroad3.get()); trig->removeInternalTriangles(forestroad3.get());
} }
trig->removeInternalTriangles(forest.get()); trig->removeInternalTriangles(forest.get());
forest->setTexture("Images/forestRoof.png"); forest->setTexture("Images/forestRoof.png");
osg::ref_ptr<osg::Vec3Array> locpts=forest->getPoints(points); osg::ref_ptr<osg::Vec3Array> locpts=forest->getPoints(points);
geode->addDrawable(forest->makeAreal(locpts.get())); geode->addDrawable(forest->makeAreal(locpts.get()));
forest->setWallTexture("Images/forestWall.png"); forest->setWallTexture("Images/forestWall.png");
geode->addDrawable(forest->makeWallGeometry(locpts.get()) ); geode->addDrawable(forest->makeWallGeometry(locpts.get()) );
for (osg::Vec3Array::iterator vit=(*locpts).begin(); vit!=(*locpts).end(); vit++) { for (osg::Vec3Array::iterator vit=(*locpts).begin(); vit!=(*locpts).end(); vit++) {
(*vit)+=osg::Vec3(0,0,30); (*vit)+=osg::Vec3(0,0,30);
@ -718,10 +713,10 @@ osg::Group *makedelaunay(const int ndcs)
class KeyboardEventHandler : public osgGA::GUIEventHandler class KeyboardEventHandler : public osgGA::GUIEventHandler
{ // extra event handler traps 'n' key to re-triangulate the basic terrain. { // extra event handler traps 'n' key to re-triangulate the basic terrain.
public: public:
KeyboardEventHandler(osgViewer::Viewer &vr): KeyboardEventHandler(osgViewer::Viewer &vr):
viewer(vr), iview(0) {} viewer(vr), iview(0) {}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&) virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{ {
switch(ea.getEventType()) switch(ea.getEventType())
@ -743,7 +738,7 @@ public:
} }
return false; return false;
} }
osgViewer::Viewer &viewer; osgViewer::Viewer &viewer;
int iview; int iview;
}; };
@ -791,11 +786,11 @@ osg::Vec2Array * WallConstraint::getWallTexcoords(const float height) const
} }
const osg::Vec3 curp=(*vertices)[prset->index (0)]; const osg::Vec3 curp=(*vertices)[prset->index (0)];
circumference+=(curp-prevp).length(); circumference+=(curp-prevp).length();
int nround=(int)(circumference/txxrepWall); int nround=(int)(circumference/txxrepWall);
if (nround<1) nround=1; // at least one repeat. if (nround<1) nround=1; // at least one repeat.
texrepRound=circumference/nround; texrepRound=circumference/nround;
float ds=0; float ds=0;
prevp=(*vertices)[prset->index (prset->getNumIndices()-1)]; prevp=(*vertices)[prset->index (prset->getNumIndices()-1)];
if (tcoords) { if (tcoords) {
@ -814,7 +809,7 @@ osg::Vec2Array * WallConstraint::getWallTexcoords(const float height) const
tcoords->push_back(tci); tcoords->push_back(tci);
} }
} // per primitiveset } // per primitiveset
} }
return tcoords; return tcoords;
} }
@ -843,7 +838,7 @@ osg::Geometry *WallConstraint::makeWallGeometry() const
gm->setTexCoordArray(0,getWallTexcoords(height)); gm->setTexCoordArray(0,getWallTexcoords(height));
gm->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); gm->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
gm->setNormalArray(getWallNormals()); // this creates normals to walls gm->setNormalArray(getWallNormals()); // this creates normals to walls
return gm.release(); return gm.release();
} }
@ -918,11 +913,11 @@ osg::Vec2Array * ArealConstraint::getWallTexcoords(const float height) const
} }
const osg::Vec3 curp=(*vertices)[prset->index (0)]; const osg::Vec3 curp=(*vertices)[prset->index (0)];
circumference+=(curp-prevp).length(); circumference+=(curp-prevp).length();
int nround=(int)(circumference/txxrepWall); int nround=(int)(circumference/txxrepWall);
if (nround<1) nround=1; // at least one repeat. if (nround<1) nround=1; // at least one repeat.
texrepRound=circumference/nround; texrepRound=circumference/nround;
float ds=0; float ds=0;
prevp=(*vertices)[prset->index (prset->getNumIndices()-1)]; prevp=(*vertices)[prset->index (prset->getNumIndices()-1)];
if (tcoords) { if (tcoords) {
@ -993,23 +988,23 @@ osg::DrawArrays * ArealConstraint::makeWall(void) const
return (new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2+2*_line->size())); return (new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2+2*_line->size()));
} }
osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt) deprecated_osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
{ {
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the wall osg::ref_ptr<deprecated_osg::Geometry> gm=new deprecated_osg::Geometry; // the wall
osg::ref_ptr<osg::Geometry> edges=new osg::Geometry; // edges of bounds osg::ref_ptr<deprecated_osg::Geometry> edges=new deprecated_osg::Geometry; // edges of bounds
edges->setVertexArray(pt); edges->setVertexArray(pt);
osg::DrawElementsUInt *trgeom=getTriangles(); osg::DrawElementsUInt *trgeom=getTriangles();
edges->addPrimitiveSet(trgeom); edges->addPrimitiveSet(trgeom);
osg::ref_ptr<osgUtil::Tessellator> tscx=new osgUtil::Tessellator; // this assembles all the constraints osg::ref_ptr<osgUtil::Tessellator> tscx=new osgUtil::Tessellator; // this assembles all the constraints
tscx->setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY); tscx->setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY);
tscx->setBoundaryOnly(true); tscx->setBoundaryOnly(true);
tscx->setWindingType( osgUtil::Tessellator::TESS_WINDING_NONZERO); tscx->setWindingType( osgUtil::Tessellator::TESS_WINDING_NONZERO);
// find all edges. // find all edges.
const osg::Vec3Array *points=dynamic_cast<osg::Vec3Array*>(getVertexArray()); const osg::Vec3Array *points=dynamic_cast<osg::Vec3Array*>(getVertexArray());
tscx->retessellatePolygons(*(edges)); // find all edges tscx->retessellatePolygons(*(edges)); // find all edges
if (walltexture!="") { if (walltexture!="") {
osg::Image* image = osgDB::readImageFile(walltexture.c_str()); osg::Image* image = osgDB::readImageFile(walltexture.c_str());
if (image) if (image)
@ -1052,21 +1047,21 @@ osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
nstart+=2+2*pr->getNumIndices(); nstart+=2+2*pr->getNumIndices();
} }
} }
return gm.release(); return gm.release();
} }
osg::Geometry * ArealConstraint::makeAreal( osg::Vec3Array *points) deprecated_osg::Geometry * ArealConstraint::makeAreal( osg::Vec3Array *points)
{ {
osg::ref_ptr<osg::Geometry> gm; // the fill in area osg::ref_ptr<deprecated_osg::Geometry> gm; // the fill in area
if (_interiorTris.size()>0) { if (_interiorTris.size()>0) {
gm =new osg::Geometry; // the forest roof gm =new deprecated_osg::Geometry; // the forest roof
gm->setVertexArray(points); gm->setVertexArray(points);
osg::DrawElementsUInt *trgeom=getTriangles(); osg::DrawElementsUInt *trgeom=getTriangles();
gm->addPrimitiveSet(trgeom); gm->addPrimitiveSet(trgeom);
gm->setNormalArray(getCanopyNormals(points)); gm->setNormalArray(getCanopyNormals(points));
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE); gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
gm->setTexCoordArray(0,getCanopyTexcoords(points)); gm->setTexCoordArray(0,getCanopyTexcoords(points));
osg::Image* image = osgDB::readImageFile(texture); osg::Image* image = osgDB::readImageFile(texture);
if (image) if (image)
@ -1099,7 +1094,7 @@ void LinearConstraint::setVertices( osg::Vec3Array *lp, const float w)
for(unsigned int i=0;i<lp->size();i++) { for(unsigned int i=0;i<lp->size();i++) {
osg::Vec3 valong; osg::Vec3 valong;
osg::Vec3 pos[2]; osg::Vec3 pos[2];
if (i==0) { if (i==0) {
valong=(*lp)[i+1]-(*lp)[i]; valong=(*lp)[i+1]-(*lp)[i];
} else if (i==lp->size()-1) { } else if (i==lp->size()-1) {
@ -1126,7 +1121,7 @@ void LinearConstraint::setVertices( osg::Vec3Array *lp, const float w)
osg::DrawArrays* LinearConstraint::makeRoad(void ) const osg::DrawArrays* LinearConstraint::makeRoad(void ) const
{ {
return new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2*_midline->size()); return new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2*_midline->size());
} }
osg::Vec3Array *LinearConstraint::getRoadNormals(const osg::Vec3Array* /*points*/) const osg::Vec3Array *LinearConstraint::getRoadNormals(const osg::Vec3Array* /*points*/) const
@ -1204,7 +1199,7 @@ osg::Vec2Array *LinearConstraint::getRoadTexcoords(const osg::Vec3Array *points)
ptfound=true; ptfound=true;
} }
ibm1=ib; ibm1=ib;
ib++; ib++;
pminus=(*vit); pminus=(*vit);
} }
} }
@ -1224,7 +1219,7 @@ osg::Vec2Array *LinearConstraint::getRoadTexcoords(const osg::Vec3Array *points)
} }
return tcoords.release(); return tcoords.release();
} }
osg::Vec3Array * LinearConstraint::getNormals(const osg::Vec3Array *points) osg::Vec3Array * LinearConstraint::getNormals(const osg::Vec3Array *points)
{ {
osg::ref_ptr<osg::Vec3Array> norms=new osg::Vec3Array; osg::ref_ptr<osg::Vec3Array> norms=new osg::Vec3Array;
for (osg::DrawElementsUInt::iterator uiitr=prim_tris_->begin(); uiitr!=prim_tris_->end();uiitr+=3) { for (osg::DrawElementsUInt::iterator uiitr=prim_tris_->begin(); uiitr!=prim_tris_->end();uiitr+=3) {
@ -1238,9 +1233,9 @@ osg::Vec3Array * LinearConstraint::getNormals(const osg::Vec3Array *points)
return norms.release(); return norms.release();
} }
osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *points) deprecated_osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *points)
{ {
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the fill in road/railway osg::ref_ptr<deprecated_osg::Geometry> gm=new deprecated_osg::Geometry; // the fill in road/railway
if (_midline->size()>0) { if (_midline->size()>0) {
osg::ref_ptr<osg::Vec3Array> locpts=getPoints(points); osg::ref_ptr<osg::Vec3Array> locpts=getPoints(points);
if (texture!="") { if (texture!="") {
@ -1263,19 +1258,19 @@ osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *points)
} }
gm->setVertexArray(locpts.get()); gm->setVertexArray(locpts.get());
gm->setNormalArray(getNormals(locpts.get())); gm->setNormalArray(getNormals(locpts.get()));
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE); gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
gm->addPrimitiveSet(getTriangles()); gm->addPrimitiveSet(getTriangles());
} }
return gm.release(); return gm.release();
} }
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
// use an ArgumentParser object to manage the program arguments. // use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
@ -1284,24 +1279,24 @@ int main( int argc, char **argv )
// create the scene from internal specified terrain/constraints. // create the scene from internal specified terrain/constraints.
osg::ref_ptr<osg::Node> loadedModel = makedelaunay(0); osg::ref_ptr<osg::Node> loadedModel = makedelaunay(0);
// if no model has been successfully loaded report failure. // if no model has been successfully loaded report failure.
if (!loadedModel) if (!loadedModel)
{ {
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl; std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1; return 1;
} }
// optimize the scene graph, remove redundant nodes and state etc. // optimize the scene graph, remove redundant nodes and state etc.
osgUtil::Optimizer optimizer; osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get()); optimizer.optimize(loadedModel.get());
// pass the loaded scene graph to the viewer. // pass the loaded scene graph to the viewer.
viewer.setSceneData(loadedModel.get()); viewer.setSceneData(loadedModel.get());
// copied from osgtessealte.cpp // copied from osgtessealte.cpp
// add event handler for keyboard 'n' to retriangulate // add event handler for keyboard 'n' to retriangulate
viewer.addEventHandler(new KeyboardEventHandler(viewer)); viewer.addEventHandler(new KeyboardEventHandler(viewer));
return viewer.run(); return viewer.run();
} }

View File

@ -16,11 +16,6 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include <osg/Config>
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/Material> #include <osg/Material>
#include <osg/MatrixTransform> #include <osg/MatrixTransform>
@ -125,7 +120,7 @@ void CreateHouses()
* 2 * ZDim) - ZDim; * 2 * ZDim) - ZDim;
float scale = 10.0f; float scale = 10.0f;
osg::Vec3 offset(xPos,yPos,0.0f); osg::Vec3 offset(xPos,yPos,0.0f);
// coords // coords
@ -148,22 +143,22 @@ void CreateHouses()
// create geometry // create geometry
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry(); osg::ref_ptr<deprecated_osg::Geometry> geometry = new deprecated_osg::Geometry();
geometry->addPrimitiveSet(primitives); geometry->addPrimitiveSet(primitives);
geometry->setVertexArray(coords.get()); geometry->setVertexArray(coords.get());
geometry->setVertexIndices(coordIndices.get()); geometry->setVertexIndices(coordIndices.get());
geometry->setColorArray(colors.get()); geometry->setColorArray(colors.get());
geometry->setColorBinding(osg::Geometry::BIND_OVERALL); geometry->setColorBinding(deprecated_osg::Geometry::BIND_OVERALL);
geometry->setNormalArray(normals.get()); geometry->setNormalArray(normals.get());
geometry->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE); geometry->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
osg::ref_ptr<osg::Geode> geode = new osg::Geode(); osg::ref_ptr<osg::Geode> geode = new osg::Geode();
geode->addDrawable(geometry.get()); geode->addDrawable(geometry.get());
nodes.push_back(geode.get()); nodes.push_back(geode.get());
} }
} }
@ -192,14 +187,14 @@ void LayoutAsGrid()
{ {
osg::Node * node = nodeIter->get(); osg::Node * node = nodeIter->get();
osg::Vec3 center = node->getBound().center(); osg::Vec3 center = node->getBound().center();
int x = (int)floor((center.x() - xGridStart) / xGridSize); int x = (int)floor((center.x() - xGridStart) / xGridSize);
int z = (int)floor((center.y() - yGridStart) / yGridSize); int z = (int)floor((center.y() - yGridStart) / yGridSize);
groups[z * GridX + x]->addChild(node); groups[z * GridX + x]->addChild(node);
} }
// add nodes to building root // add nodes to building root
for (i = 0; i < GridX * GridY; i++) for (i = 0; i < GridX * GridY; i++)
{ {
osg::StateSet * stateset = new osg::StateSet(); osg::StateSet * stateset = new osg::StateSet();
@ -210,7 +205,7 @@ void LayoutAsGrid()
0.5f + (static_cast<double> (rand()) / (2.0*static_cast<double> (RAND_MAX))), 0.5f + (static_cast<double> (rand()) / (2.0*static_cast<double> (RAND_MAX))),
0.5f + (static_cast<double> (rand()) / ( 2.0*static_cast<double>(RAND_MAX))), 0.5f + (static_cast<double> (rand()) / ( 2.0*static_cast<double>(RAND_MAX))),
1.0f); 1.0f);
material->setAmbient(osg::Material::FRONT_AND_BACK, color); material->setAmbient(osg::Material::FRONT_AND_BACK, color);
material->setDiffuse(osg::Material::FRONT_AND_BACK, color); material->setDiffuse(osg::Material::FRONT_AND_BACK, color);
stateset->setAttributeAndModes(material, osg::StateAttribute::ON); stateset->setAttributeAndModes(material, osg::StateAttribute::ON);
@ -283,7 +278,7 @@ int main( int argc, char **argv )
// we would know about it, other than by following the parent path // we would know about it, other than by following the parent path
// up from model. This is really what should be done, but I'll pass // up from model. This is really what should be done, but I'll pass
// on it right now as it requires a getRoots() method to be added to // on it right now as it requires a getRoots() method to be added to
// osg::Node, and we're about to make a release so no new features! // osg::Node, and we're about to make a release so no new features!
osg::ref_ptr<osg::Group> rootnode = new osg::Group; osg::ref_ptr<osg::Group> rootnode = new osg::Group;
rootnode->addChild(model.get()); rootnode->addChild(model.get());

View File

@ -33,12 +33,6 @@
// example uses a NodeVisitor to try to find worthwhile locations // example uses a NodeVisitor to try to find worthwhile locations
// for OcclusionQueryNodes in your the scene graph. // for OcclusionQueryNodes in your the scene graph.
#include <osg/Config>
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include <osg/NodeVisitor> #include <osg/NodeVisitor>
#include <osg/Geode> #include <osg/Geode>
#include <osg/Geometry> #include <osg/Geometry>
@ -572,7 +566,7 @@ createBox()
state->setAttributeAndModes( pm, state->setAttributeAndModes( pm,
osg::StateAttribute::ON | osg::StateAttribute::PROTECTED ); osg::StateAttribute::ON | osg::StateAttribute::PROTECTED );
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry; osg::ref_ptr<deprecated_osg::Geometry> geom = new deprecated_osg::Geometry;
osg::ref_ptr<osg::Vec3Array> v = new osg::Vec3Array; osg::ref_ptr<osg::Vec3Array> v = new osg::Vec3Array;
geom->setVertexArray( v.get() ); geom->setVertexArray( v.get() );
@ -610,12 +604,12 @@ createBox()
osg::ref_ptr<osg::Vec4Array> c = new osg::Vec4Array; osg::ref_ptr<osg::Vec4Array> c = new osg::Vec4Array;
geom->setColorArray( c.get() ); geom->setColorArray( c.get() );
geom->setColorBinding( osg::Geometry::BIND_OVERALL ); geom->setColorBinding( deprecated_osg::Geometry::BIND_OVERALL );
c->push_back( osg::Vec4( 0.f, 1.f, 1.f, 1.f ) ); c->push_back( osg::Vec4( 0.f, 1.f, 1.f, 1.f ) );
osg::ref_ptr<osg::Vec3Array> n = new osg::Vec3Array; osg::ref_ptr<osg::Vec3Array> n = new osg::Vec3Array;
geom->setNormalArray( n.get() ); geom->setNormalArray( n.get() );
geom->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE ); geom->setNormalBinding( deprecated_osg::Geometry::BIND_PER_PRIMITIVE );
n->push_back( osg::Vec3( -1.f, 0.f, 0.f ) ); n->push_back( osg::Vec3( -1.f, 0.f, 0.f ) );
n->push_back( osg::Vec3( 1.f, 0.f, 0.f ) ); n->push_back( osg::Vec3( 1.f, 0.f, 0.f ) );
n->push_back( osg::Vec3( 0.f, 0.f, -1.f ) ); n->push_back( osg::Vec3( 0.f, 0.f, -1.f ) );
@ -650,7 +644,7 @@ createRandomTriangles( unsigned int num )
ss->setMode( GL_LIGHTING, osg::StateAttribute::OFF | ss->setMode( GL_LIGHTING, osg::StateAttribute::OFF |
osg::StateAttribute::PROTECTED); osg::StateAttribute::PROTECTED);
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry; osg::ref_ptr<deprecated_osg::Geometry> geom = new deprecated_osg::Geometry;
// Disable display lists to decrease performance. // Disable display lists to decrease performance.
geom->setUseDisplayList( false ); geom->setUseDisplayList( false );
@ -674,7 +668,7 @@ createRandomTriangles( unsigned int num )
osg::ref_ptr<osg::Vec4Array> c = new osg::Vec4Array; osg::ref_ptr<osg::Vec4Array> c = new osg::Vec4Array;
geom->setColorArray( c.get() ); geom->setColorArray( c.get() );
// Bind per primitive to force slow glBegin/glEnd path. // Bind per primitive to force slow glBegin/glEnd path.
geom->setColorBinding( osg::Geometry::BIND_PER_PRIMITIVE ); geom->setColorBinding( deprecated_osg::Geometry::BIND_PER_PRIMITIVE );
c->resize( num ); c->resize( num );
#define RAND_0_TO_1 ( (rand()%10)*.1 ) #define RAND_0_TO_1 ( (rand()%10)*.1 )

View File

@ -235,9 +235,6 @@ class OSG_EXPORT Geometry : public Drawable
BIND_OFF=0, BIND_OFF=0,
BIND_OVERALL=1, BIND_OVERALL=1,
BIND_PER_PRIMITIVE_SET=2, BIND_PER_PRIMITIVE_SET=2,
#if defined(OSG_USE_DEPRECATED_GEOMETRY_METHODS)
BIND_PER_PRIMITIVE=3, /// no longer supported
#endif
BIND_PER_VERTEX=4 BIND_PER_VERTEX=4
}; };
@ -264,36 +261,6 @@ class OSG_EXPORT Geometry : public Drawable
/** deprecated, use array->setNormalize(..). */ /** deprecated, use array->setNormalize(..). */
void setVertexAttribNormalize(unsigned int index,GLboolean norm); void setVertexAttribNormalize(unsigned int index,GLboolean norm);
GLboolean getVertexAttribNormalize(unsigned int index) const; GLboolean getVertexAttribNormalize(unsigned int index) const;
#if defined(OSG_USE_DEPRECATED_GEOMETRY_METHODS)
/** no longer supported.*/
inline void setVertexIndices(IndexArray* array);
inline const IndexArray* getVertexIndices() const;
/** no longer supported.*/
inline void setNormalIndices(IndexArray* array);
inline const IndexArray* getNormalIndices() const;
/** no longer supported.*/
inline void setColorIndices(IndexArray* array);
inline const IndexArray* getColorIndices() const;
/** no longer supported.*/
inline void setSecondaryColorIndices(IndexArray* array);
inline const IndexArray* getSecondaryColorIndices() const;
/** no longer supported.*/
inline void setFogCoordIndices(IndexArray* array);
inline const IndexArray* getFogCoordIndices() const;
/** no longer supported.*/
inline void setTexCoordIndices(unsigned int unit,IndexArray*);
inline const IndexArray* getTexCoordIndices(unsigned int unit) const;
/** no longer supported.*/
inline void setVertexAttribIndices(unsigned int index,IndexArray* array);
inline const IndexArray* getVertexAttribIndices(unsigned int index) const;
#endif
}; };
/** Convenience function to be used for creating quad geometry with texture coords. /** Convenience function to be used for creating quad geometry with texture coords.
@ -311,92 +278,72 @@ inline Geometry* createTexturedQuadGeometry(const Vec3& corner,const Vec3& width
} // namespace osg } // namespace osg
#if defined(OSG_USE_DEPRECATED_GEOMETRY_METHODS)
#include <osg/Notify> #include <osg/Notify>
namespace osg { /** Contains deprecated features of namespace osg. */
namespace deprecated_osg {
inline void Geometry::setVertexIndices(IndexArray* array) /** Geometry class contaning deprecated features.
* Please note this class is \b not "exported" (OSG_EXPORT) to avoid issues with MSVC, when compiling plugins.
*/
class OSG_EXPORT Geometry : public osg::Geometry
{ {
if (_vertexArray.valid()) { _vertexArray->setUserData(array); if (array) _containsDeprecatedData = true; } public:
else { OSG_WARN<<"Geometry::setVertexIndicies(..) function failed as there is no vertex array to associate inidices with."<<std::endl; } Geometry() : osg::Geometry() {}
} Geometry(const Geometry& geometry,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) : osg::Geometry(geometry, copyop) {}
inline const IndexArray* Geometry::getVertexIndices() const /** Same values as Array::Binding.*/
{ enum AttributeBinding
if (_vertexArray.valid()) return dynamic_cast<IndexArray*>(_vertexArray->getUserData()); {
else return 0; BIND_OFF=0,
} BIND_OVERALL=1,
BIND_PER_PRIMITIVE_SET=2,
BIND_PER_PRIMITIVE=3,
BIND_PER_VERTEX=4
};
inline void Geometry::setNormalIndices(IndexArray* array) void setNormalBinding(AttributeBinding ab);
{ AttributeBinding getNormalBinding() const;
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."<<std::endl; }
}
inline const IndexArray* Geometry::getNormalIndices() const
{
if (_normalArray.valid()) return dynamic_cast<IndexArray*>(_normalArray->getUserData());
else return 0;
}
inline void Geometry::setColorIndices(IndexArray* array) void setColorBinding(AttributeBinding ab);
{ AttributeBinding getColorBinding() const;
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."<<std::endl; }
}
inline const IndexArray* Geometry::getColorIndices() const
{
if (_colorArray.valid()) return dynamic_cast<IndexArray*>(_colorArray->getUserData());
else return 0;
}
inline void Geometry::setSecondaryColorIndices(IndexArray* array) void setSecondaryColorBinding(AttributeBinding ab);
{ AttributeBinding getSecondaryColorBinding() const;
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."<<std::endl; }
}
inline const IndexArray* Geometry::getSecondaryColorIndices() const
{
if (_secondaryColorArray.valid()) return dynamic_cast<IndexArray*>(_secondaryColorArray->getUserData());
else return 0;
}
inline void Geometry::setFogCoordIndices(IndexArray* array) void setFogCoordBinding(AttributeBinding ab);
{ AttributeBinding getFogCoordBinding() const;
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."<<std::endl; }
}
inline const IndexArray* Geometry::getFogCoordIndices() const
{
if (_fogCoordArray.valid()) return dynamic_cast<IndexArray*>(_fogCoordArray->getUserData());
else return 0;
}
inline void Geometry::setTexCoordIndices(unsigned int unit,IndexArray* array) void setVertexAttribBinding(unsigned int index,AttributeBinding ab);
{ AttributeBinding getVertexAttribBinding(unsigned int index) const;
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."<<std::endl; }
}
inline const IndexArray* Geometry::getTexCoordIndices(unsigned int unit) const
{
if (unit<_texCoordList.size() && _texCoordList[unit].valid()) return dynamic_cast<IndexArray*>(_texCoordList[unit]->getUserData());
else return 0;
}
inline void Geometry::setVertexAttribIndices(unsigned int index,IndexArray* array) void setVertexAttribNormalize(unsigned int index,GLboolean norm);
{ GLboolean getVertexAttribNormalize(unsigned int index) const;
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."<<std::endl; }
}
inline const IndexArray* Geometry::getVertexAttribIndices(unsigned int index) const
{
if (index<_vertexAttribList.size() && _vertexAttribList[index].valid()) return dynamic_cast<IndexArray*>(_vertexAttribList[index]->getUserData());
else return 0;
}
} // namespace osg void setVertexIndices(osg::IndexArray* array);
const osg::IndexArray* getVertexIndices() const;
#endif
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 #endif

View File

@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 2008-2009 Robert Osfield /* -*-c++-*- OpenSceneGraph - Copyright (C) 2008-2009 Robert Osfield
* *
* This library is open source and may be redistributed and/or modified under * This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
*/ */
@ -44,6 +44,4 @@
#cmakedefine OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE #cmakedefine OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE
#cmakedefine OSG_GL_FIXED_FUNCTION_AVAILABLE #cmakedefine OSG_GL_FIXED_FUNCTION_AVAILABLE
#cmakedefine OSG_USE_DEPRECATED_GEOMETRY_METHODS
#endif #endif

View File

@ -1789,3 +1789,115 @@ void Geometry::fixDeprecatedData()
_containsDeprecatedData = false; _containsDeprecatedData = false;
} }
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// deprecated_osg
void deprecated_osg::Geometry::setNormalBinding(AttributeBinding ab) { osg::Geometry::setNormalBinding(static_cast<osg::Geometry::AttributeBinding>(ab)); }
deprecated_osg::Geometry::AttributeBinding deprecated_osg::Geometry::getNormalBinding() const { return static_cast<AttributeBinding>(osg::Geometry::getNormalBinding()); }
void deprecated_osg::Geometry::setColorBinding(deprecated_osg::Geometry::AttributeBinding ab) { osg::Geometry::setColorBinding(static_cast<osg::Geometry::AttributeBinding>(ab)); }
deprecated_osg::Geometry::AttributeBinding deprecated_osg::Geometry::getColorBinding() const { return static_cast<AttributeBinding>(osg::Geometry::getColorBinding()); }
void deprecated_osg::Geometry::setSecondaryColorBinding(deprecated_osg::Geometry::AttributeBinding ab) { osg::Geometry::setSecondaryColorBinding(static_cast<osg::Geometry::AttributeBinding>(ab)); }
deprecated_osg::Geometry::AttributeBinding deprecated_osg::Geometry::getSecondaryColorBinding() const { return static_cast<AttributeBinding>(osg::Geometry::getSecondaryColorBinding()); }
void deprecated_osg::Geometry::setFogCoordBinding(deprecated_osg::Geometry::AttributeBinding ab) { osg::Geometry::setFogCoordBinding(static_cast<osg::Geometry::AttributeBinding>(ab)); }
deprecated_osg::Geometry::AttributeBinding deprecated_osg::Geometry::getFogCoordBinding() const { return static_cast<AttributeBinding>(osg::Geometry::getFogCoordBinding()); }
void deprecated_osg::Geometry::setVertexAttribBinding(unsigned int index,deprecated_osg::Geometry::AttributeBinding ab) { osg::Geometry::setVertexAttribBinding(index, static_cast<osg::Geometry::AttributeBinding>(ab)); }
deprecated_osg::Geometry::AttributeBinding deprecated_osg::Geometry::getVertexAttribBinding(unsigned int index) const { return static_cast<AttributeBinding>(osg::Geometry::getVertexAttribBinding(index)); }
void deprecated_osg::Geometry::setVertexAttribNormalize(unsigned int index,GLboolean norm) { osg::Geometry::setVertexAttribNormalize(index, norm); }
GLboolean deprecated_osg::Geometry::getVertexAttribNormalize(unsigned int index) const { return osg::Geometry::getVertexAttribNormalize(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."<<std::endl; }
}
const osg::IndexArray* deprecated_osg::Geometry::getVertexIndices() const
{
if (_vertexArray.valid()) return dynamic_cast<osg::IndexArray*>(_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."<<std::endl; }
}
const osg::IndexArray* deprecated_osg::Geometry::getNormalIndices() const
{
if (_normalArray.valid()) return dynamic_cast<osg::IndexArray*>(_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."<<std::endl; }
}
const osg::IndexArray* deprecated_osg::Geometry::getColorIndices() const
{
if (_colorArray.valid()) return dynamic_cast<osg::IndexArray*>(_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."<<std::endl; }
}
const osg::IndexArray* deprecated_osg::Geometry::getSecondaryColorIndices() const
{
if (_secondaryColorArray.valid()) return dynamic_cast<osg::IndexArray*>(_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."<<std::endl; }
}
const osg::IndexArray* deprecated_osg::Geometry::getFogCoordIndices() const
{
if (_fogCoordArray.valid()) return dynamic_cast<osg::IndexArray*>(_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."<<std::endl; }
}
const osg::IndexArray* deprecated_osg::Geometry::getTexCoordIndices(unsigned int unit) const
{
if (unit<_texCoordList.size() && _texCoordList[unit].valid()) return dynamic_cast<osg::IndexArray*>(_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."<<std::endl; }
}
const osg::IndexArray* deprecated_osg::Geometry::getVertexAttribIndices(unsigned int index) const
{
if (index<_vertexAttribList.size() && _vertexAttribList[index].valid()) return dynamic_cast<osg::IndexArray*>(_vertexAttribList[index]->getUserData());
else return 0;
}

View File

@ -1,8 +1,3 @@
#include <osg/Config>
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include "ConvertFromInventor.h" #include "ConvertFromInventor.h"
#include "PendulumCallback.h" #include "PendulumCallback.h"
@ -774,42 +769,42 @@ ConvertFromInventor::preShape(void* data, SoCallbackAction* action,
ConvertFromInventor* thisPtr = (ConvertFromInventor *) (data); ConvertFromInventor* thisPtr = (ConvertFromInventor *) (data);
// Normal and color binding map from Inventor to OSG // Normal and color binding map from Inventor to OSG
static std::map<SoNormalBinding::Binding, osg::Geometry::AttributeBinding> static std::map<SoNormalBinding::Binding, deprecated_osg::Geometry::AttributeBinding>
normBindingMap; normBindingMap;
static std::map<SoMaterialBinding::Binding, osg::Geometry::AttributeBinding> static std::map<SoMaterialBinding::Binding, deprecated_osg::Geometry::AttributeBinding>
colBindingMap; colBindingMap;
static bool firstTime = true; static bool firstTime = true;
if (firstTime) if (firstTime)
{ {
normBindingMap[SoNormalBinding::OVERALL] normBindingMap[SoNormalBinding::OVERALL]
= osg::Geometry::BIND_OVERALL; = deprecated_osg::Geometry::BIND_OVERALL;
normBindingMap[SoNormalBinding::PER_PART] normBindingMap[SoNormalBinding::PER_PART]
= osg::Geometry::BIND_PER_PRIMITIVE; = deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
normBindingMap[SoNormalBinding::PER_PART_INDEXED] normBindingMap[SoNormalBinding::PER_PART_INDEXED]
= osg::Geometry::BIND_PER_PRIMITIVE; = deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
normBindingMap[SoNormalBinding::PER_FACE] normBindingMap[SoNormalBinding::PER_FACE]
= osg::Geometry::BIND_PER_PRIMITIVE; = deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
normBindingMap[SoNormalBinding::PER_FACE_INDEXED] normBindingMap[SoNormalBinding::PER_FACE_INDEXED]
= osg::Geometry::BIND_PER_PRIMITIVE; = deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
normBindingMap[SoNormalBinding::PER_VERTEX] normBindingMap[SoNormalBinding::PER_VERTEX]
= osg::Geometry::BIND_PER_VERTEX; = deprecated_osg::Geometry::BIND_PER_VERTEX;
normBindingMap[SoNormalBinding::PER_VERTEX_INDEXED] normBindingMap[SoNormalBinding::PER_VERTEX_INDEXED]
= osg::Geometry::BIND_PER_VERTEX; = deprecated_osg::Geometry::BIND_PER_VERTEX;
colBindingMap[SoMaterialBinding::OVERALL] colBindingMap[SoMaterialBinding::OVERALL]
= osg::Geometry::BIND_OVERALL; = deprecated_osg::Geometry::BIND_OVERALL;
colBindingMap[SoMaterialBinding::PER_PART] colBindingMap[SoMaterialBinding::PER_PART]
= osg::Geometry::BIND_PER_PRIMITIVE; = deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
colBindingMap[SoMaterialBinding::PER_PART_INDEXED] colBindingMap[SoMaterialBinding::PER_PART_INDEXED]
= osg::Geometry::BIND_PER_PRIMITIVE; = deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
colBindingMap[SoMaterialBinding::PER_FACE] colBindingMap[SoMaterialBinding::PER_FACE]
= osg::Geometry::BIND_PER_PRIMITIVE; = deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
colBindingMap[SoMaterialBinding::PER_FACE_INDEXED] colBindingMap[SoMaterialBinding::PER_FACE_INDEXED]
= osg::Geometry::BIND_PER_PRIMITIVE; = deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
colBindingMap[SoMaterialBinding::PER_VERTEX] colBindingMap[SoMaterialBinding::PER_VERTEX]
= osg::Geometry::BIND_PER_VERTEX; = deprecated_osg::Geometry::BIND_PER_VERTEX;
colBindingMap[SoMaterialBinding::PER_VERTEX_INDEXED] colBindingMap[SoMaterialBinding::PER_VERTEX_INDEXED]
= osg::Geometry::BIND_PER_VERTEX; = deprecated_osg::Geometry::BIND_PER_VERTEX;
firstTime = false; firstTime = false;
} }
@ -822,8 +817,8 @@ ConvertFromInventor::preShape(void* data, SoCallbackAction* action,
} }
else else
{ {
thisPtr->normalBinding = osg::Geometry::BIND_PER_VERTEX; thisPtr->normalBinding = deprecated_osg::Geometry::BIND_PER_VERTEX;
thisPtr->colorBinding = osg::Geometry::BIND_PER_VERTEX; thisPtr->colorBinding = deprecated_osg::Geometry::BIND_PER_VERTEX;
} }
// Check vertex ordering // Check vertex ordering
@ -874,7 +869,7 @@ ConvertFromInventor::postShape(void* data, SoCallbackAction* action,
// Create a new Geometry // Create a new Geometry
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry; osg::ref_ptr<deprecated_osg::Geometry> geometry = new deprecated_osg::Geometry;
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array(thisPtr->vertices.size()); osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array(thisPtr->vertices.size());
@ -883,7 +878,7 @@ ConvertFromInventor::postShape(void* data, SoCallbackAction* action,
geometry->setVertexArray(coords.get()); geometry->setVertexArray(coords.get());
osg::ref_ptr<osg::Vec3Array> norms = NULL; osg::ref_ptr<osg::Vec3Array> norms = NULL;
if (thisPtr->normalBinding == osg::Geometry::BIND_OVERALL) if (thisPtr->normalBinding == deprecated_osg::Geometry::BIND_OVERALL)
{ {
norms = new osg::Vec3Array(1); norms = new osg::Vec3Array(1);
const SbVec3f &norm = action->getNormal(0); const SbVec3f &norm = action->getNormal(0);
@ -902,7 +897,7 @@ ConvertFromInventor::postShape(void* data, SoCallbackAction* action,
// Set the colors // Set the colors
osg::ref_ptr<osg::Vec4Array> cols; osg::ref_ptr<osg::Vec4Array> cols;
if (thisPtr->colorBinding == osg::Geometry::BIND_OVERALL) if (thisPtr->colorBinding == deprecated_osg::Geometry::BIND_OVERALL)
{ {
cols = new osg::Vec4Array(1); cols = new osg::Vec4Array(1);
SbColor ambient, diffuse, specular, emission; SbColor ambient, diffuse, specular, emission;
@ -2162,8 +2157,8 @@ void ConvertFromInventor::addVertex(SoCallbackAction* action,
// Get the normal of the vertex // Get the normal of the vertex
SbVec3f norm = v->getNormal(); SbVec3f norm = v->getNormal();
if ((normalBinding == osg::Geometry::BIND_PER_VERTEX) || if ((normalBinding == deprecated_osg::Geometry::BIND_PER_VERTEX) ||
(normalBinding == osg::Geometry::BIND_PER_PRIMITIVE && index == 0)) (normalBinding == deprecated_osg::Geometry::BIND_PER_PRIMITIVE && index == 0))
{ {
// What is this? Why to invert normals at CLOCKWISE vertex ordering? // What is this? Why to invert normals at CLOCKWISE vertex ordering?
// PCJohn 2009-12-13 // PCJohn 2009-12-13
@ -2173,18 +2168,18 @@ void ConvertFromInventor::addVertex(SoCallbackAction* action,
normals.push_back(osg::Vec3(norm[0], norm[1], norm[2])); normals.push_back(osg::Vec3(norm[0], norm[1], norm[2]));
} }
if (colorBinding == osg::Geometry::BIND_PER_VERTEX || if (colorBinding == deprecated_osg::Geometry::BIND_PER_VERTEX ||
colorBinding == osg::Geometry::BIND_PER_PRIMITIVE) colorBinding == deprecated_osg::Geometry::BIND_PER_PRIMITIVE)
{ {
// Get the material/color // Get the material/color
SbColor ambient, diffuse, specular, emission; SbColor ambient, diffuse, specular, emission;
float transparency, shininess; float transparency, shininess;
action->getMaterial(ambient, diffuse, specular, emission, shininess, action->getMaterial(ambient, diffuse, specular, emission, shininess,
transparency, v->getMaterialIndex()); transparency, v->getMaterialIndex());
if (colorBinding == osg::Geometry::BIND_PER_VERTEX) if (colorBinding == deprecated_osg::Geometry::BIND_PER_VERTEX)
colors.push_back(osg::Vec4(diffuse[0], diffuse[1], diffuse[2], colors.push_back(osg::Vec4(diffuse[0], diffuse[1], diffuse[2],
1.0 - transparency)); 1.0 - transparency));
else if (colorBinding == osg::Geometry::BIND_PER_PRIMITIVE && index == 0) else if (colorBinding == deprecated_osg::Geometry::BIND_PER_PRIMITIVE && index == 0)
colors.push_back(osg::Vec4(diffuse[0], diffuse[1], diffuse[2], colors.push_back(osg::Vec4(diffuse[0], diffuse[1], diffuse[2],
1.0 - transparency)); 1.0 - transparency));
} }

View File

@ -109,8 +109,8 @@ class ConvertFromInventor
private: private:
// Normal and color binding // Normal and color binding
osg::Geometry::AttributeBinding normalBinding; deprecated_osg::Geometry::AttributeBinding normalBinding;
osg::Geometry::AttributeBinding colorBinding; deprecated_osg::Geometry::AttributeBinding colorBinding;
// List of vertices, normals, colors and texture coordinates // List of vertices, normals, colors and texture coordinates
std::vector<osg::Vec3> vertices; std::vector<osg::Vec3> vertices;

View File

@ -25,11 +25,6 @@
// but you are not forced to do so. // but you are not forced to do so.
// //
#include <osg/Config>
#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>
#include <osg/Geode> #include <osg/Geode>
@ -470,27 +465,18 @@ bool ivDeindex(variableType *dest, const variableType *src, const int srcNum,
template<typename variableType, typename fieldType> template<typename variableType, typename fieldType>
bool ivProcessArray(const osg::Array *indices, const osg::Array *drawElemIndices, bool ivProcessArray(const osg::Array *drawElemIndices,
fieldType *destField, const fieldType *srcField, fieldType *destField, const fieldType *srcField,
int startIndex, int numToProcess) int startIndex, int numToProcess)
{ {
bool ok = true; bool ok = true;
if (indices || drawElemIndices) { if (drawElemIndices) {
// "deindex" original data // "deindex" original data
if (indices && !drawElemIndices) ok = ivDeindex<variableType>(destField->startEditing(),
ok = ivDeindex<variableType>(destField->startEditing(), srcField->getValues(startIndex),
srcField->getValues(startIndex), srcField->getNum(), drawElemIndices, numToProcess);
srcField->getNum(), indices, numToProcess); else
if (!indices && drawElemIndices)
ok = ivDeindex<variableType>(destField->startEditing(),
srcField->getValues(startIndex),
srcField->getNum(), drawElemIndices, numToProcess);
else {
OSG_WARN << "IvWriter: NOT IMPLEMENTED" << std::endl;
assert(0); // FIXME:
}
destField->finishEditing(); destField->finishEditing();
if (!ok) if (!ok)
@ -511,21 +497,16 @@ bool ivProcessArray(const osg::Array *indices, const osg::Array *drawElemIndices
} }
static void processIndices(const osg::Array *indices, const osg::Array *drawElemIndices, static void processIndices(const osg::Array *drawElemIndices,
SoMFInt32 &ivIndices, SoMFInt32 &ivIndices,
int startIndex, int stopIndex, int numItemsUntilMinusOne) int startIndex, int stopIndex, int numItemsUntilMinusOne)
{ {
if (indices || drawElemIndices) { if (drawElemIndices) {
if (indices && !drawElemIndices)
osgArray2ivMField(indices, ivIndices, startIndex, stopIndex, numItemsUntilMinusOne); else
if (!indices && drawElemIndices)
osgArray2ivMField(drawElemIndices, ivIndices, startIndex, stopIndex, numItemsUntilMinusOne); osgArray2ivMField(drawElemIndices, ivIndices, startIndex, stopIndex, numItemsUntilMinusOne);
else {
OSG_WARN << "IvWriter: NOT IMPLEMENTED" << std::endl;
assert(0); // FIXME:
}
} else { } else {
int num = stopIndex-startIndex; int num = stopIndex-startIndex;
if (numItemsUntilMinusOne != 0 && num >= 1) if (numItemsUntilMinusOne != 0 && num >= 1)
num += (num-1)/numItemsUntilMinusOne; num += (num-1)/numItemsUntilMinusOne;
@ -572,10 +553,10 @@ static void postProcessDrawArrayLengths(const osg::DrawArrayLengths *drawArrayLe
static void postProcessField(const SbIntList &runLengths, osg::PrimitiveSet::Mode primType, static void postProcessField(const SbIntList &runLengths, osg::PrimitiveSet::Mode primType,
SoMFInt32 *field, osg::Geometry::AttributeBinding binding) SoMFInt32 *field, deprecated_osg::Geometry::AttributeBinding binding)
{ {
if (binding==osg::Geometry::BIND_OFF || binding==osg::Geometry::BIND_OVERALL || if (binding==deprecated_osg::Geometry::BIND_OFF || binding==deprecated_osg::Geometry::BIND_OVERALL ||
binding==osg::Geometry::BIND_PER_PRIMITIVE_SET) binding==deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET)
return; return;
// make copy of array // make copy of array
@ -588,11 +569,11 @@ static void postProcessField(const SbIntList &runLengths, osg::PrimitiveSet::Mod
int newNum = origNum; int newNum = origNum;
const int l = runLengths.getLength(); const int l = runLengths.getLength();
switch (binding) { switch (binding) {
case osg::Geometry::BIND_PER_VERTEX: case deprecated_osg::Geometry::BIND_PER_VERTEX:
for (int i=0; i<l; i++) for (int i=0; i<l; i++)
newNum += (runLengths[i]-3)*3; newNum += (runLengths[i]-3)*3;
break; break;
case osg::Geometry::BIND_PER_PRIMITIVE: case deprecated_osg::Geometry::BIND_PER_PRIMITIVE:
for (int i=0; i<l; i++) for (int i=0; i<l; i++)
newNum += runLengths[i]-3; newNum += runLengths[i]-3;
break; break;
@ -606,7 +587,7 @@ static void postProcessField(const SbIntList &runLengths, osg::PrimitiveSet::Mod
int32_t *dst = field->startEditing(); int32_t *dst = field->startEditing();
// int32_t *dst2 = dst; // int32_t *dst2 = dst;
switch (binding) { switch (binding) {
case osg::Geometry::BIND_PER_VERTEX: case deprecated_osg::Geometry::BIND_PER_VERTEX:
for (int i=0; i<l; i++) { for (int i=0; i<l; i++) {
int c = runLengths[i]; int c = runLengths[i];
*(dst++) = *(src++); *(dst++) = *(src++);
@ -642,7 +623,7 @@ static void postProcessField(const SbIntList &runLengths, osg::PrimitiveSet::Mod
} }
break; break;
case osg::Geometry::BIND_PER_PRIMITIVE: case deprecated_osg::Geometry::BIND_PER_PRIMITIVE:
for (int i=0; i<l; i++,src++) { for (int i=0; i<l; i++,src++) {
int c = runLengths[i]; int c = runLengths[i];
*(dst++) = *(src); *(dst++) = *(src);
@ -662,8 +643,8 @@ static void postProcessField(const SbIntList &runLengths, osg::PrimitiveSet::Mod
static void postProcessTriangleSeparation(SoIndexedShape *shape, osg::PrimitiveSet::Mode primType, static void postProcessTriangleSeparation(SoIndexedShape *shape, osg::PrimitiveSet::Mode primType,
osg::Geometry::AttributeBinding normalBinding, deprecated_osg::Geometry::AttributeBinding normalBinding,
osg::Geometry::AttributeBinding colorBinding) deprecated_osg::Geometry::AttributeBinding colorBinding)
{ {
// compute runLengths // compute runLengths
SbIntList runLengths; SbIntList runLengths;
@ -680,42 +661,42 @@ static void postProcessTriangleSeparation(SoIndexedShape *shape, osg::PrimitiveS
if (l != 0) // append final l if field is not finished by -1 if (l != 0) // append final l if field is not finished by -1
runLengths.append(l); runLengths.append(l);
postProcessField(runLengths, primType, &shape->coordIndex, osg::Geometry::BIND_PER_VERTEX); postProcessField(runLengths, primType, &shape->coordIndex, deprecated_osg::Geometry::BIND_PER_VERTEX);
postProcessField(runLengths, primType, &shape->normalIndex, normalBinding); postProcessField(runLengths, primType, &shape->normalIndex, normalBinding);
postProcessField(runLengths, primType, &shape->materialIndex, colorBinding); postProcessField(runLengths, primType, &shape->materialIndex, colorBinding);
bool notUseTexCoords = shape->textureCoordIndex.getNum()==0 || bool notUseTexCoords = shape->textureCoordIndex.getNum()==0 ||
(shape->textureCoordIndex.getNum()==1 && shape->textureCoordIndex[0] == -1); (shape->textureCoordIndex.getNum()==1 && shape->textureCoordIndex[0] == -1);
if (!notUseTexCoords) if (!notUseTexCoords)
postProcessField(runLengths, primType, &shape->textureCoordIndex, osg::Geometry::BIND_PER_VERTEX); postProcessField(runLengths, primType, &shape->textureCoordIndex, deprecated_osg::Geometry::BIND_PER_VERTEX);
} }
static SoMaterialBinding* createMaterialBinding(const osg::Geometry *g, bool isMaterialIndexed) static SoMaterialBinding* createMaterialBinding(const deprecated_osg::Geometry *g, bool isMaterialIndexed)
{ {
SoMaterialBinding *materialBinding = new SoMaterialBinding; SoMaterialBinding *materialBinding = new SoMaterialBinding;
switch (g->getColorBinding()) { switch (g->getColorBinding()) {
case osg::Geometry::BIND_OFF: // OFF means use material from state set (if any) for whole geometry case deprecated_osg::Geometry::BIND_OFF: // OFF means use material from state set (if any) for whole geometry
case osg::Geometry::BIND_OVERALL: case deprecated_osg::Geometry::BIND_OVERALL:
case osg::Geometry::BIND_PER_PRIMITIVE_SET: materialBinding->value = SoMaterialBinding::OVERALL; break; case deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET: materialBinding->value = SoMaterialBinding::OVERALL; break;
case osg::Geometry::BIND_PER_PRIMITIVE: materialBinding->value = (isMaterialIndexed) ? SoMaterialBinding::PER_PART_INDEXED : SoMaterialBinding::PER_PART; break; case deprecated_osg::Geometry::BIND_PER_PRIMITIVE: materialBinding->value = (isMaterialIndexed) ? SoMaterialBinding::PER_PART_INDEXED : SoMaterialBinding::PER_PART; break;
case osg::Geometry::BIND_PER_VERTEX: materialBinding->value = (isMaterialIndexed) ? SoMaterialBinding::PER_VERTEX_INDEXED : SoMaterialBinding::PER_VERTEX; break; case deprecated_osg::Geometry::BIND_PER_VERTEX: materialBinding->value = (isMaterialIndexed) ? SoMaterialBinding::PER_VERTEX_INDEXED : SoMaterialBinding::PER_VERTEX; break;
default: assert(0); default: assert(0);
} }
return materialBinding; return materialBinding;
} }
static SoNormalBinding* createNormalBinding(const osg::Geometry *g, bool areNormalsIndexed) static SoNormalBinding* createNormalBinding(const deprecated_osg::Geometry *g, bool areNormalsIndexed)
{ {
// Convert normal binding // Convert normal binding
SoNormalBinding *normalBinding = new SoNormalBinding; SoNormalBinding *normalBinding = new SoNormalBinding;
switch (g->getNormalBinding()) { switch (g->getNormalBinding()) {
case osg::Geometry::BIND_OFF: // FIXME: what to do with BIND_OFF value? case deprecated_osg::Geometry::BIND_OFF: // FIXME: what to do with BIND_OFF value?
case osg::Geometry::BIND_OVERALL: case deprecated_osg::Geometry::BIND_OVERALL:
case osg::Geometry::BIND_PER_PRIMITIVE_SET: normalBinding->value = SoNormalBinding::OVERALL; break; case deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET: normalBinding->value = SoNormalBinding::OVERALL; break;
case osg::Geometry::BIND_PER_PRIMITIVE: normalBinding->value = (areNormalsIndexed) ? SoNormalBinding::PER_PART_INDEXED : SoNormalBinding::PER_PART; break; case deprecated_osg::Geometry::BIND_PER_PRIMITIVE: normalBinding->value = (areNormalsIndexed) ? SoNormalBinding::PER_PART_INDEXED : SoNormalBinding::PER_PART; break;
case osg::Geometry::BIND_PER_VERTEX: normalBinding->value = (areNormalsIndexed) ? SoNormalBinding::PER_VERTEX_INDEXED : SoNormalBinding::PER_VERTEX; break; case deprecated_osg::Geometry::BIND_PER_VERTEX: normalBinding->value = (areNormalsIndexed) ? SoNormalBinding::PER_VERTEX_INDEXED : SoNormalBinding::PER_VERTEX; break;
default: assert(0); default: assert(0);
} }
return normalBinding; return normalBinding;
@ -1101,7 +1082,7 @@ void ConvertToInventor::popInventorState()
} }
static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet *pset, static bool processPrimitiveSet(const deprecated_osg::Geometry *g, const osg::PrimitiveSet *pset,
osg::UIntArray *drawElemIndices, bool needSeparateTriangles, osg::UIntArray *drawElemIndices, bool needSeparateTriangles,
int elementsCount, int primSize, const int startIndex, int stopIndex, int elementsCount, int primSize, const int startIndex, int stopIndex,
int &normalIndex, int &colorIndex, int &normalIndex, int &colorIndex,
@ -1136,49 +1117,49 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
SoNode *nonIndexedMaterial = NULL; SoNode *nonIndexedMaterial = NULL;
// Normal indexing // Normal indexing
int normalStart = g->getNormalBinding() == osg::Geometry::BIND_PER_VERTEX ? startIndex : normalIndex; int normalStart = (g->getNormalBinding() == deprecated_osg::Geometry::BIND_PER_VERTEX) ? startIndex : normalIndex;
int numNormalsUsed = 0; int numNormalsUsed = 0;
switch (g->getNormalBinding()) { switch (g->getNormalBinding()) {
case osg::Geometry::BIND_OFF: // FIXME: what is meaning of OFF value? case deprecated_osg::Geometry::BIND_OFF: // FIXME: what is meaning of OFF value?
case osg::Geometry::BIND_OVERALL: numNormalsUsed = 0; break; case deprecated_osg::Geometry::BIND_OVERALL: numNormalsUsed = 0; break;
case osg::Geometry::BIND_PER_PRIMITIVE_SET: numNormalsUsed = 1; break; case deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET: numNormalsUsed = 1; break;
case osg::Geometry::BIND_PER_PRIMITIVE: numNormalsUsed = primSize!=0 ? (stopIndex-startIndex)/primSize : case deprecated_osg::Geometry::BIND_PER_PRIMITIVE: numNormalsUsed = primSize!=0 ? (stopIndex-startIndex)/primSize :
(drawArrayLengths ? drawArrayLengths->size() : 1); break; (drawArrayLengths ? drawArrayLengths->size() : 1); break;
case osg::Geometry::BIND_PER_VERTEX: numNormalsUsed = stopIndex-startIndex; break; case deprecated_osg::Geometry::BIND_PER_VERTEX: numNormalsUsed = stopIndex-startIndex; break;
} }
normalIndex += numNormalsUsed; normalIndex += numNormalsUsed;
// Color indexing // Color indexing
int colorStart = g->getColorBinding() == osg::Geometry::BIND_PER_VERTEX ? startIndex : colorIndex; int colorStart = g->getColorBinding() == deprecated_osg::Geometry::BIND_PER_VERTEX ? startIndex : colorIndex;
int numColorsUsed = 0; int numColorsUsed = 0;
switch (g->getColorBinding()) { switch (g->getColorBinding()) {
case osg::Geometry::BIND_OFF: case deprecated_osg::Geometry::BIND_OFF:
case osg::Geometry::BIND_OVERALL: numColorsUsed = 0; break; case deprecated_osg::Geometry::BIND_OVERALL: numColorsUsed = 0; break;
case osg::Geometry::BIND_PER_PRIMITIVE_SET: numColorsUsed = 1; break; case deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET: numColorsUsed = 1; break;
case osg::Geometry::BIND_PER_PRIMITIVE: numColorsUsed = primSize!=0 ? (stopIndex-startIndex)/primSize : case deprecated_osg::Geometry::BIND_PER_PRIMITIVE: numColorsUsed = primSize!=0 ? (stopIndex-startIndex)/primSize :
(drawArrayLengths ? drawArrayLengths->size() : 1); break; (drawArrayLengths ? drawArrayLengths->size() : 1); break;
case osg::Geometry::BIND_PER_VERTEX: numColorsUsed = stopIndex-startIndex; break; case deprecated_osg::Geometry::BIND_PER_VERTEX: numColorsUsed = stopIndex-startIndex; break;
} }
colorIndex += numColorsUsed; colorIndex += numColorsUsed;
if (shape->isOfType(SoIndexedShape::getClassTypeId())) { if (shape->isOfType(SoIndexedShape::getClassTypeId())) {
// Convert to SoIndexedShape // Convert to SoIndexedShape
processIndices(g->getVertexIndices(), drawElemIndices, ((SoIndexedShape*)shape)->coordIndex, processIndices(drawElemIndices, ((SoIndexedShape*)shape)->coordIndex,
startIndex, stopIndex, primSize); startIndex, stopIndex, primSize);
if (ivNormals) if (ivNormals)
processIndices(g->getNormalIndices(), drawElemIndices, ((SoIndexedShape*)shape)->normalIndex, processIndices(drawElemIndices, ((SoIndexedShape*)shape)->normalIndex,
normalStart, normalStart+(numNormalsUsed==0 ? 1 : numNormalsUsed), normalStart, normalStart+(numNormalsUsed==0 ? 1 : numNormalsUsed),
g->getNormalBinding()==osg::Geometry::BIND_PER_VERTEX ? primSize : 0); g->getNormalBinding()==deprecated_osg::Geometry::BIND_PER_VERTEX ? primSize : 0);
if (ivMaterial) if (ivMaterial)
processIndices(g->getColorIndices(), drawElemIndices, ((SoIndexedShape*)shape)->materialIndex, processIndices(drawElemIndices, ((SoIndexedShape*)shape)->materialIndex,
colorStart, colorStart+(numColorsUsed==0 ? 1 : numColorsUsed), colorStart, colorStart+(numColorsUsed==0 ? 1 : numColorsUsed),
g->getColorBinding()==osg::Geometry::BIND_PER_VERTEX ? primSize : 0); g->getColorBinding()==deprecated_osg::Geometry::BIND_PER_VERTEX ? primSize : 0);
if (ivTexCoords && !ivTexCoords->isOfType(SoTextureCoordinateFunction::getClassTypeId())) if (ivTexCoords && !ivTexCoords->isOfType(SoTextureCoordinateFunction::getClassTypeId()))
processIndices(g->getTexCoordIndices(0), drawElemIndices, ((SoIndexedShape*)shape)->textureCoordIndex, processIndices(drawElemIndices, ((SoIndexedShape*)shape)->textureCoordIndex,
startIndex, stopIndex, primSize); startIndex, stopIndex, primSize);
// Post-processing for DrawArrayLengths // Post-processing for DrawArrayLengths
@ -1186,10 +1167,10 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
postProcessDrawArrayLengths(drawArrayLengths, &((SoIndexedShape*)shape)->coordIndex); postProcessDrawArrayLengths(drawArrayLengths, &((SoIndexedShape*)shape)->coordIndex);
if (ivNormals && g->getNormalBinding()==osg::Geometry::BIND_PER_VERTEX) if (ivNormals && g->getNormalBinding()==deprecated_osg::Geometry::BIND_PER_VERTEX)
postProcessDrawArrayLengths(drawArrayLengths, &((SoIndexedShape*)shape)->normalIndex); postProcessDrawArrayLengths(drawArrayLengths, &((SoIndexedShape*)shape)->normalIndex);
if (ivMaterial && g->getColorBinding()==osg::Geometry::BIND_PER_VERTEX) if (ivMaterial && g->getColorBinding()==deprecated_osg::Geometry::BIND_PER_VERTEX)
postProcessDrawArrayLengths(drawArrayLengths, &((SoIndexedShape*)shape)->materialIndex); postProcessDrawArrayLengths(drawArrayLengths, &((SoIndexedShape*)shape)->materialIndex);
if (ivTexCoords && !ivTexCoords->isOfType(SoTextureCoordinateFunction::getClassTypeId())) if (ivTexCoords && !ivTexCoords->isOfType(SoTextureCoordinateFunction::getClassTypeId()))
@ -1214,8 +1195,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
nonIndexedCoords = new SoCoordinate4; nonIndexedCoords = new SoCoordinate4;
if (ok) { if (ok) {
((SoCoordinate4*)nonIndexedCoords)->point.setNum(n); ((SoCoordinate4*)nonIndexedCoords)->point.setNum(n);
ok = ivProcessArray<SbVec4f,SoMFVec4f>(g->getVertexIndices(), ok = ivProcessArray<SbVec4f,SoMFVec4f>(drawElemIndices,
drawElemIndices,
&((SoCoordinate4*)nonIndexedCoords)->point, &((SoCoordinate4*)nonIndexedCoords)->point,
&((SoCoordinate4*)ivCoords)->point, &((SoCoordinate4*)ivCoords)->point,
startIndex, n); startIndex, n);
@ -1224,8 +1204,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
nonIndexedCoords = new SoCoordinate3; nonIndexedCoords = new SoCoordinate3;
if (ok) { if (ok) {
((SoCoordinate3*)nonIndexedCoords)->point.setNum(n); ((SoCoordinate3*)nonIndexedCoords)->point.setNum(n);
ok = ivProcessArray<SbVec3f,SoMFVec3f>(g->getVertexIndices(), ok = ivProcessArray<SbVec3f,SoMFVec3f>(drawElemIndices,
drawElemIndices,
&((SoCoordinate3*)nonIndexedCoords)->point, &((SoCoordinate3*)nonIndexedCoords)->point,
&((SoCoordinate3*)ivCoords)->point, &((SoCoordinate3*)ivCoords)->point,
startIndex, n); startIndex, n);
@ -1241,8 +1220,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
if (ok) if (ok)
{ {
((SoTextureCoordinate2*)nonIndexedTexCoords)->point.setNum(n); ((SoTextureCoordinate2*)nonIndexedTexCoords)->point.setNum(n);
ok = ivProcessArray<SbVec2f,SoMFVec2f>(g->getTexCoordIndices(0), ok = ivProcessArray<SbVec2f,SoMFVec2f>(drawElemIndices,
drawElemIndices,
&((SoTextureCoordinate2*)nonIndexedTexCoords)->point, &((SoTextureCoordinate2*)nonIndexedTexCoords)->point,
&((SoTextureCoordinate2*)ivTexCoords)->point, &((SoTextureCoordinate2*)ivTexCoords)->point,
startIndex, n); startIndex, n);
@ -1255,8 +1233,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
if (ok) if (ok)
{ {
((SoTextureCoordinate3*)nonIndexedTexCoords)->point.setNum(n); ((SoTextureCoordinate3*)nonIndexedTexCoords)->point.setNum(n);
ok = ivProcessArray<SbVec3f,SoMFVec3f>(g->getTexCoordIndices(0), ok = ivProcessArray<SbVec3f,SoMFVec3f>(drawElemIndices,
drawElemIndices,
&((SoTextureCoordinate3*)nonIndexedTexCoords)->point, &((SoTextureCoordinate3*)nonIndexedTexCoords)->point,
&((SoTextureCoordinate3*)ivCoords)->point, &((SoTextureCoordinate3*)ivCoords)->point,
startIndex, n); startIndex, n);
@ -1272,8 +1249,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
nonIndexedNormals = new SoNormal; nonIndexedNormals = new SoNormal;
if (ok) { if (ok) {
nonIndexedNormals->vector.setNum(numNormalsUsed==0 ? 1 : numNormalsUsed); nonIndexedNormals->vector.setNum(numNormalsUsed==0 ? 1 : numNormalsUsed);
ok = ivProcessArray<SbVec3f,SoMFVec3f>(g->getNormalIndices(), ok = ivProcessArray<SbVec3f,SoMFVec3f>(g->getNormalBinding()==deprecated_osg::Geometry::BIND_PER_VERTEX ? drawElemIndices : NULL,
g->getNormalBinding()==osg::Geometry::BIND_PER_VERTEX ? drawElemIndices : NULL,
&nonIndexedNormals->vector, &ivNormals->vector, &nonIndexedNormals->vector, &ivNormals->vector,
normalStart, numNormalsUsed==0 ? 1 : numNormalsUsed); normalStart, numNormalsUsed==0 ? 1 : numNormalsUsed);
} }
@ -1295,8 +1271,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
&((SoMaterial*)ivMaterial)->diffuseColor : &((SoMaterial*)ivMaterial)->diffuseColor :
&((SoBaseColor*)ivMaterial)->rgb; &((SoBaseColor*)ivMaterial)->rgb;
dstColorField->setNum(numColorsUsed==0 ? 1 : numColorsUsed); dstColorField->setNum(numColorsUsed==0 ? 1 : numColorsUsed);
ok = ivProcessArray<SbColor,SoMFColor>(g->getColorIndices(), ok = ivProcessArray<SbColor,SoMFColor>(g->getColorBinding()==deprecated_osg::Geometry::BIND_PER_VERTEX ? drawElemIndices : NULL,
g->getColorBinding()==osg::Geometry::BIND_PER_VERTEX ? drawElemIndices : NULL,
dstColorField, srcColorField, dstColorField, srcColorField,
colorStart, numColorsUsed==0 ? 1 : numColorsUsed); colorStart, numColorsUsed==0 ? 1 : numColorsUsed);
} }
@ -1471,7 +1446,7 @@ static bool processPrimitiveSet(const osg::Geometry *g, const osg::PrimitiveSet
} }
void ConvertToInventor::processGeometry(const osg::Geometry *g, InventorState *ivState) void ConvertToInventor::processGeometry(const deprecated_osg::Geometry *g, InventorState *ivState)
{ {
int normalIndex = 0; int normalIndex = 0;
int colorIndex = 0; int colorIndex = 0;
@ -1598,7 +1573,7 @@ void ConvertToInventor::processGeometry(const osg::Geometry *g, InventorState *i
GLenum mode = pset->getMode(); GLenum mode = pset->getMode();
// Create appropriate SoShape // Create appropriate SoShape
bool useIndices = g->getVertexIndices() != NULL || vrml1Conversion; bool useIndices = vrml1Conversion;
bool needSeparateTriangles = false; bool needSeparateTriangles = false;
SoVertexShape *shape = NULL; SoVertexShape *shape = NULL;
switch (mode) { switch (mode) {
@ -1834,8 +1809,8 @@ void ConvertToInventor::processShapeDrawable(const osg::ShapeDrawable *d, Invent
void ConvertToInventor::processDrawable(osg::Drawable *d) void ConvertToInventor::processDrawable(osg::Drawable *d)
{ {
osg::Geometry *g = d->asGeometry(); // FIXME: other drawables have to be handled also deprecated_osg::Geometry *g = dynamic_cast<deprecated_osg::Geometry*>(d); // FIXME: other drawables have to be handled also
osg::ShapeDrawable *sd; osg::ShapeDrawable *sd = 0;
// Create SoSeparator and convert StateSet for Drawable // Create SoSeparator and convert StateSet for Drawable
InventorState *ivDrawableState = createInventorState(d->getStateSet()); InventorState *ivDrawableState = createInventorState(d->getStateSet());

View File

@ -128,7 +128,7 @@ protected:
int uniqueIdGenerator; int uniqueIdGenerator;
void processDrawable(osg::Drawable *d); void processDrawable(osg::Drawable *d);
void processGeometry(const osg::Geometry *g, InventorState *ivState); void processGeometry(const deprecated_osg::Geometry *g, InventorState *ivState);
void processShapeDrawable(const osg::ShapeDrawable *d, InventorState *ivState); void processShapeDrawable(const osg::ShapeDrawable *d, InventorState *ivState);
virtual InventorState* createInventorState(const osg::StateSet *ss); virtual InventorState* createInventorState(const osg::StateSet *ss);

View File

@ -550,7 +550,7 @@ bool daeWriter::processGeometry( osg::Geometry *geom, domGeometry *geo, const st
domPolygons *polys = NULL; domPolygons *polys = NULL;
domPolylist *polylist = NULL; domPolylist *polylist = NULL;
// make sure no deprecated indices or BIND_PER_PRIMITIVE remain // make sure no deprecated indices or binding exist
if (geom->containsDeprecatedData()) geom->fixDeprecatedData(); if (geom->containsDeprecatedData()) geom->fixDeprecatedData();
ArrayNIndices verts( geom->getVertexArray(), 0 ); ArrayNIndices verts( geom->getVertexArray(), 0 );

View File

@ -46,9 +46,12 @@ public:
_lastFaceIndex(0), _lastFaceIndex(0),
_material(material), _material(material),
_curNormalIndex(0), _curNormalIndex(0),
_normalBinding(geo->getNormalBinding()), _normalBinding(osg::Geometry::BIND_OFF),
_mesh(0) _mesh(0)
{ {
if (geo->containsDeprecatedData()) geom->fixDeprecatedData();
_normalBinding = geo->getNormalBinding();
if (!geo->getNormalArray() || geo->getNormalArray()->getNumElements()==0) if (!geo->getNormalArray() || geo->getNormalArray()->getNumElements()==0)
{ {
_normalBinding = osg::Geometry::BIND_OFF; // Turn off binding if there is no normal data _normalBinding = osg::Geometry::BIND_OFF; // Turn off binding if there is no normal data
@ -144,7 +147,6 @@ protected:
for (IndexPointer iptr = indices; iptr < ilast; iptr+=3) for (IndexPointer iptr = indices; iptr < ilast; iptr+=3)
{ {
writeTriangle(iptr[0], iptr[1], iptr[2]); writeTriangle(iptr[0], iptr[1], iptr[2]);
if (_normalBinding == osg::Geometry::BIND_PER_PRIMITIVE) ++_curNormalIndex;
} }
break; break;
} }
@ -156,7 +158,6 @@ protected:
if (i & 1) writeTriangle(iptr[0], iptr[2], iptr[1]); if (i & 1) writeTriangle(iptr[0], iptr[2], iptr[1]);
else writeTriangle(iptr[0], iptr[1], iptr[2]); else writeTriangle(iptr[0], iptr[1], iptr[2]);
} }
if (_normalBinding == osg::Geometry::BIND_PER_PRIMITIVE) ++_curNormalIndex;
break; break;
} }
case GL_QUADS: case GL_QUADS:
@ -166,7 +167,6 @@ protected:
{ {
writeTriangle(iptr[0], iptr[1], iptr[2]); writeTriangle(iptr[0], iptr[1], iptr[2]);
writeTriangle(iptr[0], iptr[2], iptr[3]); writeTriangle(iptr[0], iptr[2], iptr[3]);
if (_normalBinding == osg::Geometry::BIND_PER_PRIMITIVE) ++_curNormalIndex;
} }
break; break;
} }
@ -178,7 +178,6 @@ protected:
writeTriangle(iptr[0], iptr[1], iptr[2]); writeTriangle(iptr[0], iptr[1], iptr[2]);
writeTriangle(iptr[1], iptr[3], iptr[2]); writeTriangle(iptr[1], iptr[3], iptr[2]);
} }
if (_normalBinding == osg::Geometry::BIND_PER_PRIMITIVE) ++_curNormalIndex;
break; break;
} }
case GL_POLYGON: // treat polygons as GL_TRIANGLE_FAN case GL_POLYGON: // treat polygons as GL_TRIANGLE_FAN
@ -191,7 +190,6 @@ protected:
{ {
writeTriangle(first, iptr[0], iptr[1]); writeTriangle(first, iptr[0], iptr[1]);
} }
if (_normalBinding == osg::Geometry::BIND_PER_PRIMITIVE) ++_curNormalIndex;
break; break;
} }
case GL_POINTS: case GL_POINTS:
@ -232,7 +230,6 @@ void PrimitiveIndexWriter::drawArrays(GLenum mode,GLint first,GLsizei count)
for (GLsizei i = 2; i < count; i += 3, pos += 3) for (GLsizei i = 2; i < count; i += 3, pos += 3)
{ {
writeTriangle(pos, pos + 1, pos + 2); writeTriangle(pos, pos + 1, pos + 2);
if (_normalBinding == osg::Geometry::BIND_PER_PRIMITIVE) ++_curNormalIndex;
} }
break; break;
case GL_TRIANGLE_STRIP: case GL_TRIANGLE_STRIP:
@ -241,14 +238,12 @@ void PrimitiveIndexWriter::drawArrays(GLenum mode,GLint first,GLsizei count)
if (i & 1) writeTriangle(pos, pos + 2, pos + 1); if (i & 1) writeTriangle(pos, pos + 2, pos + 1);
else writeTriangle(pos, pos + 1, pos + 2); else writeTriangle(pos, pos + 1, pos + 2);
} }
if (_normalBinding == osg::Geometry::BIND_PER_PRIMITIVE) ++_curNormalIndex;
break; break;
case GL_QUADS: case GL_QUADS:
for (GLsizei i = 3; i < count; i += 4, pos += 4) for (GLsizei i = 3; i < count; i += 4, pos += 4)
{ {
writeTriangle(pos, pos + 1, pos + 2); writeTriangle(pos, pos + 1, pos + 2);
writeTriangle(pos, pos + 2, pos + 3); writeTriangle(pos, pos + 2, pos + 3);
if (_normalBinding == osg::Geometry::BIND_PER_PRIMITIVE) ++_curNormalIndex;
} }
break; break;
case GL_QUAD_STRIP: case GL_QUAD_STRIP:
@ -257,7 +252,6 @@ void PrimitiveIndexWriter::drawArrays(GLenum mode,GLint first,GLsizei count)
writeTriangle(pos, pos + 1, pos + 2); writeTriangle(pos, pos + 1, pos + 2);
writeTriangle(pos + 1, pos + 3, pos + 2); writeTriangle(pos + 1, pos + 3, pos + 2);
} }
if (_normalBinding == osg::Geometry::BIND_PER_PRIMITIVE) ++_curNormalIndex;
break; break;
case GL_POLYGON: // treat polygons as GL_TRIANGLE_FAN case GL_POLYGON: // treat polygons as GL_TRIANGLE_FAN
case GL_TRIANGLE_FAN: case GL_TRIANGLE_FAN:
@ -266,7 +260,6 @@ void PrimitiveIndexWriter::drawArrays(GLenum mode,GLint first,GLsizei count)
{ {
writeTriangle(first, pos, pos+1); writeTriangle(first, pos, pos+1);
} }
if (_normalBinding == osg::Geometry::BIND_PER_PRIMITIVE) ++_curNormalIndex;
break; break;
case GL_POINTS: case GL_POINTS:
case GL_LINES: case GL_LINES:
@ -535,7 +528,6 @@ WriterNodeVisitor::setControlPointAndNormalsAndUV(const osg::Geode& geo,
//switch (pGeometry->getNormalBinding()) //switch (pGeometry->getNormalBinding())
//{ //{
//case osg::Geometry::BIND_PER_PRIMITIVE_SET: //case osg::Geometry::BIND_PER_PRIMITIVE_SET:
//case osg::Geometry::BIND_PER_PRIMITIVE:
//case osg::Geometry::BIND_PER_VERTEX: //case osg::Geometry::BIND_PER_VERTEX:
// break; // break;
//} //}
@ -615,7 +607,6 @@ void WriterNodeVisitor::createListTriangle(const osg::Geometry* geo,
unsigned int& drawable_n) unsigned int& drawable_n)
{ {
unsigned int nbVertices = 0; unsigned int nbVertices = 0;
texcoords = false;
{ {
const osg::Array * vecs = geo->getVertexArray(); const osg::Array * vecs = geo->getVertexArray();
if (vecs) if (vecs)

View File

@ -584,20 +584,20 @@ osg::Quat DataInputStream::readQuat(){
osg::Geometry::AttributeBinding DataInputStream::readBinding(){ deprecated_osg::Geometry::AttributeBinding DataInputStream::readBinding(){
char c = readChar(); char c = readChar();
if (_verboseOutput) std::cout<<"readBinding() ["<<(int)c<<"]"<<std::endl; if (_verboseOutput) std::cout<<"readBinding() ["<<(int)c<<"]"<<std::endl;
switch((int)c){ switch((int)c){
case 0: return osg::Geometry::BIND_OFF; case 0: return deprecated_osg::Geometry::BIND_OFF;
case 1: return osg::Geometry::BIND_OVERALL; case 1: return deprecated_osg::Geometry::BIND_OVERALL;
case 2: return static_cast<osg::Geometry::AttributeBinding>(3) /*osg::Geometry::BIND_PER_PRIMITIVE*/; case 2: return deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
case 3: return osg::Geometry::BIND_PER_PRIMITIVE_SET; case 3: return deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET;
case 4: return osg::Geometry::BIND_PER_VERTEX; case 4: return deprecated_osg::Geometry::BIND_PER_VERTEX;
default: default:
throwException("Unknown binding type in DataInputStream::readBinding()"); throwException("Unknown binding type in DataInputStream::readBinding()");
return osg::Geometry::BIND_OFF; return deprecated_osg::Geometry::BIND_OFF;
} }
} }

View File

@ -6,6 +6,9 @@
#include <string> #include <string>
#include <map> #include <map>
#include <vector> #include <vector>
#include <osg/Vec2> #include <osg/Vec2>
#include <osg/Vec3> #include <osg/Vec3>
#include <osg/Vec4> #include <osg/Vec4>
@ -15,8 +18,8 @@
#include <osg/Quat> #include <osg/Quat>
#include <osg/Array> #include <osg/Array>
#include <osg/Matrix> #include <osg/Matrix>
#include <osg/Geometry>
#include <osg/Image> #include <osg/Image>
#include <osg/Geometry>
#include <osg/StateSet> #include <osg/StateSet>
#include <osg/Uniform> #include <osg/Uniform>
#include <osg/ref_ptr> #include <osg/ref_ptr>
@ -68,7 +71,7 @@ public:
osg::Quat readQuat(); osg::Quat readQuat();
osg::Matrixf readMatrixf(); osg::Matrixf readMatrixf();
osg::Matrixd readMatrixd(); osg::Matrixd readMatrixd();
osg::Geometry::AttributeBinding readBinding(); deprecated_osg::Geometry::AttributeBinding readBinding();
osg::Array* readArray(); osg::Array* readArray();
osg::IntArray* readIntArray(); osg::IntArray* readIntArray();
osg::UByteArray* readUByteArray(); osg::UByteArray* readUByteArray();

View File

@ -507,13 +507,13 @@ void DataOutputStream::writeQuat(const osg::Quat& q){
if (_verboseOutput) std::cout<<"read/writeQuat() ["<<q<<"]"<<std::endl; if (_verboseOutput) std::cout<<"read/writeQuat() ["<<q<<"]"<<std::endl;
} }
void DataOutputStream::writeBinding(osg::Geometry::AttributeBinding b){ void DataOutputStream::writeBinding(deprecated_osg::Geometry::AttributeBinding b){
switch(b){ switch(b){
case osg::Geometry::BIND_OFF: writeChar((char) 0); break; case deprecated_osg::Geometry::BIND_OFF: writeChar((char) 0); break;
case osg::Geometry::BIND_OVERALL: writeChar((char) 1); break; case deprecated_osg::Geometry::BIND_OVERALL: writeChar((char) 1); break;
case static_cast<osg::Geometry::AttributeBinding>(3): writeChar((char) 2); break; /*osg::Geometry::BIND_PER_PRIMITIVE*/ case deprecated_osg::Geometry::BIND_PER_PRIMITIVE: writeChar((char) 2); break;
case osg::Geometry::BIND_PER_PRIMITIVE_SET: writeChar((char) 3); break; case deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET: writeChar((char) 3); break;
case osg::Geometry::BIND_PER_VERTEX: writeChar((char) 4); break; case deprecated_osg::Geometry::BIND_PER_VERTEX: writeChar((char) 4); break;
default: throwException("Unknown binding in DataOutputStream::writeBinding()"); default: throwException("Unknown binding in DataOutputStream::writeBinding()");
} }

View File

@ -62,7 +62,7 @@ public:
void writePlane(const osg::Plane& v); void writePlane(const osg::Plane& v);
void writeVec4ub(const osg::Vec4ub& v); void writeVec4ub(const osg::Vec4ub& v);
void writeQuat(const osg::Quat& q); void writeQuat(const osg::Quat& q);
void writeBinding(osg::Geometry::AttributeBinding b); void writeBinding(deprecated_osg::Geometry::AttributeBinding b);
void writeArray(const osg::Array* a); void writeArray(const osg::Array* a);
void writeIntArray(const osg::IntArray* a); void writeIntArray(const osg::IntArray* a);
void writeUByteArray(const osg::UByteArray* a); void writeUByteArray(const osg::UByteArray* a);

View File

@ -12,13 +12,9 @@
* Copyright 2003 VR-C * Copyright 2003 VR-C
**********************************************************************/ **********************************************************************/
#include <osg/Config> #include "Geometry.h"
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include "Exception.h" #include "Exception.h"
#include "Geometry.h"
#include "Drawable.h" #include "Drawable.h"
#include "DrawArrays.h" #include "DrawArrays.h"
#include "DrawArrayLengths.h" #include "DrawArrayLengths.h"
@ -144,7 +140,7 @@ void Geometry::write(DataOutputStream* out){
if (tcal[j].valid()){ if (tcal[j].valid()){
out->writeArray(tcal[j].get()); out->writeArray(tcal[j].get());
} }
// Write indices if valid // Write indices if valid
const osg::IndexArray* indices = getTexCoordIndices(j); const osg::IndexArray* indices = getTexCoordIndices(j);
out->writeBool(indices!=0); out->writeBool(indices!=0);
@ -162,11 +158,11 @@ void Geometry::write(DataOutputStream* out){
const osg::Array* array = vaal[j].get(); const osg::Array* array = vaal[j].get();
if (array) if (array)
{ {
out->writeBinding(static_cast<osg::Geometry::AttributeBinding>(array->getBinding())); out->writeBinding(static_cast<deprecated_osg::Geometry::AttributeBinding>(array->getBinding()));
out->writeBool(array->getNormalize()); out->writeBool(array->getNormalize());
out->writeBool(true); out->writeBool(true);
out->writeArray(array); out->writeArray(array);
// Write indices if valid // Write indices if valid
const osg::IndexArray* indices = getVertexAttribIndices(j); const osg::IndexArray* indices = getVertexAttribIndices(j);
out->writeBool(indices!=0); out->writeBool(indices!=0);
@ -253,7 +249,7 @@ void Geometry::read(DataInputStream* in){
{ {
bool na =in->readBool(); bool na =in->readBool();
if(na){ if(na){
osg::Geometry::AttributeBinding binding = in->readBinding(); deprecated_osg::Geometry::AttributeBinding binding = in->readBinding();
setNormalArray(in->readVec3Array()); setNormalArray(in->readVec3Array());
setNormalBinding(binding); setNormalBinding(binding);
} }
@ -262,7 +258,7 @@ void Geometry::read(DataInputStream* in){
{ {
bool na =in->readBool(); bool na =in->readBool();
if(na){ if(na){
osg::Geometry::AttributeBinding binding = in->readBinding(); deprecated_osg::Geometry::AttributeBinding binding = in->readBinding();
setNormalArray(in->readArray()); setNormalArray(in->readArray());
setNormalBinding(binding); setNormalBinding(binding);
} }
@ -275,7 +271,7 @@ void Geometry::read(DataInputStream* in){
} }
// Read color array if any. // Read color array if any.
if(in->readBool()){ if(in->readBool()){
osg::Geometry::AttributeBinding binding = in->readBinding(); deprecated_osg::Geometry::AttributeBinding binding = in->readBinding();
setColorArray(in->readArray()); setColorArray(in->readArray());
setColorBinding(binding); setColorBinding(binding);
} }
@ -285,7 +281,7 @@ void Geometry::read(DataInputStream* in){
} }
// Read secondary color array if any // Read secondary color array if any
if(in->readBool()){ if(in->readBool()){
osg::Geometry::AttributeBinding binding = in->readBinding(); deprecated_osg::Geometry::AttributeBinding binding = in->readBinding();
setSecondaryColorArray(in->readArray()); setSecondaryColorArray(in->readArray());
setSecondaryColorBinding(binding); setSecondaryColorBinding(binding);
} }
@ -295,7 +291,7 @@ void Geometry::read(DataInputStream* in){
} }
// Read fog coord array if any // Read fog coord array if any
if(in->readBool()){ if(in->readBool()){
osg::Geometry::AttributeBinding binding = in->readBinding(); deprecated_osg::Geometry::AttributeBinding binding = in->readBinding();
setFogCoordArray(in->readArray()); setFogCoordArray(in->readArray());
setFogCoordBinding(binding); setFogCoordBinding(binding);
} }
@ -321,7 +317,7 @@ void Geometry::read(DataInputStream* in){
size = in->readInt(); size = in->readInt();
for(i =0;i<size;i++) for(i =0;i<size;i++)
{ {
osg::Geometry::AttributeBinding binding = in->readBinding(); deprecated_osg::Geometry::AttributeBinding binding = in->readBinding();
bool normalize = in->readBool(); bool normalize = in->readBool();
// Read coords if valid // Read coords if valid

View File

@ -5,10 +5,10 @@
#include "ReadWrite.h" #include "ReadWrite.h"
namespace ive{ namespace ive{
class Geometry : public ReadWrite, public osg::Geometry{ class Geometry : public ReadWrite, public deprecated_osg::Geometry {
public: public:
void write(DataOutputStream* out); void write(DataOutputStream* out);
void read(DataInputStream* in); void read(DataInputStream* in);
}; };
} }

View File

@ -6,10 +6,6 @@
* Author(s): Vladimir Vukicevic <vladimir@pobox.com> * Author(s): Vladimir Vukicevic <vladimir@pobox.com>
* *
*/ */
#include <osg/Config>
#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>
@ -379,7 +375,7 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options)
} }
} }
osg::Geometry *geom = new osg::Geometry; deprecated_osg::Geometry *geom = new deprecated_osg::Geometry;
geom->setVertexArray (vertexCoords); geom->setVertexArray (vertexCoords);
geom->setVertexIndices (vertexIndices); geom->setVertexIndices (vertexIndices);
@ -389,7 +385,7 @@ load_md2 (const char *filename, const osgDB::ReaderWriter::Options* options)
geom->setNormalArray (normalCoords); geom->setNormalArray (normalCoords);
geom->setNormalIndices (normalIndices); geom->setNormalIndices (normalIndices);
geom->setNormalBinding (osg::Geometry::BIND_PER_VERTEX); geom->setNormalBinding (deprecated_osg::Geometry::BIND_PER_VERTEX);
geom->addPrimitiveSet (new osg::DrawArrays (osg::PrimitiveSet::TRIANGLES, 0, vertexIndices->size ())); geom->addPrimitiveSet (new osg::DrawArrays (osg::PrimitiveSet::TRIANGLES, 0, vertexIndices->size ()));

View File

@ -1,10 +1,5 @@
// -*-c++-*- // -*-c++-*-
#include <osg/Config>
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include "ConvertFromPerformer.h" #include "ConvertFromPerformer.h"
#include <osg/Group> #include <osg/Group>
@ -84,10 +79,10 @@ ConvertFromPerformer::ConvertFromPerformer()
{ {
_osgRoot = NULL; _osgRoot = NULL;
_gsetBindMap[PFGS_OFF] = osg::Geometry::BIND_OFF; _gsetBindMap[PFGS_OFF] = deprecated_osg::Geometry::BIND_OFF;
_gsetBindMap[PFGS_OVERALL] = osg::Geometry::BIND_OVERALL; _gsetBindMap[PFGS_OVERALL] = deprecated_osg::Geometry::BIND_OVERALL;
_gsetBindMap[PFGS_PER_PRIM] = osg::Geometry::BIND_PER_PRIMITIVE; _gsetBindMap[PFGS_PER_PRIM] = deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
_gsetBindMap[PFGS_PER_VERTEX] = osg::Geometry::BIND_PER_VERTEX; _gsetBindMap[PFGS_PER_VERTEX] = deprecated_osg::Geometry::BIND_PER_VERTEX;
_saveImagesAsRGB = false; _saveImagesAsRGB = false;
_saveAbsoluteImagePath = false; _saveAbsoluteImagePath = false;
@ -546,9 +541,9 @@ osg::Drawable* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet*
} }
// we'll make it easy to convert by using the Performer style osg::GeoSet, // we'll make it easy to convert by using the Performer style osg::GeoSet,
// and then convert back to a osg::Geometry afterwards. // and then convert back to a deprecated_osg::Geometry afterwards.
//osg::ref_ptr<osg::GeoSet> geom = new osg::GeoSet; //osg::ref_ptr<osg::GeoSet> geom = new osg::GeoSet;
osg::Geometry* geom = new osg::Geometry; deprecated_osg::Geometry* geom = new deprecated_osg::Geometry;
int i; int i;

View File

@ -53,7 +53,7 @@ class ConvertFromPerformer {
osg::Material* visitMaterial(osg::StateSet* osgStateSet,pfMaterial* front_mat,pfMaterial* back_mat); osg::Material* visitMaterial(osg::StateSet* osgStateSet,pfMaterial* front_mat,pfMaterial* back_mat);
osg::Texture2D* visitTexture(osg::StateSet* osgStateSet,pfTexture* tex); osg::Texture2D* visitTexture(osg::StateSet* osgStateSet,pfTexture* tex);
typedef std::map<int,osg::Geometry::AttributeBinding> GSetBindingMap; typedef std::map<int,deprecated_osg::Geometry::AttributeBinding> GSetBindingMap;
GSetBindingMap _gsetBindMap; GSetBindingMap _gsetBindMap;

View File

@ -15,7 +15,7 @@
osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97IndexedFaceSet(openvrml::node *vrml_ifs) const osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97IndexedFaceSet(openvrml::node *vrml_ifs) const
{ {
osg::ref_ptr<osg::Geometry> osg_geom = new osg::Geometry(); osg::ref_ptr<deprecated_osg::Geometry> osg_geom = new deprecated_osg::Geometry();
osg_geom->addPrimitiveSet(new osg::DrawArrayLengths(osg::PrimitiveSet::POLYGON)); osg_geom->addPrimitiveSet(new osg::DrawArrayLengths(osg::PrimitiveSet::POLYGON));
@ -160,10 +160,10 @@ osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97IndexedFaceSet(openv
if (vrml_norm_per_vertex->value()) if (vrml_norm_per_vertex->value())
{ {
osg_geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); osg_geom->setNormalBinding(deprecated_osg::Geometry::BIND_PER_VERTEX);
} else } else
{ {
osg_geom->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE); osg_geom->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
} }
} }
} }
@ -214,10 +214,10 @@ osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97IndexedFaceSet(openv
if (vrml_color_per_vertex->value()) if (vrml_color_per_vertex->value())
{ {
osg_geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX); osg_geom->setColorBinding(deprecated_osg::Geometry::BIND_PER_VERTEX);
} else } else
{ {
osg_geom->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); osg_geom->setColorBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
} }
} }
} }
@ -281,7 +281,7 @@ osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97IndexedFaceSet(openv
osg_geom->setNormalArray(normals); osg_geom->setNormalArray(normals);
osg_geom->setNormalIndices(const_cast<osg::IndexArray*>(osg_geom->getVertexIndices())); osg_geom->setNormalIndices(const_cast<osg::IndexArray*>(osg_geom->getVertexIndices()));
osg_geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); osg_geom->setNormalBinding(deprecated_osg::Geometry::BIND_PER_VERTEX);
#endif #endif
} }

View File

@ -16,7 +16,7 @@
osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97IndexedLineSet(openvrml::node *vrml_ifs) const osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97IndexedLineSet(openvrml::node *vrml_ifs) const
{ {
osg::ref_ptr<osg::Geometry> osg_geom = new osg::Geometry(); osg::ref_ptr<deprecated_osg::Geometry> osg_geom = new deprecated_osg::Geometry();
osg_geom->addPrimitiveSet(new osg::DrawArrayLengths(osg::PrimitiveSet::LINE_STRIP)); osg_geom->addPrimitiveSet(new osg::DrawArrayLengths(osg::PrimitiveSet::LINE_STRIP));
@ -117,10 +117,10 @@ osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97IndexedLineSet(openv
if (vrml_color_per_vertex->value()) if (vrml_color_per_vertex->value())
{ {
osg_geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX); osg_geom->setColorBinding(deprecated_osg::Geometry::BIND_PER_VERTEX);
} else } else
{ {
osg_geom->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); osg_geom->setColorBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
} }
} }
} }
@ -143,7 +143,7 @@ osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97Box(openvrml::node*
return (*it).second.get(); return (*it).second.get();
} }
osg::ref_ptr<osg::Geometry> osg_geom = new osg::Geometry(); osg::ref_ptr<deprecated_osg::Geometry> osg_geom = new deprecated_osg::Geometry();
osg::ref_ptr<osg::Vec3Array> osg_vertices = new osg::Vec3Array(); osg::ref_ptr<osg::Vec3Array> osg_vertices = new osg::Vec3Array();
osg::ref_ptr<osg::Vec2Array> osg_texcoords = new osg::Vec2Array(); osg::ref_ptr<osg::Vec2Array> osg_texcoords = new osg::Vec2Array();
osg::ref_ptr<osg::Vec3Array> osg_normals = new osg::Vec3Array(); osg::ref_ptr<osg::Vec3Array> osg_normals = new osg::Vec3Array();
@ -202,7 +202,7 @@ osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97Box(openvrml::node*
osg_geom->setVertexArray(osg_vertices.get()); osg_geom->setVertexArray(osg_vertices.get());
osg_geom->setTexCoordArray(0, osg_texcoords.get()); osg_geom->setTexCoordArray(0, osg_texcoords.get());
osg_geom->setNormalArray(osg_normals.get()); osg_geom->setNormalArray(osg_normals.get());
osg_geom->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE); osg_geom->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
osg_geom->getOrCreateStateSet()->setAttributeAndModes(new osg::CullFace(osg::CullFace::BACK)); osg_geom->getOrCreateStateSet()->setAttributeAndModes(new osg::CullFace(osg::CullFace::BACK));

View File

@ -1,8 +1,3 @@
#include <osg/Config>
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif
#include <osgSim/ScalarBar> #include <osgSim/ScalarBar>
#include <osgText/Text> #include <osgText/Text>
#include <osg/Geometry> #include <osg/Geometry>
@ -142,7 +137,7 @@ void ScalarBar::createDrawables()
// 1. First the bar // 1. First the bar
// ================= // =================
osg::ref_ptr<osg::Geometry> bar = new osg::Geometry(); osg::ref_ptr<deprecated_osg::Geometry> bar = new deprecated_osg::Geometry();
// Create the bar - created in 'real' coordinate space the moment, // Create the bar - created in 'real' coordinate space the moment,
// with xyz values reflecting those of the actual scalar values in play. // with xyz values reflecting those of the actual scalar values in play.
@ -177,13 +172,13 @@ void ScalarBar::createDrawables()
cs->push_back(_stc->getColor(_stc->getMin() + (i*incr) + halfIncr)); cs->push_back(_stc->getColor(_stc->getMin() + (i*incr) + halfIncr));
} }
bar->setColorArray(cs.get()); bar->setColorArray(cs.get());
bar->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE); bar->setColorBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
// Normal // Normal
osg::ref_ptr<osg::Vec3Array> ns(new osg::Vec3Array); osg::ref_ptr<osg::Vec3Array> ns(new osg::Vec3Array);
ns->push_back(osg::Matrix::transform3x3(osg::Vec3(0.0f,0.0f,1.0f),matrix)); ns->push_back(osg::Matrix::transform3x3(osg::Vec3(0.0f,0.0f,1.0f),matrix));
bar->setNormalArray(ns.get()); bar->setNormalArray(ns.get());
bar->setNormalBinding(osg::Geometry::BIND_OVERALL); bar->setNormalBinding(deprecated_osg::Geometry::BIND_OVERALL);
// The Quad strip that represents the bar // The Quad strip that represents the bar
bar->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,vs->size())); bar->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,vs->size()));

View File

@ -1,5 +1,5 @@
#include <osg/Config> #include <osg/Config>
#ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS #ifndef OSG_USE_DEPRECATED_GEOMETRY_METHODS
#define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1 #define OSG_USE_DEPRECATED_GEOMETRY_METHODS 1
#endif #endif
@ -20,8 +20,8 @@ using namespace osgDB;
bool Geometry_readLocalData(Object& obj, Input& fr); bool Geometry_readLocalData(Object& obj, Input& fr);
bool Geometry_writeLocalData(const Object& obj, Output& fw); bool Geometry_writeLocalData(const Object& obj, Output& fw);
bool Geometry_matchBindingTypeStr(const char* str,Geometry::AttributeBinding& mode); bool Geometry_matchBindingTypeStr(const char* str,deprecated_osg::Geometry::AttributeBinding& mode);
const char* Geometry_getBindingTypeStr(Geometry::AttributeBinding mode); const char* Geometry_getBindingTypeStr(deprecated_osg::Geometry::AttributeBinding mode);
bool Geometry_matchPrimitiveModeStr(const char* str,GLenum& mode); bool Geometry_matchPrimitiveModeStr(const char* str,GLenum& mode);
const char* Geometry_getPrimitiveModeStr(GLenum mode); const char* Geometry_getPrimitiveModeStr(GLenum mode);
@ -45,7 +45,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr)
{ {
bool iteratorAdvanced = false; bool iteratorAdvanced = false;
Geometry& geom = static_cast<Geometry&>(obj); deprecated_osg::Geometry& geom = static_cast<deprecated_osg::Geometry&>(obj);
if (fr.matchSequence("Primitives %i {") || fr.matchSequence("PrimitiveSets %i {") ) if (fr.matchSequence("Primitives %i {") || fr.matchSequence("PrimitiveSets %i {") )
{ {
@ -134,7 +134,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr)
} }
Geometry::AttributeBinding normalBinding=Geometry::BIND_OFF; deprecated_osg::Geometry::AttributeBinding normalBinding = deprecated_osg::Geometry::BIND_OFF;
if (fr[0].matchWord("NormalBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),normalBinding)) if (fr[0].matchWord("NormalBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),normalBinding))
{ {
fr+=2; fr+=2;
@ -200,7 +200,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr)
iteratorAdvanced = true; iteratorAdvanced = true;
} }
Geometry::AttributeBinding colorBinding=Geometry::BIND_OFF; deprecated_osg::Geometry::AttributeBinding colorBinding = deprecated_osg::Geometry::BIND_OFF;
if (fr[0].matchWord("ColorBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),colorBinding)) if (fr[0].matchWord("ColorBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),colorBinding))
{ {
fr+=2; fr+=2;
@ -231,7 +231,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr)
} }
Geometry::AttributeBinding secondaryColorBinding=Geometry::BIND_OFF; deprecated_osg::Geometry::AttributeBinding secondaryColorBinding = deprecated_osg::Geometry::BIND_OFF;
if (fr[0].matchWord("SecondaryColorBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),secondaryColorBinding)) if (fr[0].matchWord("SecondaryColorBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),secondaryColorBinding))
{ {
fr+=2; fr+=2;
@ -262,7 +262,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr)
} }
Geometry::AttributeBinding fogCoordBinding=Geometry::BIND_OFF; deprecated_osg::Geometry::AttributeBinding fogCoordBinding = deprecated_osg::Geometry::BIND_OFF;
if (fr[0].matchWord("FogCoordBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),fogCoordBinding)) if (fr[0].matchWord("FogCoordBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),fogCoordBinding))
{ {
fr+=2; fr+=2;
@ -322,7 +322,7 @@ bool Geometry_readLocalData(Object& obj, Input& fr)
iteratorAdvanced = true; iteratorAdvanced = true;
} }
Geometry::AttributeBinding vertexAttribBinding=Geometry::BIND_OFF; deprecated_osg::Geometry::AttributeBinding vertexAttribBinding = deprecated_osg::Geometry::BIND_OFF;
if (fr.matchSequence("VertexAttribBinding %i %w") && Geometry_matchBindingTypeStr(fr[2].getStr(),vertexAttribBinding)) if (fr.matchSequence("VertexAttribBinding %i %w") && Geometry_matchBindingTypeStr(fr[2].getStr(),vertexAttribBinding))
{ {
int unit=0; int unit=0;
@ -1277,7 +1277,7 @@ bool Primitive_writeLocalData(const PrimitiveSet& prim,Output& fw)
bool Geometry_writeLocalData(const Object& obj, Output& fw) bool Geometry_writeLocalData(const Object& obj, Output& fw)
{ {
const Geometry& geom = static_cast<const Geometry&>(obj); const deprecated_osg::Geometry& geom = static_cast<const deprecated_osg::Geometry&>(obj);
const Geometry::PrimitiveSetList& primitives = geom.getPrimitiveSetList(); const Geometry::PrimitiveSetList& primitives = geom.getPrimitiveSetList();
if (!primitives.empty()) if (!primitives.empty())
@ -1377,7 +1377,7 @@ bool Geometry_writeLocalData(const Object& obj, Output& fw)
fw.indent()<<"TexCoordArray "<<i<<" "; fw.indent()<<"TexCoordArray "<<i<<" ";
Array_writeLocalData(*array,fw); Array_writeLocalData(*array,fw);
} }
const osg::IndexArray* indices = (array!=0) ? dynamic_cast<const osg::IndexArray*>(array->getUserData()) : 0; const osg::IndexArray* indices = (array!=0) ? dynamic_cast<const osg::IndexArray*>(array->getUserData()) : 0;
if (indices) if (indices)
{ {
@ -1393,14 +1393,14 @@ bool Geometry_writeLocalData(const Object& obj, Output& fw)
if (array) if (array)
{ {
fw.indent()<<"VertexAttribBinding "<<i<<" "<<Geometry_getBindingTypeStr(static_cast<osg::Geometry::AttributeBinding>(array->getBinding()))<<std::endl; fw.indent()<<"VertexAttribBinding "<<i<<" "<<Geometry_getBindingTypeStr(static_cast<deprecated_osg::Geometry::AttributeBinding>(array->getBinding()))<<std::endl;
if (array->getNormalize()) if (array->getNormalize())
fw.indent()<<"VertexAttribNormalize "<<i<<" TRUE"<<std::endl; fw.indent()<<"VertexAttribNormalize "<<i<<" TRUE"<<std::endl;
else else
fw.indent()<<"VertexAttribNormalize "<<i<<" FALSE"<<std::endl; fw.indent()<<"VertexAttribNormalize "<<i<<" FALSE"<<std::endl;
fw.indent()<<"VertexAttribArray "<<i<<" "; fw.indent()<<"VertexAttribArray "<<i<<" ";
Array_writeLocalData(*array,fw); Array_writeLocalData(*array,fw);
} }
@ -1415,28 +1415,28 @@ bool Geometry_writeLocalData(const Object& obj, Output& fw)
return true; return true;
} }
bool Geometry_matchBindingTypeStr(const char* str,Geometry::AttributeBinding& mode) bool Geometry_matchBindingTypeStr(const char* str,deprecated_osg::Geometry::AttributeBinding& mode)
{ {
if (strcmp(str,"OFF")==0) mode = Geometry::BIND_OFF; if (strcmp(str,"OFF")==0) mode = deprecated_osg::Geometry::BIND_OFF;
else if (strcmp(str,"OVERALL")==0) mode = Geometry::BIND_OVERALL; else if (strcmp(str,"OVERALL")==0) mode = deprecated_osg::Geometry::BIND_OVERALL;
else if (strcmp(str,"PER_PRIMITIVE")==0) mode = Geometry::BIND_PER_PRIMITIVE; else if (strcmp(str,"PER_PRIMITIVE")==0) mode = deprecated_osg::Geometry::BIND_PER_PRIMITIVE;
else if (strcmp(str,"PER_PRIMITIVE_SET")==0) mode = Geometry::BIND_PER_PRIMITIVE_SET; else if (strcmp(str,"PER_PRIMITIVE_SET")==0) mode = deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET;
else if (strcmp(str,"PER_VERTEX")==0) mode = Geometry::BIND_PER_VERTEX; else if (strcmp(str,"PER_VERTEX")==0) mode = deprecated_osg::Geometry::BIND_PER_VERTEX;
else return false; else return false;
return true; return true;
} }
const char* Geometry_getBindingTypeStr(Geometry::AttributeBinding mode) const char* Geometry_getBindingTypeStr(deprecated_osg::Geometry::AttributeBinding mode)
{ {
switch(mode) switch(mode)
{ {
case (Geometry::BIND_OVERALL) : return "OVERALL"; case (deprecated_osg::Geometry::BIND_OVERALL) : return "OVERALL";
case (Geometry::BIND_PER_PRIMITIVE) : return "PER_PRIMITIVE"; case (deprecated_osg::Geometry::BIND_PER_PRIMITIVE) : return "PER_PRIMITIVE";
case (Geometry::BIND_PER_PRIMITIVE_SET) : return "PER_PRIMITIVE_SET"; case (deprecated_osg::Geometry::BIND_PER_PRIMITIVE_SET) : return "PER_PRIMITIVE_SET";
case (Geometry::BIND_PER_VERTEX) : return "PER_VERTEX"; case (deprecated_osg::Geometry::BIND_PER_VERTEX) : return "PER_VERTEX";
case (Geometry::BIND_OFF) : case (deprecated_osg::Geometry::BIND_OFF) :
default : return "OFF"; default : return "OFF";
} }
} }