Removed deprecated usage of osg::Geometry::get*Binding()
This commit is contained in:
parent
592c580721
commit
092dd93be8
@ -62,28 +62,27 @@ struct GeometryArrayGatherer
|
||||
GeometryArrayGatherer(osg::Geometry& geometry)
|
||||
: _useDrawElements(true)
|
||||
{
|
||||
add(geometry.getVertexArray(),osg::Geometry::BIND_PER_VERTEX);
|
||||
add(geometry.getNormalArray(),geometry.getNormalBinding());
|
||||
add(geometry.getColorArray(),geometry.getColorBinding());
|
||||
add(geometry.getSecondaryColorArray(),geometry.getSecondaryColorBinding());
|
||||
add(geometry.getFogCoordArray(),geometry.getFogCoordBinding());
|
||||
add(geometry.getVertexArray());
|
||||
add(geometry.getNormalArray());
|
||||
add(geometry.getColorArray());
|
||||
add(geometry.getSecondaryColorArray());
|
||||
add(geometry.getFogCoordArray());
|
||||
unsigned int i;
|
||||
for(i=0;i<geometry.getNumTexCoordArrays();++i)
|
||||
{
|
||||
add(geometry.getTexCoordArray(i),osg::Geometry::BIND_PER_VERTEX);
|
||||
add(geometry.getTexCoordArray(i));
|
||||
}
|
||||
for(i=0;i<geometry.getNumVertexAttribArrays();++i)
|
||||
{
|
||||
add(geometry.getVertexAttribArray(i),geometry.getVertexAttribBinding(i));
|
||||
add(geometry.getVertexAttribArray(i));
|
||||
}
|
||||
}
|
||||
|
||||
void add(osg::Array* array, osg::Geometry::AttributeBinding binding)
|
||||
void add(osg::Array* array)
|
||||
{
|
||||
if (binding == osg::Geometry::BIND_PER_VERTEX)
|
||||
if (array && array->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
{
|
||||
if (array)
|
||||
_arrayList.push_back(array);
|
||||
_arrayList.push_back(array);
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,13 +230,13 @@ void IndexMeshVisitor::makeMesh(Geometry& geom)
|
||||
{
|
||||
if (geom.containsDeprecatedData()) geom.fixDeprecatedData();
|
||||
|
||||
if (geom.getNormalBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return;
|
||||
if (osg::getBinding(geom.getNormalArray())==osg::Array::BIND_PER_PRIMITIVE_SET) return;
|
||||
|
||||
if (geom.getColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return;
|
||||
if (osg::getBinding(geom.getColorArray())==osg::Array::BIND_PER_PRIMITIVE_SET) return;
|
||||
|
||||
if (geom.getSecondaryColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return;
|
||||
if (osg::getBinding(geom.getSecondaryColorArray())==osg::Array::BIND_PER_PRIMITIVE_SET) return;
|
||||
|
||||
if (geom.getFogCoordBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return;
|
||||
if (osg::getBinding(geom.getFogCoordArray())==osg::Array::BIND_PER_PRIMITIVE_SET) return;
|
||||
|
||||
// no point optimizing if we don't have enough vertices.
|
||||
if (!geom.getVertexArray() || geom.getVertexArray()->getNumElements()<3) return;
|
||||
|
@ -1678,6 +1678,11 @@ void Optimizer::CombineLODsVisitor::combineLODs()
|
||||
// code to merge geometry object which share, state, and attribute bindings.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define COMPARE_BINDING(lhs, rhs) \
|
||||
if (osg::getBinding(lhs)<osg::getBinding(rhs)) return true; \
|
||||
if (osg::getBinding(rhs)<osg::getBinding(lhs)) return false;
|
||||
|
||||
|
||||
struct LessGeometry
|
||||
{
|
||||
bool operator() (const osg::Geometry* lhs,const osg::Geometry* rhs) const
|
||||
@ -1685,17 +1690,11 @@ struct LessGeometry
|
||||
if (lhs->getStateSet()<rhs->getStateSet()) return true;
|
||||
if (rhs->getStateSet()<lhs->getStateSet()) return false;
|
||||
|
||||
if (lhs->getNormalBinding()<rhs->getNormalBinding()) return true;
|
||||
if (rhs->getNormalBinding()<lhs->getNormalBinding()) return false;
|
||||
COMPARE_BINDING(lhs->getNormalArray(), rhs->getNormalArray())
|
||||
COMPARE_BINDING(lhs->getColorArray(), rhs->getColorArray())
|
||||
COMPARE_BINDING(lhs->getSecondaryColorArray(), rhs->getSecondaryColorArray())
|
||||
COMPARE_BINDING(lhs->getFogCoordArray(), rhs->getFogCoordArray())
|
||||
|
||||
if (lhs->getColorBinding()<rhs->getColorBinding()) return true;
|
||||
if (rhs->getColorBinding()<lhs->getColorBinding()) return false;
|
||||
|
||||
if (lhs->getSecondaryColorBinding()<rhs->getSecondaryColorBinding()) return true;
|
||||
if (rhs->getSecondaryColorBinding()<lhs->getSecondaryColorBinding()) return false;
|
||||
|
||||
if (lhs->getFogCoordBinding()<rhs->getFogCoordBinding()) return true;
|
||||
if (rhs->getFogCoordBinding()<lhs->getFogCoordBinding()) return false;
|
||||
|
||||
if (lhs->getNumTexCoordArrays()<rhs->getNumTexCoordArrays()) return true;
|
||||
if (rhs->getNumTexCoordArrays()<lhs->getNumTexCoordArrays()) return false;
|
||||
@ -1722,7 +1721,7 @@ struct LessGeometry
|
||||
}
|
||||
|
||||
|
||||
if (lhs->getNormalBinding()==osg::Geometry::BIND_OVERALL)
|
||||
if (osg::getBinding(lhs->getNormalArray())==osg::Array::BIND_OVERALL)
|
||||
{
|
||||
// assumes that the bindings and arrays are set up correctly, this
|
||||
// should be the case after running computeCorrectBindingsAndArraySizes();
|
||||
@ -1749,7 +1748,7 @@ struct LessGeometry
|
||||
}
|
||||
}
|
||||
|
||||
if (lhs->getColorBinding()==osg::Geometry::BIND_OVERALL)
|
||||
if (osg::getBinding(lhs->getColorArray())==osg::Array::BIND_OVERALL)
|
||||
{
|
||||
const osg::Array* lhs_colorArray = lhs->getColorArray();
|
||||
const osg::Array* rhs_colorArray = rhs->getColorArray();
|
||||
@ -2166,10 +2165,10 @@ bool Optimizer::MergeGeometryVisitor::mergeGeode(osg::Geode& geode)
|
||||
if (geom)
|
||||
{
|
||||
if (geom->getNumPrimitiveSets()>0 &&
|
||||
geom->getNormalBinding()!=osg::Geometry::BIND_PER_PRIMITIVE_SET &&
|
||||
geom->getColorBinding()!=osg::Geometry::BIND_PER_PRIMITIVE_SET &&
|
||||
geom->getSecondaryColorBinding()!=osg::Geometry::BIND_PER_PRIMITIVE_SET &&
|
||||
geom->getFogCoordBinding()!=osg::Geometry::BIND_PER_PRIMITIVE_SET)
|
||||
osg::getBinding(geom->getNormalArray())!=osg::Array::BIND_PER_PRIMITIVE_SET &&
|
||||
osg::getBinding(geom->getColorArray())!=osg::Array::BIND_PER_PRIMITIVE_SET &&
|
||||
osg::getBinding(geom->getSecondaryColorArray())!=osg::Array::BIND_PER_PRIMITIVE_SET &&
|
||||
osg::getBinding(geom->getFogCoordArray())!=osg::Array::BIND_PER_PRIMITIVE_SET)
|
||||
{
|
||||
|
||||
#if 1
|
||||
@ -2457,7 +2456,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom
|
||||
}
|
||||
|
||||
|
||||
if (lhs.getNormalArray() && rhs.getNormalArray() && lhs.getNormalBinding()!=osg::Geometry::BIND_OVERALL)
|
||||
if (lhs.getNormalArray() && rhs.getNormalArray() && lhs.getNormalArray()->getBinding()!=osg::Array::BIND_OVERALL)
|
||||
{
|
||||
if (!merger.merge(lhs.getNormalArray(),rhs.getNormalArray()))
|
||||
{
|
||||
@ -2470,7 +2469,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom
|
||||
}
|
||||
|
||||
|
||||
if (lhs.getColorArray() && rhs.getColorArray() && lhs.getColorBinding()!=osg::Geometry::BIND_OVERALL)
|
||||
if (lhs.getColorArray() && rhs.getColorArray() && lhs.getColorArray()->getBinding()!=osg::Array::BIND_OVERALL)
|
||||
{
|
||||
if (!merger.merge(lhs.getColorArray(),rhs.getColorArray()))
|
||||
{
|
||||
@ -2482,7 +2481,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom
|
||||
lhs.setColorArray(rhs.getColorArray());
|
||||
}
|
||||
|
||||
if (lhs.getSecondaryColorArray() && rhs.getSecondaryColorArray() && lhs.getSecondaryColorBinding()!=osg::Geometry::BIND_OVERALL)
|
||||
if (lhs.getSecondaryColorArray() && rhs.getSecondaryColorArray() && lhs.getSecondaryColorArray()->getBinding()!=osg::Array::BIND_OVERALL)
|
||||
{
|
||||
if (!merger.merge(lhs.getSecondaryColorArray(),rhs.getSecondaryColorArray()))
|
||||
{
|
||||
@ -2494,7 +2493,7 @@ bool Optimizer::MergeGeometryVisitor::mergeGeometry(osg::Geometry& lhs,osg::Geom
|
||||
lhs.setSecondaryColorArray(rhs.getSecondaryColorArray());
|
||||
}
|
||||
|
||||
if (lhs.getFogCoordArray() && rhs.getFogCoordArray() && lhs.getFogCoordBinding()!=osg::Geometry::BIND_OVERALL)
|
||||
if (lhs.getFogCoordArray() && rhs.getFogCoordArray() && lhs.getFogCoordArray()->getBinding()!=osg::Array::BIND_OVERALL)
|
||||
{
|
||||
if (!merger.merge(lhs.getFogCoordArray(),rhs.getFogCoordArray()))
|
||||
{
|
||||
|
@ -1444,21 +1444,21 @@ void EdgeCollapse::setGeometry(osg::Geometry* geometry, const Simplifier::IndexL
|
||||
geometry->getTexCoordArray(ti)->accept(copyArrayToPoints);
|
||||
}
|
||||
|
||||
if (_geometry->getNormalArray() && _geometry->getNormalBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (_geometry->getNormalArray() && _geometry->getNormalArray()->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
geometry->getNormalArray()->accept(copyArrayToPoints);
|
||||
|
||||
if (_geometry->getColorArray() && _geometry->getColorBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (_geometry->getColorArray() && _geometry->getColorArray()->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
geometry->getColorArray()->accept(copyArrayToPoints);
|
||||
|
||||
if (_geometry->getSecondaryColorArray() && _geometry->getSecondaryColorBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (_geometry->getSecondaryColorArray() && _geometry->getSecondaryColorArray()->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
geometry->getSecondaryColorArray()->accept(copyArrayToPoints);
|
||||
|
||||
if (_geometry->getFogCoordArray() && _geometry->getFogCoordBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (_geometry->getFogCoordArray() && _geometry->getFogCoordArray()->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
geometry->getFogCoordArray()->accept(copyArrayToPoints);
|
||||
|
||||
for(unsigned int vi=0;vi<_geometry->getNumVertexAttribArrays();++vi)
|
||||
{
|
||||
if (_geometry->getVertexAttribArray(vi) && _geometry->getVertexAttribBinding(vi)==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (_geometry->getVertexAttribArray(vi) && _geometry->getVertexAttribArray(vi)->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
geometry->getVertexAttribArray(vi)->accept(copyArrayToPoints);
|
||||
}
|
||||
|
||||
@ -1669,7 +1669,7 @@ void EdgeCollapse::copyBackToGeometry()
|
||||
_geometry->getTexCoordArray(ti)->accept(copyArrayToPoints);
|
||||
}
|
||||
|
||||
if (_geometry->getNormalArray() && _geometry->getNormalBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (_geometry->getNormalArray() && _geometry->getNormalArray()->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
{
|
||||
_geometry->getNormalArray()->accept(copyArrayToPoints);
|
||||
|
||||
@ -1678,18 +1678,18 @@ void EdgeCollapse::copyBackToGeometry()
|
||||
_geometry->getNormalArray()->accept(nav);
|
||||
}
|
||||
|
||||
if (_geometry->getColorArray() && _geometry->getColorBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (_geometry->getColorArray() && _geometry->getColorArray()->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
_geometry->getColorArray()->accept(copyArrayToPoints);
|
||||
|
||||
if (_geometry->getSecondaryColorArray() && _geometry->getSecondaryColorBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (_geometry->getSecondaryColorArray() && _geometry->getSecondaryColorArray()->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
_geometry->getSecondaryColorArray()->accept(copyArrayToPoints);
|
||||
|
||||
if (_geometry->getFogCoordArray() && _geometry->getFogCoordBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (_geometry->getFogCoordArray() && _geometry->getFogCoordArray()->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
_geometry->getFogCoordArray()->accept(copyArrayToPoints);
|
||||
|
||||
for(unsigned int vi=0;vi<_geometry->getNumVertexAttribArrays();++vi)
|
||||
{
|
||||
if (_geometry->getVertexAttribArray(vi) && _geometry->getVertexAttribBinding(vi)==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (_geometry->getVertexAttribArray(vi) && _geometry->getVertexAttribArray(vi)->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
_geometry->getVertexAttribArray(vi)->accept(copyArrayToPoints);
|
||||
}
|
||||
|
||||
|
@ -297,23 +297,23 @@ struct FindSharpEdgesFunctor
|
||||
|
||||
_problemVertexVector.resize(_vertices->size());
|
||||
|
||||
addArray(geom->getVertexArray(), osg::Geometry::BIND_PER_VERTEX);
|
||||
addArray(geom->getNormalArray(), geom->getNormalBinding());
|
||||
addArray(geom->getColorArray(), geom->getColorBinding());
|
||||
addArray(geom->getSecondaryColorArray(), geom->getSecondaryColorBinding());
|
||||
addArray(geom->getFogCoordArray(), geom->getFogCoordBinding());
|
||||
addArray(geom->getVertexArray());
|
||||
addArray(geom->getNormalArray());
|
||||
addArray(geom->getColorArray());
|
||||
addArray(geom->getSecondaryColorArray());
|
||||
addArray(geom->getFogCoordArray());
|
||||
|
||||
for(unsigned int i=0; i<geom->getNumTexCoordArrays(); ++i)
|
||||
{
|
||||
addArray(geom->getTexCoordArray(i), osg::Geometry::BIND_PER_VERTEX);
|
||||
addArray(geom->getTexCoordArray(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void addArray(osg::Array* array, osg::Geometry::AttributeBinding binding)
|
||||
void addArray(osg::Array* array)
|
||||
{
|
||||
if (array && binding==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (array && array->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
{
|
||||
_arrays.push_back(array);
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ TangentSpaceGenerator::TangentSpaceGenerator()
|
||||
B_(new osg::Vec4Array),
|
||||
N_(new osg::Vec4Array)
|
||||
{
|
||||
T_->setBinding(osg::Geometry::BIND_PER_VERTEX); T_->setNormalize(false);
|
||||
B_->setBinding(osg::Geometry::BIND_PER_VERTEX); T_->setNormalize(false);
|
||||
N_->setBinding(osg::Geometry::BIND_PER_VERTEX); T_->setNormalize(false);
|
||||
T_->setBinding(osg::Array::BIND_PER_VERTEX); T_->setNormalize(false);
|
||||
B_->setBinding(osg::Array::BIND_PER_VERTEX); T_->setNormalize(false);
|
||||
N_->setBinding(osg::Array::BIND_PER_VERTEX); T_->setNormalize(false);
|
||||
}
|
||||
|
||||
TangentSpaceGenerator::TangentSpaceGenerator(const TangentSpaceGenerator ©, const osg::CopyOp ©op)
|
||||
|
@ -433,7 +433,7 @@ void Tessellator::handleNewVertices(osg::Geometry& geom,VertexPtrToIndexMap &ver
|
||||
|
||||
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geom.getVertexArray());
|
||||
osg::Vec3Array* normals = NULL;
|
||||
if (geom.getNormalBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (osg::getBinding(geom.getNormalArray())==osg::Array::BIND_PER_VERTEX)
|
||||
{
|
||||
normals = dynamic_cast<osg::Vec3Array*>(geom.getNormalArray());
|
||||
}
|
||||
@ -441,17 +441,17 @@ void Tessellator::handleNewVertices(osg::Geometry& geom,VertexPtrToIndexMap &ver
|
||||
typedef std::vector<osg::Array*> ArrayList;
|
||||
ArrayList arrays;
|
||||
|
||||
if (geom.getColorBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (osg::getBinding(geom.getColorArray())==osg::Array::BIND_PER_VERTEX)
|
||||
{
|
||||
arrays.push_back(geom.getColorArray());
|
||||
}
|
||||
|
||||
if (geom.getSecondaryColorBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (osg::getBinding(geom.getSecondaryColorArray())==osg::Array::BIND_PER_VERTEX)
|
||||
{
|
||||
arrays.push_back(geom.getSecondaryColorArray());
|
||||
}
|
||||
|
||||
if (geom.getFogCoordBinding()==osg::Geometry::BIND_PER_VERTEX)
|
||||
if (osg::getBinding(geom.getFogCoordArray())==osg::Array::BIND_PER_VERTEX)
|
||||
{
|
||||
arrays.push_back(geom.getFogCoordArray());
|
||||
}
|
||||
@ -610,7 +610,7 @@ void Tessellator::reduceArray(osg::Array * cold, const unsigned int nnu)
|
||||
void Tessellator::collectTessellation(osg::Geometry &geom, unsigned int originalIndex)
|
||||
{
|
||||
if (geom.containsDeprecatedData()) geom.fixDeprecatedData();
|
||||
|
||||
|
||||
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geom.getVertexArray());
|
||||
VertexPtrToIndexMap vertexPtrToIndexMap;
|
||||
|
||||
@ -627,14 +627,14 @@ void Tessellator::collectTessellation(osg::Geometry &geom, unsigned int original
|
||||
{
|
||||
osg::Vec3Array* normals = NULL; // GWM Sep 2002 - add normals for extra facets
|
||||
int iprim=0;
|
||||
if (geom.getNormalBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET)
|
||||
if (osg::getBinding(geom.getNormalArray())==osg::Array::BIND_PER_PRIMITIVE_SET)
|
||||
{
|
||||
normals = dynamic_cast<osg::Vec3Array*>(geom.getNormalArray()); // GWM Sep 2002
|
||||
}
|
||||
// GWM Dec 2003 - needed to add colours for extra facets
|
||||
osg::Vec4Array* cols4 = NULL; // GWM Dec 2003 colours are vec4
|
||||
osg::Vec3Array* cols3 = NULL; // GWM Dec 2003 colours are vec3
|
||||
if (geom.getColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET)
|
||||
if (osg::getBinding(geom.getColorArray())==osg::Array::BIND_PER_PRIMITIVE_SET)
|
||||
{
|
||||
Array* colours = geom.getColorArray(); // GWM Dec 2003 - need to duplicate face colours
|
||||
switch (colours->getType()) {
|
||||
@ -736,12 +736,12 @@ void Tessellator::collectTessellation(osg::Geometry &geom, unsigned int original
|
||||
if (cols3) cols3->push_back(primCol3); // GWM Dec 2003 add flat shaded colour for new facet
|
||||
}
|
||||
if (prim->_mode==GL_TRIANGLES) {
|
||||
if (geom.getNormalBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) { // need one per triangle? Not one per set.
|
||||
if (osg::getBinding(geom.getNormalArray())==osg::Array::BIND_PER_PRIMITIVE_SET) { // need one per triangle? Not one per set.
|
||||
for (int ii=1; ii<ntris; ii++) {
|
||||
if (normals) normals->push_back(norm); // GWM Sep 2002 add flat shaded normal for new facet
|
||||
}
|
||||
}
|
||||
if (geom.getColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) { // need one per triangle? Not one per set.
|
||||
if (osg::getBinding(geom.getColorArray())==osg::Array::BIND_PER_PRIMITIVE_SET) { // need one per triangle? Not one per set.
|
||||
for (int ii=1; ii<ntris; ii++) {
|
||||
if (cols3 && _index>=cols3->size()) {
|
||||
if (cols3) cols3->push_back(primCol3);
|
||||
|
@ -58,25 +58,25 @@ struct VertexAttribComparitor
|
||||
{
|
||||
VertexAttribComparitor(osg::Geometry& geometry)
|
||||
{
|
||||
add(geometry.getVertexArray(),osg::Geometry::BIND_PER_VERTEX);
|
||||
add(geometry.getNormalArray(),geometry.getNormalBinding());
|
||||
add(geometry.getColorArray(),geometry.getColorBinding());
|
||||
add(geometry.getSecondaryColorArray(),geometry.getSecondaryColorBinding());
|
||||
add(geometry.getFogCoordArray(),geometry.getFogCoordBinding());
|
||||
add(geometry.getVertexArray());
|
||||
add(geometry.getNormalArray());
|
||||
add(geometry.getColorArray());
|
||||
add(geometry.getSecondaryColorArray());
|
||||
add(geometry.getFogCoordArray());
|
||||
unsigned int i;
|
||||
for(i=0;i<geometry.getNumTexCoordArrays();++i)
|
||||
{
|
||||
add(geometry.getTexCoordArray(i),osg::Geometry::BIND_PER_VERTEX);
|
||||
add(geometry.getTexCoordArray(i));
|
||||
}
|
||||
for(i=0;i<geometry.getNumVertexAttribArrays();++i)
|
||||
{
|
||||
add(geometry.getVertexAttribArray(i),geometry.getVertexAttribBinding(i));
|
||||
add(geometry.getVertexAttribArray(i));
|
||||
}
|
||||
}
|
||||
|
||||
void add(osg::Array* array, osg::Geometry::AttributeBinding binding)
|
||||
void add(osg::Array* array)
|
||||
{
|
||||
if (binding==osg::Geometry::BIND_PER_VERTEX && array)
|
||||
if (array && array->getBinding()==osg::Array::BIND_PER_VERTEX)
|
||||
{
|
||||
for(ArrayList::const_iterator itr=_arrayList.begin();
|
||||
itr!=_arrayList.end();
|
||||
@ -216,13 +216,13 @@ void TriStripVisitor::stripify(Geometry& geom)
|
||||
{
|
||||
if (geom.containsDeprecatedData()) geom.fixDeprecatedData();
|
||||
|
||||
if (geom.getNormalBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return;
|
||||
if (osg::getBinding(geom.getNormalArray())==osg::Array::BIND_PER_PRIMITIVE_SET) return;
|
||||
|
||||
if (geom.getColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return;
|
||||
if (osg::getBinding(geom.getColorArray())==osg::Array::BIND_PER_PRIMITIVE_SET) return;
|
||||
|
||||
if (geom.getSecondaryColorBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return;
|
||||
if (osg::getBinding(geom.getSecondaryColorArray())==osg::Array::BIND_PER_PRIMITIVE_SET) return;
|
||||
|
||||
if (geom.getFogCoordBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return;
|
||||
if (osg::getBinding(geom.getFogCoordArray())==osg::Array::BIND_PER_PRIMITIVE_SET) return;
|
||||
|
||||
// no point tri stripping if we don't have enough vertices.
|
||||
if (!geom.getVertexArray() || geom.getVertexArray()->getNumElements()<3) return;
|
||||
@ -553,7 +553,7 @@ void TriStripVisitor::stripify(Geometry& geom)
|
||||
1.0f);
|
||||
}
|
||||
geom.setColorArray(colors);
|
||||
geom.setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE_SET);
|
||||
geom.setColorBinding(osg::Array::BIND_PER_PRIMITIVE_SET);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user