Unsure how to position models on earth for incremental loading

classic Classic list List threaded Threaded
7 messages Options
GameCodingNinja GameCodingNinja
Reply | Threaded
Open this post in threaded view
|

Unsure how to position models on earth for incremental loading

I'm trying to make use of the paging layout for incremental loading via FeatureDisplayLayout. In code, I'm not sure where to tell it the position and rotation of the model. The center of the model is 0,0 so all I need to do is position it on the earth.

I've been looking at osgearth_city but this seems to position the buildings randomly. I'm not sure if this is something I need to do via OSGEarth or OSG.

If someone could post some sample code, that would be greatly appreciated!

gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Unsure how to position models on earth for incremental loading

Ninja, if you are just trying to place a single model, you can load it and put it under a GeoTransform node.

http://docs.osgearth.org/en/latest/faq.html#how-do-i-place-a-3d-model-on-the-map

Glenn Waldron / Pelican Mapping
GameCodingNinja GameCodingNinja
Reply | Threaded
Open this post in threaded view
|

Re: Unsure how to position models on earth for incremental loading

This post was updated on .
Thanks Glenn.

I'm currently able to load and position a model. I'm trying to see if I can get it to load incrementally.

It looks like FeatureDisplayLayout uses a radius to determine when you're close enough to start loading the model. A radius needs a position to determine if you're close enough to trigger the load. Where do you enter in this position or perhaps a matrix?

I've been pouring through the code (OGRFeatureOptions, AltitudeSymbol, Style, FeatureDisplayLayout, FeatureGeomModelOptions, etc) trying to figure out how to do this.

I'm basically trying to understand how osgEarth's "paging layout for incremental loading" works and I'm using a model to test the feature.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Unsure how to position models on earth for incremental loading

I'm afraid you are barking up the wrong tree. FeatureDisplayLayout defines a schema for paged feature layers, i.e. for loading tiled data from GIS shapefiles and the like.

If you want to load a model, just load it and position it by placing it under a GeoTransform. If you want your model to become visible at a certain distance, you can put an osg::LOD node above it and set the LOD ranges.

Hope this helps.
Glenn Waldron / Pelican Mapping
GameCodingNinja GameCodingNinja
Reply | Threaded
Open this post in threaded view
|

Re: Unsure how to position models on earth for incremental loading

Thanks Glenn.

That would explain it. I figured a shape file is still geometry as your "city" example loads and extrudes. Still not sure how it gets positioned. Unfortunately, I don't fully conceptualize what a "feature" or a "symbol" is in the context of osgEarth. I sort of get what a "style" is but I'm foggy as to how it all comes together in the overall scheme of things.

I'll look into using osg::LOD as you suggested.

Cheers!
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Unsure how to position models on earth for incremental loading

The "city" example runs off of GIS data.

A shapefile (https://en.wikipedia.org/wiki/Shapefile) contains geometry in map coordinates (like latitude/longitude) already, so the positioning is inherent in the source data.

In GIS parlance, a "Feature" is an object that contains geometry (in map coordinates) along with a set of name/value pairs (called "properties" or "attributes"). A shapefile is one example of a data source that contains a collection of Features.

A "Style" is a description of how to render a Feature. It is comprised of Symbols, each of which describes some aspect of how the Feature should appear when rendered.

Hope this helps.
Glenn Waldron / Pelican Mapping
GameCodingNinja GameCodingNinja
Reply | Threaded
Open this post in threaded view
|

Re: Unsure how to position models on earth for incremental loading

Thanks for the explanation and all your help as well as providing us osgEarth!