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


C++ EngineContext::getLoader方法代码示例

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


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

示例1: lock

void
TileNode::load(osg::NodeVisitor& nv)
{
    // Access the context:
    EngineContext* context = static_cast<EngineContext*>( nv.getUserData() );

    // Create a new load request on demand:
    if ( !_loadRequest.valid() )
    {
        Threading::ScopedMutexLock lock(_mutex);
        if ( !_loadRequest.valid() )
        {
            _loadRequest = new LoadTileData( this, context );
            _loadRequest->setName( _key.str() );
            _loadRequest->setTileKey( _key );
        }
    }

    // Prioritize by LOD. (negated because lower order gets priority)
    float priority = - (float)getTileKey().getLOD();

    if ( context->getOptions().highResolutionFirst() == true )
        priority = -priority;

    // then sort by distance within each LOD.
    float distance = nv.getDistanceToViewPoint( getBound().center(), true );
    priority = 10.0f*priority - log10(distance);

    // testing intermediate loading idea...
    //if ( getTileKey().getLOD() == 5 )
    //    priority += 100.0f;

    // Submit to the loader.
    context->getLoader()->load( _loadRequest.get(), priority, nv );
}
开发者ID:yaroslav-tarasov,项目名称:osgearth,代码行数:35,代码来源:TileNode.cpp

示例2: lock

void
TileNode::load(osg::NodeVisitor& nv)
{
    // Access the context:
    EngineContext* context = VisitorData::fetch<EngineContext>(nv, ENGINE_CONTEXT_TAG);

    // Create a new load request on demand:
    if ( !_loadRequest.valid() )
    {
        Threading::ScopedMutexLock lock(_mutex);
        if ( !_loadRequest.valid() )
        {
            _loadRequest = new LoadTileData( this, context );
            _loadRequest->setName( _key.str() );
            _loadRequest->setTileKey( _key );
        }
    }

    
    // Construct the load PRIORITY: 0=lowest, 1=highest.
    
    const SelectionInfo& si = context->getSelectionInfo();
    int lod     = getTileKey().getLOD();
    int numLods = si.numLods();
    
    // LOD priority is in the range [0..numLods]
    float lodPriority = (float)lod;
    if ( context->getOptions().highResolutionFirst() == false )
        lodPriority = (float)(numLods - lod);

    float distance = nv.getDistanceToViewPoint(getBound().center(), true);

    // dist priority uis in the range [0..1]
    float distPriority = 1.0 - distance/si.visParameters(0)._visibilityRange;

    // add thenm together, and you get tiles sorted first by lodPriority (because of
    // the biggest range), and second by distance.
    float priority = lodPriority + distPriority;

    // normalize the composite priority to [0..1].
    priority /= (float)(numLods+1);

    // Submit to the loader.
    context->getLoader()->load( _loadRequest.get(), priority, nv );
}
开发者ID:rhabacker,项目名称:osgearth,代码行数:45,代码来源:TileNode.cpp

示例3: lock

void
TileNode::expireChildren(osg::NodeVisitor& nv)
{
    OE_DEBUG << LC << "Expiring children of " << getTileKey().str() << "\n";

    EngineContext* context = static_cast<EngineContext*>( nv.getUserData() );
    if ( !_expireRequest.valid() )
    {
        Threading::ScopedMutexLock lock(_mutex);
        if ( !_expireRequest.valid() )
        {
            _expireRequest = new ExpireTiles(this, context);
            _expireRequest->setName( getTileKey().str() + " expire" );
            _expireRequest->setTileKey( _key );
        }
    }
       
    // Low priority for expiry requests.
    const float lowPriority = -100.0f;
    context->getLoader()->load( _expireRequest.get(), lowPriority, nv );
}
开发者ID:caomw,项目名称:osgearth,代码行数:21,代码来源:TileNode.cpp


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