Replaced deprecated osg::Geometry::set*Binding() calls.
This commit is contained in:
parent
a459033eff
commit
55416d83b3
@ -145,10 +145,8 @@ class ReaderWriter3DC : public osgDB::ReaderWriter
|
||||
geometry->setUseDisplayList(true);
|
||||
geometry->setUseVertexBufferObjects(true);
|
||||
geometry->setVertexArray(vertices);
|
||||
geometry->setNormalArray(normals);
|
||||
geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geometry->setColorArray(colours);
|
||||
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geometry->setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
|
||||
geometry->setColorArray(colours, osg::Array::BIND_PER_VERTEX);
|
||||
geometry->addPrimitiveSet(new osg::DrawArrays(GL_POINTS,0,vertices->size()));
|
||||
|
||||
geode->addDrawable(geometry);
|
||||
@ -177,10 +175,8 @@ class ReaderWriter3DC : public osgDB::ReaderWriter
|
||||
geometry->setUseDisplayList(true);
|
||||
geometry->setUseVertexBufferObjects(true);
|
||||
geometry->setVertexArray(vertices);
|
||||
geometry->setNormalArray(normals);
|
||||
geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geometry->setColorArray(colours);
|
||||
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geometry->setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
|
||||
geometry->setColorArray(colours, osg::Array::BIND_PER_VERTEX);
|
||||
geometry->addPrimitiveSet(new osg::DrawArrays(GL_POINTS,0,vertices->size()));
|
||||
|
||||
geode->addDrawable(geometry);
|
||||
|
@ -444,8 +444,7 @@ public:
|
||||
fc.tessellate(verts, themat, ts, dwob, tmat.get());
|
||||
}
|
||||
void buildGeometry() { // at end of all faces, add collection of vertices to geometry
|
||||
gset->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); //BIND_PERPRIM); //
|
||||
gset->setNormalArray(normals.get());
|
||||
gset->setNormalArray(normals.get(), osg::Array::BIND_PER_VERTEX);
|
||||
gset->setTexCoordArray(0,txcoords.get());
|
||||
gset->setVertexArray(vertices.get()); // setCoords( vts, nusidx );
|
||||
}
|
||||
|
@ -65,12 +65,10 @@ osg::Geometry* createPtGeometry( osg::PrimitiveSet::Mode pointType, osg::Vec3Arr
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(pointType, 0, vertices->size()));
|
||||
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);
|
||||
osg::Vec3Array *norms = new osg::Vec3Array;
|
||||
norms->push_back(osg::Vec3(0,0,1));
|
||||
geom->setNormalArray(norms);
|
||||
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||
geom->setNormalArray(norms, osg::Array::BIND_OVERALL);
|
||||
return geom;
|
||||
}
|
||||
|
||||
@ -82,12 +80,10 @@ osg::Geometry* createLnGeometry( osg::PrimitiveSet::Mode lineType, osg::Vec3Arra
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(lineType, 0, vertices->size()));
|
||||
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);
|
||||
osg::Vec3Array *norms = new osg::Vec3Array;
|
||||
norms->push_back(osg::Vec3(0,0,1));
|
||||
geom->setNormalArray(norms);
|
||||
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||
geom->setNormalArray(norms, osg::Array::BIND_OVERALL);
|
||||
return geom;
|
||||
}
|
||||
|
||||
@ -99,10 +95,8 @@ osg::Geometry* createTriGeometry( osg::Vec3Array* vertices, osg::Vec3Array* norm
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, vertices->size()));
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
colors->push_back(color);
|
||||
geom->setColorArray(colors);
|
||||
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
geom->setNormalArray(normals);
|
||||
geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
||||
geom->setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
|
||||
return geom;
|
||||
}
|
||||
|
||||
@ -114,10 +108,8 @@ osg::Geometry* createQuadGeometry( osg::Vec3Array* vertices, osg::Vec3Array* nor
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS, 0, vertices->size()));
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
colors->push_back(color);
|
||||
geom->setColorArray(colors);
|
||||
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
geom->setNormalArray(normals);
|
||||
geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
|
||||
geom->setNormalArray(normals, osg::Array::BIND_PER_VERTEX);
|
||||
return geom;
|
||||
}
|
||||
|
||||
|
@ -184,8 +184,7 @@ void Converter::build_scene_graph(Object &obj)
|
||||
|
||||
osg::ref_ptr<osg::Geometry> geo = new osg::Geometry;
|
||||
geo->setVertexArray(new_points.get());
|
||||
geo->setNormalArray(new_normals.get());
|
||||
geo->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geo->setNormalArray(new_normals.get(), osg::Array::BIND_PER_VERTEX);
|
||||
|
||||
bool group_used = false;
|
||||
|
||||
|
@ -18,8 +18,7 @@ Normals::Normals( Node *node, float scale, Mode mode )
|
||||
|
||||
ref_ptr<Geometry> geom = new Geometry;
|
||||
geom->setVertexArray( coords.get() );
|
||||
geom->setColorArray( colors.get() );
|
||||
geom->setColorBinding( Geometry::BIND_OVERALL );
|
||||
geom->setColorArray( colors.get(), osg::Array::BIND_OVERALL );
|
||||
|
||||
geom->addPrimitiveSet( new DrawArrays( PrimitiveSet::LINES, 0, coords->size()));
|
||||
|
||||
@ -60,7 +59,7 @@ void Normals::MakeNormalsVisitor::apply( Geode &geode )
|
||||
if( geom )
|
||||
{
|
||||
if (geom->containsDeprecatedData()) geom->fixDeprecatedData();
|
||||
|
||||
|
||||
Vec3Array *coords = dynamic_cast<Vec3Array*>(geom->getVertexArray());
|
||||
if( coords == 0L )
|
||||
continue;
|
||||
|
@ -97,7 +97,7 @@ private:
|
||||
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
|
||||
|
||||
geom->setVertexArray(_vertex.get());
|
||||
|
||||
|
||||
if (_normal.valid())
|
||||
{
|
||||
// need to convert per triangle normals to per vertex
|
||||
@ -109,11 +109,10 @@ private:
|
||||
{
|
||||
perVertexNormals->push_back(*itr);
|
||||
}
|
||||
|
||||
geom->setNormalArray(perVertexNormals.get());
|
||||
geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
|
||||
geom->setNormalArray(perVertexNormals.get(), osg::Array::BIND_PER_VERTEX);
|
||||
}
|
||||
|
||||
|
||||
if (_color.valid())
|
||||
{
|
||||
// need to convert per triangle colours to per vertex
|
||||
@ -126,8 +125,7 @@ private:
|
||||
{
|
||||
perVertexColours->push_back(*itr);
|
||||
}
|
||||
geom->setColorArray(perVertexColours.get());
|
||||
geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geom->setColorArray(perVertexColours.get(), osg::Array::BIND_PER_VERTEX);
|
||||
}
|
||||
|
||||
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, _numFacets * 3));
|
||||
|
@ -280,8 +280,7 @@ osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97Sphere(openvrml::nod
|
||||
|
||||
osg_geom->setVertexArray(osg_vertices.get());
|
||||
osg_geom->setTexCoordArray(0, osg_texcoords.get());
|
||||
osg_geom->setNormalArray(osg_normals.get());
|
||||
osg_geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
osg_geom->setNormalArray(osg_normals.get(), osg::Array::BIND_PER_VERTEX);
|
||||
|
||||
osg_geom->getOrCreateStateSet()->setAttributeAndModes(new osg::CullFace(osg::CullFace::BACK));
|
||||
|
||||
@ -392,8 +391,7 @@ osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97Cone(openvrml::node*
|
||||
|
||||
osg_geom->setVertexArray(osg_vertices.get());
|
||||
osg_geom->setTexCoordArray(0, osg_texcoords.get());
|
||||
osg_geom->setNormalArray(osg_normals.get());
|
||||
osg_geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
osg_geom->setNormalArray(osg_normals.get(), osg::Array::BIND_PER_VERTEX);
|
||||
|
||||
osg_geom->getOrCreateStateSet()->setAttributeAndModes(new osg::CullFace(osg::CullFace::BACK));
|
||||
|
||||
@ -531,8 +529,7 @@ osg::ref_ptr<osg::Geometry> ReaderWriterVRML2::convertVRML97Cylinder(openvrml::n
|
||||
|
||||
osg_geom->setVertexArray(osg_vertices.get());
|
||||
osg_geom->setTexCoordArray(0, osg_texcoords.get());
|
||||
osg_geom->setNormalArray(osg_normals.get());
|
||||
osg_geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
osg_geom->setNormalArray(osg_normals.get(), osg::Array::BIND_PER_VERTEX);
|
||||
|
||||
osg_geom->getOrCreateStateSet()->setAttributeAndModes(new osg::CullFace(osg::CullFace::BACK));
|
||||
|
||||
|
@ -276,8 +276,7 @@ osg::Geode* ReaderWriterDirectX::convertFromDX(DX::Mesh & mesh, bool switchToLef
|
||||
|
||||
// Arrays to hold vertices, normals, and texcoords.
|
||||
geom->setVertexArray(new osg::Vec3Array);
|
||||
geom->setNormalArray(new osg::Vec3Array);
|
||||
geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geom->setNormalArray(new osg::Vec3Array, osg::Array::BIND_PER_VERTEX);
|
||||
if (textureCount) {
|
||||
// All texture units share the same array
|
||||
osg::Vec2Array* texCoords = new osg::Vec2Array;
|
||||
|
Loading…
Reference in New Issue
Block a user