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


C++ ImageToHeightFieldConverter::convert方法代码示例

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


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

示例1: write

void
TileModel::generateElevationTexture()
{
    osg::Image* image = 0L;
    osg::HeightField* hf = _elevationData.getHeightField();
    if ( hf )
    {
        ImageToHeightFieldConverter conv;
        image = conv.convert( hf, 32 );
    }
    else
    {
        // no heightfield; create one and initialize it to zero.
        image = new osg::Image();
        image->allocateImage(32, 32, 1, GL_LUMINANCE, GL_FLOAT);
        ImageUtils::PixelWriter write(image);
        for(int s=0; s<image->s(); ++s)
            for(int t=0; t<image->t(); ++t)
                write(osg::Vec4(0,0,0,0), s, t);        
    }

    _elevationTexture = new osg::Texture2D( image );

    _elevationTexture->setInternalFormat(GL_LUMINANCE32F_ARB);
    _elevationTexture->setSourceFormat(GL_LUMINANCE);
    _elevationTexture->setFilter( osg::Texture::MAG_FILTER, osg::Texture::LINEAR );
    _elevationTexture->setFilter( osg::Texture::MIN_FILTER, osg::Texture::LINEAR );
    _elevationTexture->setWrap  ( osg::Texture::WRAP_S,     osg::Texture::CLAMP_TO_EDGE );
    _elevationTexture->setWrap  ( osg::Texture::WRAP_T,     osg::Texture::CLAMP_TO_EDGE );
    _elevationTexture->setResizeNonPowerOfTwoHint( false );
    _elevationTexture->setMaxAnisotropy( 1.0f );
}
开发者ID:MarxGonzalez,项目名称:osgearth,代码行数:32,代码来源:TileModel.cpp

示例2:

void
Cache::setHeightField( const TileKey& key, const CacheSpec& spec, const osg::HeightField* hf)
{
	ImageToHeightFieldConverter conv;
	//Take a reference to the returned image so it gets deleted properly
    osg::ref_ptr<osg::Image> image = conv.convert(hf);
	setImage( key, spec, image.get() );
}
开发者ID:hulumogu,项目名称:osgearth,代码行数:8,代码来源:Caching.cpp

示例3: createImage

osg::HeightField*
TileSource::createHeightField(const TileKey&        key,
                              ProgressCallback*     progress)
{
    //osg::ref_ptr<osg::Image> image = createImage(key, dbOptions, progress);
    osg::ref_ptr<osg::Image> image = createImage(key, progress);
    osg::HeightField* hf = 0;
    if (image.valid())
    {
        ImageToHeightFieldConverter conv;
        hf = conv.convert( image.get() );
    }      
    return hf;
}
开发者ID:spencerg,项目名称:osgearth,代码行数:14,代码来源:TileSource.cpp

示例4: createImage

osg::HeightField*
WCS11Source::createHeightField(const TileKey&        key,
                               ProgressCallback*     progress)
{
    osg::HeightField* field = NULL;

    osg::ref_ptr<osg::Image> image = createImage( key, progress );
    if ( image.valid() )
    {        
        ImageToHeightFieldConverter conv;
        conv.setRemoveNoDataValues( true );
        field = conv.convert( image.get() );
    }

    return field;
}
开发者ID:ifad-ts,项目名称:osgearth,代码行数:16,代码来源:WCS11Source.cpp

示例5: storeImage

bool
TileSource::storeHeightField(const TileKey&     key,
                             osg::HeightField*  hf,
                              ProgressCallback* progress)
{
    if ( _status != STATUS_OK || hf == 0L )
        return 0L;

    ImageToHeightFieldConverter conv;
    osg::ref_ptr<osg::Image> image = conv.convert(hf, 32);
    if (image.valid())
    {
        return storeImage(key, image.get(), progress);
    }
    return false;
}
开发者ID:makemefriendanshu,项目名称:osgearth,代码行数:16,代码来源:TileSource.cpp

示例6: createHeightField

    /** override */
    osg::HeightField* createHeightField( const TileKey& key, ProgressCallback* progress)
    {
        osg::Image* image = createImage(key, progress);
        if (!image)
        {
            OE_INFO << "[osgEarth::WMS] Failed to read heightfield from " << createURI(key) << std::endl;
        }

        float scaleFactor = 1;

        //Scale the heightfield to meters
        if ( _options.elevationUnit() == "ft")
        {
            scaleFactor = 0.3048;
        }

        ImageToHeightFieldConverter conv;
        return conv.convert( image, scaleFactor );
    }
开发者ID:caishanli,项目名称:osgearth,代码行数:20,代码来源:ReaderWriterWMS.cpp


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