本文整理汇总了C++中osg::Geometry::getArrayList方法的典型用法代码示例。如果您正苦于以下问题:C++ Geometry::getArrayList方法的具体用法?C++ Geometry::getArrayList怎么用?C++ Geometry::getArrayList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Geometry
的用法示例。
在下文中一共展示了Geometry::getArrayList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
GeometryValidator::apply(osg::Geometry& geom)
{
if ( geom.getVertexArray() == 0L )
{
OE_NOTICE << LC << "NULL vertex array!!\n";
return;
}
unsigned numVerts = geom.getVertexArray()->getNumElements();
if ( numVerts == 0 )
{
OE_NOTICE << LC << "No verts!! name=" << geom.getName() << "\n";
return;
}
std::set<osg::BufferObject*> _vbos;
osg::Geometry::ArrayList arrays;
geom.getArrayList(arrays);
for(unsigned i=0; i<arrays.size(); ++i)
{
osg::Array* a = arrays[i].get();
if ( a )
{
if ( a->getBinding() == a->BIND_OVERALL && a->getNumElements() != 1 )
{
OE_NOTICE << LC << "Found an array with BIND_OVERALL and size <> 1\n";
}
else if ( a->getBinding() == a->BIND_PER_VERTEX && a->getNumElements() != numVerts )
{
OE_NOTICE << LC << "Found BIND_PER_VERTEX with wrong number of elements (expecting " << numVerts << "; found " << a->getNumElements() << ")\n";
}
_vbos.insert( a->getVertexBufferObject() );
}
else
{
OE_NOTICE << LC << "Found a NULL array\n";
}
}
if ( _vbos.size() != 1 )
{
OE_NOTICE << LC << "Found a Geometry that uses more than one VBO (non-optimal sharing)\n";
}
const osg::Geometry::PrimitiveSetList& plist = geom.getPrimitiveSetList();
std::set<osg::BufferObject*> _ebos;
for( osg::Geometry::PrimitiveSetList::const_iterator p = plist.begin(); p != plist.end(); ++p )
{
osg::PrimitiveSet* pset = p->get();
osg::DrawArrays* da = dynamic_cast<osg::DrawArrays*>(pset);
if ( da )
{
if ( da->getFirst() >= numVerts )
{
OE_NOTICE << LC << "DrawArrays: first > numVerts\n";
}
if ( da->getFirst()+da->getCount() > numVerts )
{
OE_NOTICE << LC << "DrawArrays: first/count out of bounds\n";
}
if ( da->getCount() < 1 )
{
OE_NOTICE << LC << "DrawArrays: count is zero\n";
}
}
bool isDe = pset->getDrawElements() != 0L;
osg::DrawElementsUByte* de_byte = dynamic_cast<osg::DrawElementsUByte*>(pset);
if ( de_byte )
{
validateDE(de_byte, 0xFF, numVerts );
_ebos.insert( de_byte->getElementBufferObject() );
}
osg::DrawElementsUShort* de_short = dynamic_cast<osg::DrawElementsUShort*>(pset);
if ( de_short )
{
validateDE(de_short, 0xFFFF, numVerts );
_ebos.insert( de_short->getElementBufferObject() );
}
osg::DrawElementsUInt* de_int = dynamic_cast<osg::DrawElementsUInt*>(pset);
if ( de_int )
{
validateDE(de_int, 0xFFFFFFFF, numVerts );
_ebos.insert( de_int->getElementBufferObject() );
}
if ( pset->getNumIndices() == 0 )
{
OE_NOTICE << LC << "Primset: num elements = 0; class=" << pset->className() << ", name=" << pset->getName() << "\n";
//.........这里部分代码省略.........