How to bind texture to building roofs

classic Classic list List threaded Threaded
1 message Options
Xtof Xtof
Reply | Threaded
Open this post in threaded view
|

How to bind texture to building roofs

Hi all,

Is there a way to bind my own texture to building roofs instead of using us_resouces?

   osg::ref_ptr<osgEarth::SkinSymbol> roofSkin = roofStyle.getOrCreate<osgEarth::SkinSymbol>();
   roofSkin->library() = "us_resources";
   roofSkin->addTag("rooftop");
   roofSkin->randomSeed() = 1;
   roofSkin->isTiled() = true;
   ...
   osg::ref_ptr<osgEarth::Symbology::StyleSheet> styleSheet = new osgEarth::StyleSheet();
   styleSheet->addStyle(roofStyle);
   ...
   osgEarth::ResourceLibrary* resources = new osgEarth::ResourceLibrary("us_resources", ".../catalog.xml");
   styleSheet->addResourceLibrary(resources);

I'm able to create my own building (using osg::Geometry) and bind a texture on its roof (using osg::Texture2D) on osgEarth::Drivers::ModelLayer.
But how to do the same for buildings on osgEarth::Features::FeatureModelLayer?
My goal is to bind a texture coming from an osg::Image using building coordinates coming from osgEarth::Drivers::OGRFeatureOptions as texture coordinates.

Thanks,
Christophe