From Sebastian Messerschmidt, "I've taken some time and refactored some places where the old set*Binding were used."
This commit is contained in:
parent
bead0740f2
commit
a459033eff
@ -1073,14 +1073,13 @@ Geometry* osg::createTexturedQuadGeometry(const Vec3& corner,const Vec3& widthVe
|
||||
|
||||
osg::Vec4Array* colours = new osg::Vec4Array(1);
|
||||
(*colours)[0].set(1.0f,1.0f,1.0,1.0f);
|
||||
geom->setColorArray(colours);
|
||||
geom->setColorBinding(Geometry::BIND_OVERALL);
|
||||
geom->setColorArray(colours, osg::Array::BIND_OVERALL);
|
||||
|
||||
osg::Vec3Array* normals = new osg::Vec3Array(1);
|
||||
(*normals)[0] = widthVec^heightVec;
|
||||
(*normals)[0].normalize();
|
||||
geom->setNormalArray(normals);
|
||||
geom->setNormalBinding(Geometry::BIND_OVERALL);
|
||||
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
||||
|
||||
|
||||
#if defined(OSG_GLES1_AVAILABLE) || !defined(OSG_GLES2_AVAILABLE)
|
||||
DrawElementsUByte* elems = new DrawElementsUByte(PrimitiveSet::TRIANGLES);
|
||||
|
@ -1805,8 +1805,7 @@ Geode* osg::createGeodeForImage(osg::Image* image,float s,float t)
|
||||
|
||||
osg::Vec4Array* colours = new osg::Vec4Array(1);
|
||||
(*colours)[0].set(1.0f,1.0f,1.0,1.0f);
|
||||
geom->setColorArray(colours);
|
||||
geom->setColorBinding(Geometry::BIND_OVERALL);
|
||||
geom->setColorArray(colours, osg::Array::BIND_OVERALL);
|
||||
|
||||
geom->addPrimitiveSet(new DrawArrays(PrimitiveSet::QUADS,0,4));
|
||||
|
||||
|
@ -715,8 +715,7 @@ void OcclusionQueryNode::createSupportNodes()
|
||||
|
||||
ref_ptr<Vec4Array> ca = new Vec4Array;
|
||||
ca->push_back( Vec4( 1.f, 1.f, 1.f, 1.f ) );
|
||||
geom->setColorArray( ca.get() );
|
||||
geom->setColorBinding( Geometry::BIND_OVERALL );
|
||||
geom->setColorArray( ca.get(), Array::BIND_OVERALL );
|
||||
|
||||
geom->addPrimitiveSet( new DrawElementsUShort( PrimitiveSet::QUADS, 24, indices ) );
|
||||
|
||||
|
@ -78,8 +78,7 @@ void RigTransformSoftware::operator()(RigGeometry& geom)
|
||||
{
|
||||
normalDst = new osg::Vec3Array;
|
||||
normalDst->setDataVariance(osg::Object::DYNAMIC);
|
||||
destination.setNormalArray(normalDst);
|
||||
destination.setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
destination.setNormalArray(normalDst, osg::Array::BIND_PER_VERTEX);
|
||||
}
|
||||
*normalDst = *normalSrc;
|
||||
}
|
||||
|
@ -62,8 +62,7 @@ osg::Geometry* createBackgroundRectangle(const osg::Vec3& pos, const float width
|
||||
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
colors->push_back(color);
|
||||
geometry->setColorArray(colors);
|
||||
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
geometry->setColorArray(colors, osg::Array::BIND_OVERALL);
|
||||
|
||||
osg::DrawElementsUInt *base = new osg::DrawElementsUInt(osg::PrimitiveSet::QUADS,0);
|
||||
base->push_back(0);
|
||||
@ -133,8 +132,7 @@ struct StatsGraph : public osg::MatrixTransform
|
||||
void setColor(const osg::Vec4& color) {
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
colors->push_back(color);
|
||||
setColorArray(colors);
|
||||
setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
setColorArray(colors, osg::Array::BIND_OVERALL);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -57,8 +57,7 @@ osg::Geometry* createDiskGeometry(float radius, float offset, float z, unsigned
|
||||
|
||||
osg::Geometry* geometry = new osg::Geometry;
|
||||
geometry->setVertexArray(vertexArray);
|
||||
geometry->setNormalArray(normalArray);
|
||||
geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geometry->setNormalArray(normalArray, osg::Array::BIND_PER_VERTEX);
|
||||
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_STRIP, 0, vertexArray->size()));
|
||||
return geometry;
|
||||
}
|
||||
|
@ -42,8 +42,7 @@ osg::Node* createHandleNode(Scale2DDragger* cornerScaleDragger, float handleScal
|
||||
|
||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||
normals->push_back(osg::Vec3(0.0,1.0,0.0));
|
||||
geometry->setNormalArray(normals);
|
||||
geometry->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||
geometry->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
||||
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
geode->setName("Dragger Handle");
|
||||
@ -173,8 +172,7 @@ void createTranslateDraggerGeometry(Scale2DDragger* cornerScaleDragger, Translat
|
||||
|
||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||
normals->push_back(osg::Vec3(0.0,1.0,0.0));
|
||||
geometry->setNormalArray(normals);
|
||||
geometry->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||
geometry->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
||||
|
||||
geode->addDrawable(geometry);
|
||||
|
||||
|
@ -44,8 +44,7 @@ osg::Geometry* createCircleGeometry(float radius, unsigned int numSegments)
|
||||
}
|
||||
osg::Geometry* geometry = new osg::Geometry();
|
||||
geometry->setVertexArray(vertexArray);
|
||||
geometry->setNormalArray(normalArray);
|
||||
geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
geometry->setNormalArray(normalArray, osg::Array::BIND_PER_VERTEX);
|
||||
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,vertexArray->size()));
|
||||
return geometry;
|
||||
}
|
||||
|
@ -88,8 +88,7 @@ void TranslatePlaneDragger::setupDefaultGeometry()
|
||||
|
||||
osg::Vec3Array* normals = new osg::Vec3Array;
|
||||
normals->push_back(osg::Vec3(0.0,1.0,0.0));
|
||||
geometry->setNormalArray(normals);
|
||||
geometry->setNormalBinding(osg::Geometry::BIND_OVERALL);
|
||||
geometry->setNormalArray(normals, osg::Array::BIND_OVERALL);
|
||||
|
||||
geode->addDrawable(geometry);
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
//
|
||||
// OpenFlight<EFBFBD> loader for OpenSceneGraph
|
||||
// OpenFlight loader for OpenSceneGraph
|
||||
//
|
||||
// Copyright (C) 2005-2007 Brede Johansen
|
||||
//
|
||||
@ -589,10 +589,9 @@ protected:
|
||||
osg::Vec4 col = getPrimaryColor();
|
||||
col[3] = 1.0f - getTransparency();
|
||||
|
||||
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
osg::Vec4Array* colors = new osg::Vec4Array(1);
|
||||
(*colors)[0] = col;
|
||||
geometry->setColorArray(colors);
|
||||
geometry->setColorArray(colors, osg::Array::BIND_OVERALL);
|
||||
}
|
||||
|
||||
// Normal binding
|
||||
@ -602,8 +601,7 @@ protected:
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry->setNormalBinding(osg::Geometry::BIND_OFF);
|
||||
geometry->setNormalArray(NULL);
|
||||
geometry->setNormalArray(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1421,10 +1419,10 @@ protected:
|
||||
osg::Vec4 col = mesh->getPrimaryColor();
|
||||
col[3] = 1.0f - mesh->getTransparency();
|
||||
|
||||
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
|
||||
osg::Vec4Array* colors = new osg::Vec4Array(1);
|
||||
(*colors)[0] = col;
|
||||
geometry->setColorArray(colors);
|
||||
geometry->setColorArray(colors, osg::Array::BIND_OVERALL);
|
||||
}
|
||||
|
||||
// Normal binding
|
||||
@ -1434,8 +1432,7 @@ protected:
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry->setNormalBinding(osg::Geometry::BIND_OFF);
|
||||
geometry->setNormalArray(NULL);
|
||||
geometry->setNormalArray(0);
|
||||
}
|
||||
|
||||
mesh->addGeometry(*geometry);
|
||||
|
@ -1755,8 +1755,7 @@ osg::Geometry* ConvexPolyhedron::buildGeometry( const osg::Vec4d& colorOutline,
|
||||
geometry->setVertexArray(vertices);
|
||||
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
geometry->setColorArray(colors);
|
||||
geometry->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE_SET);
|
||||
geometry->setColorArray(colors, osg::Array::BIND_PER_PRIMITIVE_SET);
|
||||
|
||||
for(Faces::const_iterator itr = _faces.begin();
|
||||
itr != _faces.end();
|
||||
|
@ -799,8 +799,7 @@ public:
|
||||
|
||||
osg::Vec4Array* colours = new osg::Vec4Array;
|
||||
colours->push_back(colour);
|
||||
geometry->setColorArray(colours);
|
||||
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
|
||||
|
||||
osg::StateSet* stateset = geometry->getOrCreateStateSet();
|
||||
stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
|
||||
|
@ -248,26 +248,23 @@ void SceneGraphBuilder::End()
|
||||
|
||||
if (_colorSet)
|
||||
{
|
||||
_geometry->setColorArray(_colors.get());
|
||||
_geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
_geometry->setColorArray(_colors.get(), osg::Array::BIND_PER_VERTEX);
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::Vec4Array* colors = new osg::Vec4Array;
|
||||
colors->push_back(_color);
|
||||
|
||||
_geometry->setColorArray(colors);
|
||||
_geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
|
||||
_geometry->setColorArray(colors, osg::Array::BIND_OVERALL);
|
||||
}
|
||||
|
||||
if (_normalSet)
|
||||
{
|
||||
_geometry->setNormalArray(_normals.get());
|
||||
_geometry->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
|
||||
_geometry->setNormalArray(_normals.get(), osg::Array::BIND_PER_VERTEX);
|
||||
}
|
||||
else
|
||||
{
|
||||
_geometry->setNormalBinding(osg::Geometry::BIND_OFF);
|
||||
_geometry->setNormalArray(NULL, osg::Array::BIND_OFF);
|
||||
}
|
||||
|
||||
if (_maxNumTexCoordComponents==1)
|
||||
|
Loading…
Reference in New Issue
Block a user