Replaced deprecated osg::Geometry::set*Binding() usage.

This commit is contained in:
Robert Osfield 2013-06-27 09:54:12 +00:00
parent c1ebc3ac0c
commit 4b9aa1fd24
49 changed files with 1471 additions and 1559 deletions

View File

@ -117,11 +117,9 @@ osg::Node* createBase(const osg::Vec3& center,float radius)
osg::Geometry* geom = new osg::Geometry;
geom->setVertexArray(coords);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE_SET);
geom->setColorArray(colors, osg::Array::BIND_PER_PRIMITIVE_SET);
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(whitePrimitives.get());
geom->addPrimitiveSet(blackPrimitives.get());

View File

@ -168,9 +168,7 @@ osg::Geode* createAxis()
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors.get());
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry.get() );

View File

@ -113,8 +113,7 @@ osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::
osg::Geometry* geom = new osg::Geometry;
geom->setVertexArray(vertices);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP,0,vertices->size()));
osg::Geode* geode = new osg::Geode;
@ -140,8 +139,7 @@ osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::
osg::Geometry* geom = new osg::Geometry;
geom->setVertexArray(vertices);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP,0,vertices->size()));
osg::Geode* geode = new osg::Geode;

View File

@ -60,8 +60,7 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
(*norms)[0] = width^height;
(*norms)[0].normalize();
geom->setNormalArray(norms);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(norms, osg::Array::BIND_OVERALL);
osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(0.0f,0.0f);
@ -111,8 +110,7 @@ osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const os
(*color)[4] = z_color;
(*color)[5] = z_color;
geom->setColorArray(color);
geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geom->setColorArray(color, osg::Array::BIND_PER_VERTEX);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));

View File

@ -836,8 +836,7 @@ osg::Geometry *WallConstraint::makeWallGeometry() const
gm->setVertexArray(getWall(height));
gm->addPrimitiveSet(makeWall());
gm->setTexCoordArray(0,getWallTexcoords(height));
gm->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
gm->setNormalArray(getWallNormals()); // this creates normals to walls
gm->setNormalArray(getWallNormals(), osg::Array::BIND_PER_VERTEX); // this creates normals to walls
return gm.release();
}

View File

@ -68,8 +68,7 @@ osg::Node* createScene()
{
osg::Vec4Array * colours = new osg::Vec4Array(1);
(*colours)[0] = osg::Vec4d(1.0,1.0,1.0,1.0);
unitCircle->setColorArray(colours);
unitCircle->setColorBinding(osg::Geometry::BIND_OVERALL);
unitCircle->setColorArray(colours, osg::Array::BIND_OVERALL);
const unsigned int n_points = 1024;
osg::Vec3Array * coords = new osg::Vec3Array(n_points);
const double dx = 2.0*osg::PI/n_points;
@ -88,8 +87,7 @@ osg::Node* createScene()
{
osg::Vec4Array *colours = new osg::Vec4Array(1);
(*colours)[0] = osg::Vec4d(1.0,0.0,0.0,1.0);
axes->setColorArray(colours);
axes->setColorBinding(osg::Geometry::BIND_OVERALL);
axes->setColorArray(colours, osg::Array::BIND_OVERALL);
osg::Vec3Array *coords = new osg::Vec3Array(6);
(*coords)[0].set(osg::Vec3d(0.0, 0.0, 0.0));
(*coords)[1].set(osg::Vec3d(0.5, 0.0, 0.0));

View File

@ -318,13 +318,11 @@ bool DePee::createHUD()
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(0.0f,0.0,0.0f,0.3f));
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));

View File

@ -142,8 +142,7 @@ osg::Geode* Utility::getCanvasQuad(unsigned width, unsigned height, double depth
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
quad->setColorArray(colors);
quad->setColorBinding(osg::Geometry::BIND_OVERALL);
quad->setColorArray(colors, osg::Array::BIND_OVERALL);
osg::Geode* geode = new osg::Geode();
geode->addDrawable(quad);

View File

@ -141,8 +141,7 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
// pass the created vertex array to the points geometry object.
polyGeom->setVertexArray(vertices);
polyGeom->setColorArray(colors);
polyGeom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
polyGeom->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
polyGeom->setTexCoordArray(0,texcoords);
@ -420,8 +419,7 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
// pass the created vertex array to the points geometry object.
geometry->setVertexArray(vertices);
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
geometry->setTexCoordArray(0,texcoords);

View File

@ -474,8 +474,7 @@ osg::Geode* ForestTechniqueManager::createTerrain(const osg::Vec3& origin, const
}
geometry->setVertexArray(&v);
geometry->setColorArray(&color);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(&color, osg::Array::BIND_OVERALL);
geometry->setTexCoordArray(0,&t);
for(r=0;r<numRows-1;++r)
@ -571,8 +570,7 @@ osg::Geometry* ForestTechniqueManager::createSprite( float w, float h, osg::Vec4
geom->setTexCoordArray( 0, &t );
geom->setColorArray( &c );
geom->setColorBinding( osg::Geometry::BIND_OVERALL );
geom->setColorArray( &c, osg::Array::BIND_OVERALL );
geom->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4) );
@ -618,8 +616,7 @@ osg::Geometry* ForestTechniqueManager::createOrthogonalQuads( const osg::Vec3& p
geom->setTexCoordArray( 0, &t );
geom->setColorArray( &c );
geom->setColorBinding( osg::Geometry::BIND_OVERALL );
geom->setColorArray( &c, osg::Array::BIND_OVERALL );
geom->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,8) );

View File

@ -108,8 +108,7 @@ osg::Geometry *Frame::build_quad(const Rect &rect, const osg::Vec4 &color, bool
clr->push_back(osg::Vec4(black, 0));
}
geo->setColorArray(clr.get());
geo->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geo->setColorArray(clr.get(), osg::Array::BIND_PER_VERTEX);
geo->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, shadow? 12: 4));

View File

@ -72,8 +72,7 @@ osg::ref_ptr<osg::Group> ProcessPass::createTexturedQuad()
quad_geom->setVertexArray(quad_coords.get());
quad_geom->setTexCoordArray(0, quad_tcoords.get());
quad_geom->addPrimitiveSet(quad_da.get());
quad_geom->setColorArray(quad_colors.get());
quad_geom->setColorBinding(osg::Geometry::BIND_OVERALL);
quad_geom->setColorArray(quad_colors.get(), osg::Array::BIND_OVERALL);
_StateSet = quad_geom->getOrCreateStateSet();
_StateSet->setMode(GL_LIGHTING,osg::StateAttribute::OFF);

View File

@ -71,8 +71,7 @@ osg::Node* createScene(osg::Image *start_im)
geom->setVertexArray(vcoords.get());
geom->setTexCoordArray(0,tcoords.get());
geom->addPrimitiveSet(da.get());
geom->setColorArray(colors.get());
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors.get(), osg::Array::BIND_OVERALL);
geomss = geom->getOrCreateStateSet();
geomss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

View File

@ -573,15 +573,13 @@ osg::Node* createBackground()
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
polyGeom->setColorArray(colors);
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
// set the normal in the same way color.
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
polyGeom->setNormalArray(normals);
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec2 myTexCoords[] =
{

View File

@ -141,8 +141,7 @@ public:
SomePoints()
{
osg::Vec4Array* cAry = new osg::Vec4Array;
setColorArray( cAry );
setColorBinding( osg::Geometry::BIND_OVERALL );
setColorArray( cAry, osg::Array::BIND_OVERALL );
cAry->push_back( osg::Vec4(1,1,1,1) );
osg::Vec3Array* vAry = new osg::Vec3Array;

View File

@ -395,8 +395,7 @@ osg::Node* createTrackModel(Track* track, const osg::Vec4& colour)
osg::ref_ptr<osg::Vec4Array> colours = new osg::Vec4Array;
colours->push_back(colour);
geometry->setColorArray(colours.get());
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours.get(), osg::Array::BIND_OVERALL);
geometry->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP, 0, points.size()));

View File

@ -61,8 +61,7 @@ Node *makeBase( void )
geom->setTexCoordArray( 0, tcoords );
geom->setColorArray( colors );
geom->setColorBinding( Geometry::BIND_OVERALL );
geom->setColorArray( colors, Array::BIND_OVERALL );
geom->addPrimitiveSet( new DrawArrays(PrimitiveSet::TRIANGLE_FAN,0,19) );

View File

@ -108,8 +108,7 @@ Node *makeSky( void )
geom->setVertexArray( &coords );
geom->setTexCoordArray( 0, &tcoords );
geom->setColorArray( &colors );
geom->setColorBinding( Geometry::BIND_PER_VERTEX );
geom->setColorArray( &colors, Array::BIND_PER_VERTEX );
Texture2D *tex = new Texture2D;

View File

@ -112,8 +112,7 @@ Node *makeTerrain( void )
geom->setVertexArray( &v );
geom->setTexCoordArray( 0, &t );
geom->setColorArray( &col );
geom->setColorBinding( Geometry::BIND_OVERALL );
geom->setColorArray( &col, Array::BIND_OVERALL );
for( i = 0; i < m-2; i++ )
{

View File

@ -198,8 +198,7 @@ static Geometry *makeTree( _tree *tree, StateSet *dstate )
geom->setTexCoordArray( 0, &t );
geom->setColorArray( &l );
geom->setColorBinding( Geometry::BIND_OVERALL );
geom->setColorArray( &l, Array::BIND_OVERALL );
geom->addPrimitiveSet( new DrawArrays(PrimitiveSet::QUADS,0,4) );

View File

@ -166,13 +166,11 @@ osg::Camera* createHUD()
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0,0.8f,0.2f));
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));

View File

@ -203,8 +203,7 @@ osg::Geometry* createWall(const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec
osg::Vec4Array* colors = new osg::Vec4Array(1);
(*colors)[0].set(1.0f,1.0f,1.0f,1.0f);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
for(row=0;row<noYSteps-1;++row)

View File

@ -119,14 +119,12 @@ osg::Geometry* createWing(const osg::Vec3& left, const osg::Vec3& nose, const os
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(normal);
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(color);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_POLYGON,0,vertices->getNumElements()));
@ -373,13 +371,11 @@ osg:: Node* createBackdrop(const osg::Vec3& corner,const osg::Vec3& top,const os
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(normal);
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,vertices->getNumElements()));

View File

@ -141,10 +141,6 @@ protected:
};
bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv)
{
switch(ea.getEventType())
@ -429,8 +425,7 @@ static osg::Node* readImageStream(const std::string& file_name, osg::Vec3& p, fl
osg::Vec4Array* colors = new osg::Vec4Array();
colors->push_back(osg::Vec4(0.7, 0.7, 0.7, 1));
geo->setColorArray(colors);
geo->setColorBinding(osg::Geometry::BIND_OVERALL);
geo->setColorArray(colors, osg::Array::BIND_OVERALL);
p[0] += w + 10;

View File

@ -141,8 +141,7 @@ osg::Group* createRTTQuad(unsigned int tex_width, unsigned int tex_height, bool
quad_geom->setVertexArray(quad_coords.get());
quad_geom->setTexCoordArray(0, quad_tcoords.get());
quad_geom->addPrimitiveSet(quad_da.get());
quad_geom->setColorArray(quad_colors.get());
quad_geom->setColorBinding(osg::Geometry::BIND_OVERALL);
quad_geom->setColorArray(quad_colors.get(), osg::Array::BIND_OVERALL);
osg::StateSet *stateset = quad_geom->getOrCreateStateSet();
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
@ -254,8 +253,7 @@ osg::Node* createScene(osg::Node* cam_subgraph, unsigned int tex_width, unsigned
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
polyGeom->setColorArray(colors);
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,vertices->size()));

View File

@ -211,8 +211,7 @@ osg::Node* createOccluder(const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec
osg::Vec4Array* colors = new osg::Vec4Array(1);
(*colors)[0].set(1.0f,1.0f,1.0f,0.5f);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));

View File

@ -242,8 +242,7 @@ osg::Node* DepthPeeling::createQuad(unsigned int layerNumber, unsigned int numTi
geometry->setVertexArray(vertices);
geometry->setTexCoordArray(0, texcoords);
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colors, osg::Array::BIND_OVERALL);
geometry->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, 4));

View File

@ -125,10 +125,10 @@ Heatmap::Heatmap(float width, float depth, float maxheight, unsigned int K, unsi
xypositions->push_back(osg::Vec2(1.0f-0.5f/(O*K),((float)y+0.5f)/(O*N)));
}
}
xypositions->setBinding(osg::Array::BIND_PER_VERTEX);
xypositions->setNormalize(false);
meshGeom->setVertexAttribArray(6, xypositions);
meshGeom->setVertexAttribNormalize(6, false);
meshGeom->setVertexAttribBinding(6, osg::Geometry::BIND_PER_VERTEX);
meshGeom->setVertexArray(vertices);
// generate several tri strips to form a mesh

View File

@ -305,8 +305,7 @@ osg::Node* createHUD()
osg::Vec4Array* colors = new osg::Vec4Array;
colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(0.8-0.1*i,0.1*i,0.2*i, 1.0));
quad->setColorArray(colors);
quad->setColorBinding(osg::Geometry::BIND_OVERALL);
quad->setColorArray(colors, osg::Array::BIND_OVERALL);
(*vertices)[0]=position;
(*vertices)[1]=position+dx;
(*vertices)[2]=position+dx+dy;

View File

@ -195,8 +195,7 @@ osg::Node* createHUD(osgText::Text* updateText)
osg::Vec4Array* colors = new osg::Vec4Array;
colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(0.8-0.1*i,0.1*i,0.2*i, 1.0));
quad->setColorArray(colors);
quad->setColorBinding(osg::Geometry::BIND_OVERALL);
quad->setColorArray(colors, osg::Array::BIND_OVERALL);
(*vertices)[0]=position;
(*vertices)[1]=position+dx;
(*vertices)[2]=position+dx+dy;

View File

@ -77,8 +77,7 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
(*norms)[0] = width^height;
(*norms)[0].normalize();
geom->setNormalArray(norms);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(norms, osg::Array::BIND_OVERALL);
osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(0.0f,0.0f);
@ -89,8 +88,7 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0f,1.0f);
geom->setColorArray(colours);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colours, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
@ -397,8 +395,7 @@ osg::Geode* SolarSystem::createPlanet( double radius, const std::string& name, c
// set the single colour so bind overall
osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0] = color;
sPlanetSphere->setColorArray(colours);
sPlanetSphere->setColorBinding(osg::Geometry::BIND_OVERALL);
sPlanetSphere->setColorArray(colours, osg::Array::BIND_OVERALL);
// now set up the coords, normals and texcoords for geometry
@ -410,8 +407,7 @@ osg::Geode* SolarSystem::createPlanet( double radius, const std::string& name, c
sPlanetSphere->setVertexArray(coords);
osg::Vec3Array* normals = new osg::Vec3Array(numVertices);
sPlanetSphere->setNormalArray(normals);
sPlanetSphere->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
sPlanetSphere->setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
osg::Vec2Array* texcoords = new osg::Vec2Array(numVertices);
sPlanetSphere->setTexCoordArray(0,texcoords);

View File

@ -55,8 +55,7 @@ osg::Geode *makeGalaxy(unsigned nvertices)
colors->push_back(ini+(fin-ini)*(i*2/(float)nvertices));
}
galaxy->setVertexArray(vertices);
galaxy->setColorArray(colors);
galaxy->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
galaxy->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
galaxy->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, nvertices));
geode->addDrawable(galaxy);
return geode;

View File

@ -293,8 +293,7 @@ osg::Node* createPreRenderSubGraph(osg::Node* subgraph,
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
polyGeom->setColorArray(colors);
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,vertices->size()));

View File

@ -92,8 +92,7 @@ osg::Drawable* createMirrorSurface(float xMin,float xMax,float yMin,float yMax,f
osg::Vec3Array* norms = new osg::Vec3Array(1);
(*norms)[0].set(0.0f,0.0f,1.0f);
geom->setNormalArray(norms);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(norms, osg::Array::BIND_OVERALL);
osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(0.0f,1.0f);
@ -104,8 +103,7 @@ osg::Drawable* createMirrorSurface(float xMin,float xMax,float yMin,float yMax,f
osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0,1.0f);
geom->setColorArray(colours);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colours, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));

View File

@ -229,8 +229,7 @@ osg::Node* createScene()
}
geometry->setVertexArray(&v);
geometry->setColorArray(&color);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(&color, osg::Array::BIND_OVERALL);
for(r=0;r<numRows-1;++r)
{

View File

@ -413,15 +413,13 @@ static osg::Geode* createObjects( osg::HeightField * grid, unsigned int density
geometry->setVertexArray(vertices);
osg::Vec3Array* normals = new osg::Vec3Array;
geometry->setNormalArray(normals);
geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
osg::Vec2Array* texCoords = new osg::Vec2Array;
geometry->setTexCoordArray(0, texCoords);
osg::Vec4Array* colours = new osg::Vec4Array;
geometry->setColorArray(colours);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
colours->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
for( unsigned int x = 0; x < grid->getNumColumns() - 1; x++ )

View File

@ -194,12 +194,10 @@ namespace ModelOne
geometry->setVertexArray(vertices);
osg::Vec3Array* normals = new osg::Vec3Array;
geometry->setNormalArray(normals);
geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
osg::Vec4Array* colours = new osg::Vec4Array;
geometry->setColorArray(colours);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
colours->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));

View File

@ -268,14 +268,12 @@ osg::Geode* createGeometry()
// add normals
unsigned int numNormals = sizeof(myNormals)/sizeof(myNormals[0]);
geom->setNormalArray(new osg::Vec3Array(numNormals,const_cast<osg::Vec3*>(&myNormals[0])));
geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
geom->setNormalArray(new osg::Vec3Array(numNormals,const_cast<osg::Vec3*>(&myNormals[0])), osg::Array::BIND_PER_VERTEX);
// add colors
unsigned int numColors = sizeof(myColors)/sizeof(myColors[0]);
osg::Vec4Array* normal_array = new osg::Vec4Array(numColors,const_cast<osg::Vec4*>(&myColors[0]));
geom->setColorArray(normal_array);
geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geom->setColorArray(normal_array, osg::Array::BIND_PER_VERTEX);
// add PrimitiveSet
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, numVertices));

View File

@ -91,8 +91,7 @@ osg::Node* createScene(unsigned int noStars)
// set up colours
osg::Vec4Array* colours = new osg::Vec4Array(1);
geometry->setColorArray(colours);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
(*colours)[0].set(1.0f,1.0f,1.0f,1.0f);
// set up the primitive set to draw lines

View File

@ -317,8 +317,7 @@ osg::Group* createOverlay(const osg::Vec3& center, float radius)
osg::Vec4ubArray& color = *(new osg::Vec4ubArray(1));
color[0].set(0,0,0,255);
geom->setColorArray(&color);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(&color, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINES,0,vertices->getNumElements()));
@ -435,8 +434,7 @@ void build_world(osg::Group *root, unsigned int testCase, bool useOverlay, osgSi
geometry->setVertexArray(&v);
geometry->setTexCoordArray(0, &tc);
geometry->setColorArray(&color);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(&color, osg::Array::BIND_OVERALL);
for(r=0;r<numRows-1;++r)
{

View File

@ -127,8 +127,7 @@ osg::Geode* createSectorForImage(osg::Image* image, osg::TexMat* texmat, float s
geom->setVertexArray(coords);
geom->setTexCoordArray(0,tcoords);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(elements);

View File

@ -77,8 +77,7 @@ osg::ref_ptr<osg::Group> SubtractPass::createTexturedQuad()
quad_geom->setVertexArray(quad_coords.get());
quad_geom->setTexCoordArray(0, quad_tcoords.get());
quad_geom->addPrimitiveSet(quad_da.get());
quad_geom->setColorArray(quad_colors.get());
quad_geom->setColorBinding(osg::Geometry::BIND_OVERALL);
quad_geom->setColorArray(quad_colors.get(), osg::Array::BIND_OVERALL);
_StateSet = quad_geom->getOrCreateStateSet();
_StateSet->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
@ -213,8 +212,7 @@ osg::ref_ptr<osg::Group> AggregatePass::createTexturedQuad()
quad_geom->setVertexArray(quad_coords.get());
quad_geom->setTexCoordArray(0, quad_tcoords.get());
quad_geom->addPrimitiveSet(quad_da.get());
quad_geom->setColorArray(quad_colors.get());
quad_geom->setColorBinding(osg::Geometry::BIND_OVERALL);
quad_geom->setColorArray(quad_colors.get(), osg::Array::BIND_OVERALL);
_StateSet = quad_geom->getOrCreateStateSet();
_StateSet->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
@ -328,8 +326,7 @@ osg::ref_ptr<osg::Group> SelectPass::createTexturedQuad()
quad_geom->setVertexArray(quad_coords.get());
quad_geom->setTexCoordArray(0, quad_tcoords.get());
quad_geom->addPrimitiveSet(quad_da.get());
quad_geom->setColorArray(quad_colors.get());
quad_geom->setColorBinding(osg::Geometry::BIND_OVERALL);
quad_geom->setColorArray(quad_colors.get(), osg::Array::BIND_OVERALL);
_StateSet = quad_geom->getOrCreateStateSet();
_StateSet->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
@ -472,8 +469,7 @@ osg::ref_ptr<osg::Group> StereoMultipass::createTexturedQuad()
quad_geom->setVertexArray(quad_coords.get());
quad_geom->setTexCoordArray(0, quad_tcoords.get());
quad_geom->addPrimitiveSet(quad_da.get());
quad_geom->setColorArray(quad_colors.get());
quad_geom->setColorBinding(osg::Geometry::BIND_OVERALL);
quad_geom->setColorArray(quad_colors.get(), osg::Array::BIND_OVERALL);
_StateSet = quad_geom->getOrCreateStateSet();
_StateSet->setMode(GL_LIGHTING,osg::StateAttribute::OFF);

View File

@ -82,8 +82,7 @@ osg::Node* createScene(osg::Image *left, osg::Image *right, unsigned int min_dis
geom->setVertexArray(vcoords.get());
geom->setTexCoordArray(0,tcoords.get());
geom->addPrimitiveSet(da.get());
geom->setColorArray(colors.get());
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors.get(), osg::Array::BIND_OVERALL);
geomss[i] = geom->getOrCreateStateSet();
geomss[i]->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

View File

@ -92,8 +92,7 @@ osg::Geometry *makePolsTwo (void)
nrms->push_back(nrm);
}
gtess->setVertexArray(coords);
gtess->setNormalArray(nrms);
gtess->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
gtess->setNormalArray(nrms, osg::Array::BIND_PER_VERTEX);
gtess->setTexCoordArray(0,tcs);
// demonstrate that the Tessellator makes textured tessellations
@ -139,8 +138,7 @@ osg::Geometry *makeSideWall (const float xpos)
{ 1340.0,0.0 } };
gtess->setVertexArray(coords);
gtess->setNormalArray(nrms);
gtess->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
gtess->setNormalArray(nrms, osg::Array::BIND_PER_VERTEX);
gtess->setTexCoordArray(0,tcs);
for (i = 0; i < 4; i++) {
@ -240,8 +238,7 @@ osg::Geometry *makeFrontWall (const float zpos) {
{ 2460.0, 1320.0 } };
gtess->setVertexArray(coords);
gtess->setNormalArray(nrms);
gtess->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
gtess->setNormalArray(nrms, osg::Array::BIND_PER_VERTEX);
gtess->setTexCoordArray(0,tcs);
// add one large pentagon -the wall
@ -455,8 +452,7 @@ osg::Geometry *makePols (void) {
nrms->push_back(nrm);
}
gtess->setVertexArray(coords);
gtess->setNormalArray(nrms);
gtess->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
gtess->setNormalArray(nrms, osg::Array::BIND_PER_VERTEX);
gtess->setTexCoordArray(0,tcs);
// demonstrate that the Tessellator makes textured tessellations

View File

@ -154,13 +154,11 @@ osg::Node* createFilterWall(osg::BoundingBox& bb,const std::string& filename)
osg::Vec3Array* normals = new osg::Vec3Array(1);
(*normals)[0].set(1.0f,0.0f,0.0f);
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array(1);
(*colors)[0].set(1.0f,1.0f,1.0f,1.0f);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
@ -313,13 +311,11 @@ osg::Node* createAnisotripicWall(osg::BoundingBox& bb,const std::string& filenam
osg::Vec3Array* normals = new osg::Vec3Array(1);
(*normals)[0].set(0.0f,0.0f,1.0f);
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array(1);
(*colors)[0].set(1.0f,1.0f,1.0f,1.0f);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
@ -472,13 +468,11 @@ osg::Node* createWrapWall(osg::BoundingBox& bb,const std::string& filename)
osg::Vec3Array* normals = new osg::Vec3Array(1);
(*normals)[0].set(-1.0f,0.0f,0.0f);
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array(1);
(*colors)[0].set(1.0f,1.0f,1.0f,1.0f);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
@ -677,13 +671,11 @@ osg::Node* createSubloadWall(osg::BoundingBox& bb)
osg::Vec3Array* normals = new osg::Vec3Array(1);
(*normals)[0].set(0.0f,-1.0f,0.0f);
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array(1);
(*colors)[0].set(1.0f,1.0f,1.0f,1.0f);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));

View File

@ -160,8 +160,7 @@ osg::Drawable* createSquare(float textureCoordMax=1.0f)
osg::Vec3Array* norms = new osg::Vec3Array(1);
(*norms)[0].set(0.0f,-1.0f,0.0f);
geom->setNormalArray(norms);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(norms, osg::Array::BIND_OVERALL);
osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(0.0f,textureCoordMax);

View File

@ -134,13 +134,11 @@ osg::Node* createRectangle(osg::BoundingBox& bb,
osg::Vec3Array* normals = new osg::Vec3Array(1);
(*normals)[0].set(0.0f,-1.0f,0.0f);
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array(1);
(*colors)[0].set(1.0f,1.0f,1.0f,1.0f);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, 4));

View File

@ -100,8 +100,7 @@ makeFrustumFromCamera( osg::Camera* camera )
osg::Vec4Array* c = new osg::Vec4Array;
c->push_back( osg::Vec4( 1., 1., 1., 1. ) );
geom->setColorArray( c );
geom->setColorBinding( osg::Geometry::BIND_OVERALL );
geom->setColorArray( c, osg::Array::BIND_OVERALL );
GLushort idxLines[8] = {
0, 5, 0, 6, 0, 7, 0, 8 };

View File

@ -209,32 +209,32 @@ class ConvertToVertexAttibArrays : public osg::NodeVisitor
osg::notify(osg::NOTICE)<<"Found geometry "<<&geom<<std::endl;
if (geom.getVertexArray())
{
setVertexAttrib(geom, _vertexAlias, geom.getVertexArray(), false, osg::Geometry::BIND_PER_VERTEX);
setVertexAttrib(geom, _vertexAlias, geom.getVertexArray(), false, osg::Array::BIND_PER_VERTEX);
geom.setVertexArray(0);
}
if (geom.getNormalArray())
{
setVertexAttrib(geom, _normalAlias, geom.getNormalArray(), true, geom.getNormalBinding());
setVertexAttrib(geom, _normalAlias, geom.getNormalArray(), true);
geom.setNormalArray(0);
}
if (geom.getColorArray())
{
setVertexAttrib(geom, _colorAlias, geom.getColorArray(), false, geom.getColorBinding());
setVertexAttrib(geom, _colorAlias, geom.getColorArray(), false);
geom.setColorArray(0);
}
if (geom.getSecondaryColorArray())
{
setVertexAttrib(geom, _secondaryColorAlias, geom.getSecondaryColorArray(), false, geom.getSecondaryColorBinding());
setVertexAttrib(geom, _secondaryColorAlias, geom.getSecondaryColorArray(), false);
geom.setSecondaryColorArray(0);
}
if (geom.getFogCoordArray())
{
// should we normalize the FogCoord array? Don't think so...
setVertexAttrib(geom, _fogCoordAlias, geom.getFogCoordArray(), false, geom.getFogCoordBinding());
setVertexAttrib(geom, _fogCoordAlias, geom.getFogCoordArray(), false);
geom.setFogCoordArray(0);
}
@ -248,7 +248,7 @@ class ConvertToVertexAttibArrays : public osg::NodeVisitor
{
if (geom.getTexCoordArray(i))
{
setVertexAttrib(geom, _texCoordAlias[i], geom.getTexCoordArray(i), false, osg::Geometry::BIND_PER_VERTEX);
setVertexAttrib(geom, _texCoordAlias[i], geom.getTexCoordArray(i), false, osg::Array::BIND_PER_VERTEX);
geom.setTexCoordArray(i,0);
}
else
@ -258,14 +258,14 @@ class ConvertToVertexAttibArrays : public osg::NodeVisitor
}
}
void setVertexAttrib(osg::Geometry& geom, const AttributeAlias& alias, osg::Array* array, bool normalize, osg::Geometry::AttributeBinding binding)
void setVertexAttrib(osg::Geometry& geom, const AttributeAlias& alias, osg::Array* array, bool normalize, osg::Array::Binding binding = osg::Array::BIND_UNDEFINED)
{
unsigned int index = alias.first;
const std::string& name = alias.second;
array->setName(name);
if (binding!=osg::Array::BIND_UNDEFINED) array->setBinding(binding);
array->setNormalize(normalize);
geom.setVertexAttribArray(index, array);
geom.setVertexAttribNormalize(index, normalize);
geom.setVertexAttribBinding(index, binding);
osg::notify(osg::NOTICE)<<" vertex attrib("<<name<<", index="<<index<<", normalize="<<normalize<<" binding="<<binding<<")"<<std::endl;
}