本文整理汇总了C++中osg::Drawable::asGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ Drawable::asGeometry方法的具体用法?C++ Drawable::asGeometry怎么用?C++ Drawable::asGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::Drawable
的用法示例。
在下文中一共展示了Drawable::asGeometry方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: traverse
void
AllocateAndMergeBufferObjectsVisitor::apply(osg::Drawable& drawable)
{
osg::Geometry* geom = drawable.asGeometry();
if ( geom )
{
// We disable vbo's and then re-enable them to enable sharing of all the arrays.
geom->setUseDisplayList( false );
geom->setUseVertexBufferObjects( false );
geom->setUseVertexBufferObjects( true );
}
traverse(drawable);
}
示例2: apply
void
BuildTopologyVisitor::apply(osg::Drawable& drawable)
{
osg::Geometry* geom = drawable.asGeometry();
if (geom)
{
osg::Vec3Array* verts = dynamic_cast<osg::Vec3Array*>(geom->getVertexArray());
if (verts)
{
apply(&drawable, verts);
}
}
}
示例3: switch
void
VertexCacheOptimizer::apply(osg::Drawable& drawable)
{
if (drawable.getDataVariance() == osg::Object::DYNAMIC)
return;
osg::Geometry* geom = drawable.asGeometry();
if ( geom )
{
if ( geom->getDataVariance() == osg::Object::DYNAMIC )
return;
// vertex cache optimizations currently only support surface geometries.
// all or nothing in the geode.
osg::Geometry::PrimitiveSetList& psets = geom->getPrimitiveSetList();
for( osg::Geometry::PrimitiveSetList::iterator i = psets.begin(); i != psets.end(); ++i )
{
switch( (*i)->getMode() )
{
case GL_TRIANGLES:
case GL_TRIANGLE_FAN:
case GL_TRIANGLE_STRIP:
case GL_QUADS:
case GL_QUAD_STRIP:
case GL_POLYGON:
break;
default:
return;
}
}
}
//OE_NOTICE << LC << "VC optimizing..." << std::endl;
// passed the test; run the optimizer.
osgUtil::VertexCacheVisitor vcv;
drawable.accept( vcv );
vcv.optimizeVertices();
osgUtil::VertexAccessOrderVisitor vaov;
drawable.accept( vaov );
vaov.optimizeOrder();
traverse( drawable );
}
示例4: apply
void StatsVisitor::apply(osg::Drawable& drawable)
{
if (drawable.getStateSet())
{
apply(*drawable.getStateSet());
}
++_numInstancedDrawable;
drawable.accept(_instancedStats);
_drawableSet.insert(&drawable);
osg::Geometry* geometry = drawable.asGeometry();
if (geometry)
{
++_numInstancedGeometry;
_geometrySet.insert(geometry);
++_numInstancedFastGeometry;
_fastGeometrySet.insert(geometry);
}
}