当前位置: 首页>>代码示例>>C++>>正文


C++ Geode::accept方法代码示例

本文整理汇总了C++中osg::Geode::accept方法的典型用法代码示例。如果您正苦于以下问题:C++ Geode::accept方法的具体用法?C++ Geode::accept怎么用?C++ Geode::accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在osg::Geode的用法示例。


在下文中一共展示了Geode::accept方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

void
VertexCacheOptimizer::apply(osg::Geode& geode)
{
    if (geode.getDataVariance() == osg::Object::DYNAMIC)
        return;

    for(unsigned i=0; i<geode.getNumDrawables(); ++i )
    {
        osg::Geometry* geom = geode.getDrawable(i)->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;
    geode.accept( vcv );
    vcv.optimizeVertices();

    osgUtil::VertexAccessOrderVisitor vaov;
    geode.accept( vaov );
    vaov.optimizeOrder();

    traverse( geode );
}
开发者ID:Joe-Wong,项目名称:osgearth,代码行数:50,代码来源:Utils.cpp

示例2: apply

void ProjectVisitor::apply(osg::Geode& node) 
{
    if (_clearEveryDrawable)
        _projector.clear();

    std::vector<osg::Drawable*> toremove;
    std::vector<osg::ref_ptr<osg::Geometry> > toadd;
    for (int i = 0; i < node.getNumDrawables(); i++) {

        osg::Timer_t t0 = osg::Timer::instance()->tick();
        node.getDrawable(i)->accept(_projector);
        double duration = osg::Timer::instance()->delta_s(t0, osg::Timer::instance()->tick());

        if (_projector.hasGeometry()) {
            toremove.push_back(node.getDrawable(i));
            std::stringstream ss;
            ss << "projected_" << _index << ".osg";
            osg::notify(osg::INFO) <<  "duration " << duration << " " << ss.str() << std::endl;
            if (_writeResultOnDisk)
                _projector.write(ss.str());
            
            if (!_mergeGeometry) {
                osg::ref_ptr<osg::Geometry> result = _projector._result.get();
                result->setUserData(node.getDrawable(i)->getUserData());
                toadd.push_back(result);
                _projector.clear();
            }
        }
        _index++;
        _cummulatedTime += duration;
    }

    if (_mergeGeometry) {
        if (_projector.hasGeometry()) {
            toadd.push_back(_projector._result.get());
        }
    }

    for (int i = 0; i < toremove.size(); i++) // remove only where success to project data
        node.removeDrawable(toremove[i]);

    for (int i = 0; i < toadd.size(); i++) {// remove only where success to project data
        node.addDrawable(toadd[i]);
    }

    if (_projectToXYZ) {
        osg::ref_ptr<LatLongHeight2xyz> visitor = new LatLongHeight2xyz();
        node.accept(*visitor);
    }

    // smooth after project
    if (_smooth) {
        osgUtil::SmoothingVisitor smooth;
        for (int i = 0; i < toadd.size(); i++) {// remove only where success to project data
            smooth.smooth(*toadd[i]);
        }
    }

}
开发者ID:cedricpinson,项目名称:ProjectToHeightfield,代码行数:59,代码来源:ProjectorVisitor.cpp

示例3: apply

void AddQueries::apply( osg::Geode& node )
{
    traverse( node );

    osgwTools::CountsVisitor cv;
    node.accept( cv );
    const unsigned int numVertices = cv.getVertices();
    const osg::BoundingBox& bb = node.getBoundingBox();
    addDataToNodePath( getNodePath(), numVertices, bb );
}
开发者ID:AdriCS,项目名称:osgWorks-mirror,代码行数:10,代码来源:QueryUtils.cpp


注:本文中的osg::Geode::accept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。