Quantcast

Regarding Lod and Buildings appearing

classic Classic list List threaded Threaded
1 message Options
Rambabu Rambabu
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Regarding Lod and Buildings appearing

Hi Iam using osg::lod for fast loading of buildings  and adding the model layer to the lod,Buildings are not appearing on the terrain,How to make buildings appear with fast loading in the terrain using osg::lod or any other method?

I posted my code below

        OGRFeatureOptions feature_opt;
        feature_opt.name()              = "buildings";
        feature_opt.url()               = BUILDINGS_URL;
        feature_opt.buildSpatialIndex() = true;

        Style buildingStyle;
        buildingStyle.setName("buildings");

        ExtrusionSymbol* extrusion    = buildingStyle.getOrCreate<ExtrusionSymbol>();
        extrusion->heightExpression() = NumericExpression("10 + (Math.random() * 21)");
        extrusion->flatten()          = true;
        extrusion->wallStyleName()    = "building-wall";
        extrusion->roofStyleName()    = "building-roof";

       PolygonSymbol* poly   = buildingStyle.getOrCreate<PolygonSymbol>();
       poly->fill()->color() = Color::White;

        AltitudeSymbol* alt = buildingStyle.getOrCreate<AltitudeSymbol>();
        alt->clamping()     = alt->CLAMP_TO_TERRAIN;
        alt->binding()      = alt->BINDING_VERTEX;

        Style wallStyle;
        wallStyle.setName("building-wall");
        SkinSymbol* wallSkin   = wallStyle.getOrCreate<SkinSymbol>();
        wallSkin->library()    = "us_resources";
        wallSkin->addTag("building");
        wallSkin->randomSeed() = 1;

        Style roofStyle;
        roofStyle.setName("building-roof");
        SkinSymbol* roofSkin   = roofStyle.getOrCreate<SkinSymbol>();
        roofSkin->library()    = "us_resources";
        roofSkin->addTag("rooftop");
        roofSkin->randomSeed() = 1;
        roofSkin->isTiled()    = true;
       
        StyleSheet* styleSheet = new StyleSheet();
        styleSheet->addStyle(buildingStyle);
        styleSheet->addStyle(wallStyle);
        styleSheet->addStyle(roofStyle);

        ResourceLibrary* reslib = new ResourceLibrary("us_resources", RESOURCE_LIB_URL);
        styleSheet->addResourceLibrary(reslib);


        FeatureGeomModelOptions fgm_opt;
        fgm_opt.featureOptions()  =  feature_opt;
        fgm_opt.styles()               =  styleSheet;
        fgm_opt.optimize()           =  true;

       ModelLayerOptions options("my features", fgm_opt);
        ModelLayer *layer = new ModelLayer(options);

       osg::ref_ptr<osg::LOD> lod = new osg::LOD;
       lod->addChild(layer->asNode(), 0, 10000);
        map->addModelLayer(new ModelLayer("buildings", lod));

    Any Help is appreciated.

Thanks,
R.Rambabu
       
Loading...