[osg-users] replace tile with my own Node in VPB generated QuadTree
Sebastian Messerschmidt
sebastian.messerschmidt at gmx.de
Sat Dec 3 08:04:12 PST 2016
Hi Nick,
> Hi Robert, Community,
>
> I am hacking the VPB process again :-).
>
> The story is this: I transform tiles back from ECEF to local, do
> something with the Geometry and I want to replace the tile with my own
> Node. Spent already hours reading and trying to understand the
> SceneGraph with all this transforms, and I am failing.
>
> Any words of how these tiles in the QuadTree are represented? I mean
> the tree and the transforms, I know the facts that they are coming
> from TerrainTiles with proper Locators, but after when the
> GeometryTechnique is applied.
I worked it out some years ago, where I needed to capture the
transformations for a query-representation. Basically you will have a
height field-layer inside the terrain-tile, which describes itself via a
Locator and the height-values in a normalized coordinate frame. IIRC the
complete ECEF-Transform is captured inside the locator. It simply
assumes the height-field as being centered around the geographic
position when creating the world-geometry.
Some snippet to retrieve the world-coordinates of the terrain-tile's center:
<code>
osgTerrain::TerrainTile& terrain_tile =
dynamic_cast<osgTerrain::TerrainTile&>(node);
osgTerrain::HeightFieldLayer* hf_layer=
dynamic_cast<osgTerrain::HeightFieldLayer*>(terrain_tile.getElevationLayer());
osgTerrain::Locator* locator = terrain_tile.getLocator();
osg::EllipsoidModel* es = locator->getEllipsoidModel();
//compute center transform
osg::Vec3d center_model;
tile ->convertLocalToModel(osg::Vec3d(0.5,0.5,0.0), center_model);
</code>
I'm not quite sure which coordinate frame is used in the quadtree
itself, but it should be easy enough to put some subgraph to an osgt to
inspect.
Cheers
Sebastian
>
> Thanks so much for any word on this. It is the last bump in my current dev
>
> Cheers,
> Nick
>
> --
> trajce nikolov nick
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20161203/78423c5d/attachment-0003.htm>
More information about the osg-users
mailing list