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