本文整理汇总了C++中ImageLayer::addColorFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLayer::addColorFilter方法的具体用法?C++ ImageLayer::addColorFilter怎么用?C++ ImageLayer::addColorFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageLayer
的用法示例。
在下文中一共展示了ImageLayer::addColorFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
// main program.
int main(int argc, char** argv)
{
// set up the viewer
osg::ArgumentParser arguments(&argc,argv);
osgViewer::Viewer viewer(arguments);
// make sure we have a shape file.
std::string shapefile;
if ( !arguments.read("--shapefile", shapefile) )
return usage("Missing required --shapefile argument");
// install a motion model
viewer.setCameraManipulator( new osgEarth::Util::EarthManipulator() );
// create a visible imagery layer:
ImageLayer* imagery = createImageryLayer();
// create a masking layer using the shapefile:
ImageLayer* sharedLayer = createSharedLayer( shapefile );
// create a new map and add our two layers.
MapNode* mapnode = new MapNode();
mapnode->getMap()->addImageLayer( imagery );
mapnode->getMap()->addImageLayer( sharedLayer );
// make a custom color-filter shader that will modulate the imagery
// using the texture from the shared layer. (Using a ColorFilter
// will apply the effect to just one layer; if you want to apply it
// to all layers, you can just create a VirtualProgram and apply that
// the the mapnode->getTerrainEngine() state set.)
ColorFilter* filter = new MyColorFilter( sharedLayer );
imagery->addColorFilter( filter );
// done!
viewer.setSceneData( mapnode );
MapNodeHelper().configureView(&viewer);
return viewer.run();
}
示例2: arguments
int
main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc,argv);
// Which filter?
bool useHSL = arguments.read("--hsl");
bool useRGB = arguments.read("--rgb");
bool useCMYK = arguments.read("--cmyk");
bool useBC = arguments.read("--bc");
bool useGamma = arguments.read("--gamma");
bool useChromaKey = arguments.read("--chromakey");
if ( !useHSL && !useRGB && !useCMYK && !useBC && !useGamma && !useChromaKey )
{
return usage( "Please select one of the filter options!" );
}
osgViewer::Viewer viewer(arguments);
viewer.setCameraManipulator( new EarthManipulator() );
// load an earth file
osg::Node* node = MapNodeHelper().load(arguments, &viewer);
if ( !node )
return usage( "Unable to load map from earth file!" );
viewer.setSceneData( node );
//Create the control panel
Container* box = createControlPanel(&viewer);
osgEarth::MapNode* mapNode = osgEarth::MapNode::findMapNode( node );
if ( node )
{
if (mapNode->getMap()->getNumImageLayers() == 0)
{
return usage("Please provide a map with at least one image layer.");
}
// attach color filter to each layer.
unsigned numLayers = mapNode->getMap()->getNumImageLayers();
for( unsigned i=0; i<numLayers; ++i )
{
ImageLayer* layer = mapNode->getMap()->getImageLayerAt( i );
if ( layer->getEnabled() && layer->getVisible() )
{
if ( useHSL )
{
HSLColorFilter* filter = new HSLColorFilter();
layer->addColorFilter( filter );
HSL::addControls( filter, box, i );
}
else if ( useRGB )
{
RGBColorFilter* filter = new RGBColorFilter();
layer->addColorFilter( filter );
RGB::addControls( filter, box, i );
}
else if ( useCMYK )
{
CMYKColorFilter* filter = new CMYKColorFilter();
layer->addColorFilter( filter );
CMYK::addControls( filter, box, i );
}
else if ( useBC )
{
BrightnessContrastColorFilter* filter = new BrightnessContrastColorFilter();
layer->addColorFilter( filter );
BC::addControls( filter, box, i );
}
else if ( useGamma )
{
GammaColorFilter* filter = new GammaColorFilter();
layer->addColorFilter( filter );
GAMMA::addControls( filter, box, i );
}
else if ( useChromaKey )
{
ChromaKeyColorFilter* filter = new ChromaKeyColorFilter();
layer->addColorFilter( filter );
CHROMAKEY::addControls( filter, box , i );
}
}
}
}
return viewer.run();
}