Picking scene elements without an osg::View

classic Classic list List threaded Threaded
2 messages Options
Earthican Earthican
Reply | Threaded
Open this post in threaded view
|

Picking scene elements without an osg::View

I have osgEarth rendering to a texture, which is used on a Quad in a 3D scene.

As such it doesn’t have a View with which to interact directly.

I have TrackNodes being rendered and am trying to pick them. The suggested mechanism (http://forum.osgearth.org/TrackNode-IntersectionPicker-stop-working-upgrading-to-osgEarth-2-8-tp7590303.html) is to use RTTPicker, but that requires a View.

Although I’ve managed to adapt code from Terrain::getWorldCoordsUnderMouse to get me a terrain location from a location normalised with respect to the rendered Quad, adapting RTTPicker in such a manner seems a much more complex proposition.

Is there a recommended way of using RTTPicker or other class to pick osgEarth scene elements in the absence of a View?

I’m happy to switch to another class (other than TrackNode) if that will work with DPLineSegmentIntersector, which I'm using for the terrain intersection. I’m not yet familiar with the other classes, although LocalGeometryNode is a prime candidate for another symbol I have in mind, although I’m not sure how that could replace TrackNode.

If it helps, I want to be able to draw a constant size representation of a track (e.g. a paper plane model) with a stick or shadow below it to the Earth’s surface or replace it with an abstract symbol (the TrackNode). Both would be labelled.

I am using osgEarth 2.8 with OSG 3.4.0.

Thanks for any advice you can offer.
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Picking scene elements without an osg::View

Hello "Earthican" --

Yes the RTTPicker takes a View, but it really only uses the underlying osg::Camera and the osg::Framestamp from that View. So you could conceivably create a "fake" View and configure its camera/framestamp as you need for the pick. My guess is you'd need to sync up the camera matrices with the camera you used to render your texture in the first place. Then convert the mouse coordinates just as you did for the getWorldCoords approach.

Hope this helps!
Glenn Waldron / Pelican Mapping