diff --git a/src/osgPlugins/3ds/ReaderWriter3DS.cpp b/src/osgPlugins/3ds/ReaderWriter3DS.cpp index c5616a66e..5b2a14a38 100644 --- a/src/osgPlugins/3ds/ReaderWriter3DS.cpp +++ b/src/osgPlugins/3ds/ReaderWriter3DS.cpp @@ -607,7 +607,7 @@ osg::Node* ReaderWriter3DS::ReaderObject::processNode(StateSetMap& drawStateMap, meshTransform=new osg::MatrixTransform(meshMat); meshAppliedMatPtr=NULL; // since meshTransform applies it - meshTransform->setName("3DSMeshMatrix"); + meshTransform->setName("3DSMeshMatrix"); if (group) group->addChild(meshTransform); } else { meshTransform=group; // don't need the meshTransform node - note group can be NULL @@ -1027,8 +1027,7 @@ osg::Drawable* ReaderWriter3DS::ReaderObject::createDrawable(Lib3dsMesh *m,FaceL osg::ref_ptr osg_normals = new osg::Vec3Array(); osg_normals->reserve(m->nvertices); - geom->setNormalArray(osg_normals.get()); - geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); + geom->setNormalArray(osg_normals.get(), osg::Array::BIND_PER_VERTEX); osg::ref_ptr osg_texCoords = NULL; @@ -1085,8 +1084,7 @@ osg::Drawable* ReaderWriter3DS::ReaderObject::createDrawable(Lib3dsMesh *m,FaceL // Set geometry color to white. osg::ref_ptr osg_colors = new osg::Vec4ubArray(1); (*osg_colors)[0].set(255,255,255,255); - geom->setColorArray(osg_colors.get()); - geom->setColorBinding(osg::Geometry::BIND_OVERALL); + geom->setColorArray(osg_colors.get(), osg::Array::BIND_OVERALL); // Create triangle primitives. int numIndices = faceCount * 3; @@ -1146,7 +1144,7 @@ osg::Texture2D* ReaderWriter3DS::ReaderObject::createTexture(Lib3dsTextureMap * } else { - // MIKEC: We can still continue to call osgDB::readRefImageFile in case user has a ReadFileCallback registered + // MIKEC: We can still continue to call osgDB::readRefImageFile in case user has a ReadFileCallback registered // in that case we just use the image's filename as it exists in the 3DS file fileName=texture->name; } diff --git a/src/osgPlugins/ac/ac3d.cpp b/src/osgPlugins/ac/ac3d.cpp index 4063d49d9..199daf8d4 100644 --- a/src/osgPlugins/ac/ac3d.cpp +++ b/src/osgPlugins/ac/ac3d.cpp @@ -772,9 +772,8 @@ class LineBin : public PrimitiveBin { _geode->addDrawable(_geometry.get()); material.toStateSet(_geode->getOrCreateStateSet()); - _geometry->setColorArray(material.getColorArray()); - _geometry->setColorBinding(osg::Geometry::BIND_OVERALL); - _geometry->setNormalBinding(osg::Geometry::BIND_OFF); + _geometry->setColorArray(material.getColorArray(), osg::Array::BIND_OVERALL); + _geometry->setNormalArray(0); return _geode.get(); } }; @@ -1010,20 +1009,15 @@ class SurfaceBin : public PrimitiveBin { osg::Geometry* geometry = new osg::Geometry; _geode->addDrawable(geometry); geometry->setDataVariance(osg::Object::STATIC); - geometry->setColorArray(material.getColorArray()); - geometry->setColorBinding(osg::Geometry::BIND_OVERALL); + geometry->setColorArray(material.getColorArray(), osg::Array::BIND_OVERALL); osg::Vec3Array* normalArray = new osg::Vec3Array; - normalArray->setDataVariance(osg::Object::STATIC); - geometry->setNormalArray(normalArray); - geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); + geometry->setNormalArray(normalArray, osg::Array::BIND_PER_VERTEX); osg::Vec3Array* vertexArray = new osg::Vec3Array; - vertexArray->setDataVariance(osg::Object::STATIC); geometry->setVertexArray(vertexArray); osg::Vec2Array* texcoordArray = 0; if (textureData.valid()) { texcoordArray = new osg::Vec2Array; - texcoordArray->setDataVariance(osg::Object::STATIC); geometry->setTexCoordArray(0, texcoordArray); } diff --git a/src/osgPlugins/bsp/VBSPGeometry.cpp b/src/osgPlugins/bsp/VBSPGeometry.cpp index a053afad5..08e7e8b88 100644 --- a/src/osgPlugins/bsp/VBSPGeometry.cpp +++ b/src/osgPlugins/bsp/VBSPGeometry.cpp @@ -637,15 +637,13 @@ ref_ptr VBSPGeometry::createGeometry() // Add the vertex attributes geometry->setVertexArray(vertex_array.get()); - geometry->setNormalArray(normal_array.get()); - geometry->setNormalBinding(Geometry::BIND_PER_VERTEX); + geometry->setNormalArray(normal_array.get(), Array::BIND_PER_VERTEX); geometry->setTexCoordArray(0, texcoord_array.get()); // Add an overall color color.set(1.0, 1.0, 1.0, 1.0); colorArray = new Vec4Array(1, &color); - geometry->setColorArray(colorArray.get()); - geometry->setColorBinding(Geometry::BIND_OVERALL); + geometry->setColorArray(colorArray.get(), Array::BIND_OVERALL); // Add our primitive set to the geometry geometry->addPrimitiveSet(primitive_set.get()); @@ -668,12 +666,10 @@ ref_ptr VBSPGeometry::createGeometry() // Add the vertex attributes geometry->setVertexArray(disp_vertex_array.get()); - geometry->setNormalArray(disp_normal_array.get()); - geometry->setNormalBinding(Geometry::BIND_PER_VERTEX); + geometry->setNormalArray(disp_normal_array.get(), Array::BIND_PER_VERTEX); + geometry->setColorArray(disp_vertex_attr_array.get(), Array::BIND_PER_VERTEX); geometry->setTexCoordArray(0, disp_texcoord_array.get()); geometry->setTexCoordArray(1, disp_texcoord_array.get()); - geometry->setColorArray(disp_vertex_attr_array.get()); - geometry->setColorBinding(Geometry::BIND_PER_VERTEX); // Add our primitive set to the geometry geometry->addPrimitiveSet(disp_primitive_set.get()); diff --git a/src/osgPlugins/lwo/ReaderWriterLWO.cpp b/src/osgPlugins/lwo/ReaderWriterLWO.cpp index a27954874..fc3be0936 100644 --- a/src/osgPlugins/lwo/ReaderWriterLWO.cpp +++ b/src/osgPlugins/lwo/ReaderWriterLWO.cpp @@ -233,8 +233,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterLWO::readNode_LWO1(const std::string lw_material.b, 1.0f); - gc._geom->setColorArray(colors); - gc._geom->setColorBinding(osg::Geometry::BIND_OVERALL); + gc._geom->setColorArray(colors, osg::Array::BIND_OVERALL); // set up texture if needed. if (gc._numPrimitivesWithTexCoords==gc._numPrimitives) diff --git a/src/osgPlugins/lwo/Surface.cpp b/src/osgPlugins/lwo/Surface.cpp index 17f34150e..698dd1538 100644 --- a/src/osgPlugins/lwo/Surface.cpp +++ b/src/osgPlugins/lwo/Surface.cpp @@ -340,8 +340,7 @@ osg::Group *Surface::apply(osg::Geometry *geo, const VertexMap_map *texture_maps if (color_maps) { VertexMap_map::const_iterator i = color_maps->find(color_map_name_); if (i != color_maps->end() && !i->second->empty()) { - geo->setColorArray(i->second->asVec4Array(num_points, color * color_map_intensity_, color * color_map_intensity_)); - geo->setColorBinding(osg::Geometry::BIND_PER_VERTEX); + geo->setColorArray(i->second->asVec4Array(num_points, color * color_map_intensity_, color * color_map_intensity_), osg::Array::BIND_PER_VERTEX); } else { OSG_WARN << "Warning: lwosg::Surface: surface '" << name_ << "' needs color map named '" << color_map_name_ << "' but I can't find it" << std::endl; } diff --git a/src/osgPlugins/lwo/old_Lwo2.cpp b/src/osgPlugins/lwo/old_Lwo2.cpp index 5ad8bedc4..088cce365 100644 --- a/src/osgPlugins/lwo/old_Lwo2.cpp +++ b/src/osgPlugins/lwo/old_Lwo2.cpp @@ -675,8 +675,7 @@ Lwo2::GenerateGroup( Group& group ) if (material) { Vec4Array* colors = new Vec4Array(); colors->push_back(material->getDiffuse(Material::FRONT_AND_BACK)); - geometry->setColorBinding(Geometry::BIND_OVERALL); - geometry->setColorArray(colors); + geometry->setColorArray(colors, osg::Array::BIND_OVERALL); } } } diff --git a/src/osgPlugins/ply/vertexData.cpp b/src/osgPlugins/ply/vertexData.cpp index 4355f58d7..209c5295d 100644 --- a/src/osgPlugins/ply/vertexData.cpp +++ b/src/osgPlugins/ply/vertexData.cpp @@ -452,8 +452,7 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor // Set the normals if (_normals.valid()) { - geom->setNormalArray(_normals.get()); - geom->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); + geom->setNormalArray(_normals.get(), osg::Array::BIND_PER_VERTEX); } // Add the primitive set @@ -469,23 +468,19 @@ osg::Node* VertexData::readPlyFile( const char* filename, const bool ignoreColor if(_colors.valid()) { - geom->setColorArray(_colors.get()); - geom->setColorBinding( osg::Geometry::BIND_PER_VERTEX ); + geom->setColorArray(_colors.get(), osg::Array::BIND_PER_VERTEX ); } else if(_ambient.valid()) { - geom->setColorArray(_ambient.get()); - geom->setColorBinding( osg::Geometry::BIND_PER_VERTEX ); + geom->setColorArray(_ambient.get(), osg::Array::BIND_PER_VERTEX ); } else if(_diffuse.valid()) { - geom->setColorArray(_diffuse.get()); - geom->setColorBinding( osg::Geometry::BIND_PER_VERTEX ); + geom->setColorArray(_diffuse.get(), osg::Array::BIND_PER_VERTEX ); } else if(_specular.valid()) { - geom->setColorArray(_specular.get()); - geom->setColorBinding( osg::Geometry::BIND_PER_VERTEX ); + geom->setColorArray(_specular.get(), osg::Array::BIND_PER_VERTEX ); } // set flage true to activate the vertex buffer object of drawable diff --git a/src/osgPlugins/trk/ReaderWriterTRK.cpp b/src/osgPlugins/trk/ReaderWriterTRK.cpp index db5afe215..e0d82ce4b 100644 --- a/src/osgPlugins/trk/ReaderWriterTRK.cpp +++ b/src/osgPlugins/trk/ReaderWriterTRK.cpp @@ -74,9 +74,9 @@ struct AssignDirectionColour colours = new osg::Vec4Array; geometry->setColorArray(colours.get()); } - geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX); + colours->setBinding(osg::Array::BIND_PER_VERTEX); colours->resize(vertices->size(), osg::Vec4(0.0,0.0,0.0,0.0)); -#if 1 +#if 1 // allocate normals osg::ref_ptr normals = dynamic_cast(geometry->getNormalArray()); if (!normals) @@ -84,7 +84,7 @@ struct AssignDirectionColour normals = new osg::Vec3Array; geometry->setNormalArray(normals.get()); } - geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX); + normals->setBinding(osg::Array::BIND_PER_VERTEX); normals->resize(vertices->size(), osg::Vec3(0.0,0.0,0.0)); #endif @@ -147,11 +147,11 @@ struct AssignDirectionColour if (divisors[vi_1]==0.0f) n1 = normal; else n1 += normal; #endif - + divisors[vi_0] += 1.0f; divisors[vi_1] += 1.0f; } - } + } } for(unsigned int vi=0; visize(); ++vi) @@ -160,12 +160,12 @@ struct AssignDirectionColour { (*colours)[vi] /= divisors[vi]; (*normals)[vi].normalize(); - + } } std::string vertexShaderFile("track.vert"); - + osg::ref_ptr stateset = geometry->getOrCreateStateSet(); osg::ref_ptr program = new osg::Program; @@ -211,7 +211,7 @@ class ReaderWriterTRK : public osgDB::ReaderWriter TrkHeader header; fin.read(reinterpret_cast(&header), sizeof(TrkHeader)); - if (fin.fail()) return ReadResult::ERROR_IN_READING_FILE; + if (fin.fail()) return ReadResult::ERROR_IN_READING_FILE; OSG_NOTICE<<"Read header successfuly ["<(header.vox_to_ras)); OSG_NOTICE<<"vox_to_ras="<