IntersectionPicker and LineDrawable

classic Classic list List threaded Threaded
4 messages Options
dcremoux dcremoux
Reply | Threaded
Open this post in threaded view
|

IntersectionPicker and LineDrawable

Hello all,

I did some tests with the IntersectionPicker provided by osgearth, but it seems that it doesn't pick/intersect LineDrawable objects.
Is it intended/normal? or did I do something wrong?

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

Re: IntersectionPicker and LineDrawable

Hi Dcremoux,

Correct you are; line-based intersectors only work with triangles, and will not work with line or point geometry (including LineDrawable). You can try using RTTPicker instead.
Glenn Waldron / Pelican Mapping
dcremoux dcremoux
Reply | Threaded
Open this post in threaded view
|

Re: IntersectionPicker and LineDrawable

Thanks a lot for your answer!

As far as I understood, LineDrawable creates (degenerated) triangles on cpu that are expanded in the vertex shader/gpu (regarding previous and next vertices), they also seem to have a bounding volume associated.

So is it technically possible to test intersection with it? As the intersection picker has a picking radius? (so it's more than just line intersection).
If yes, where could be the first place to look to add the functionality?

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

Re: IntersectionPicker and LineDrawable

I believe that in order to support intersectors a Drawable needs to implement the methods:

bool supports(const osg::PrimitiveFunctor& f) const { return true; }
void accept(osg::PrimitiveFunctor& f) const;

This (internal) class does it:

https://github.com/gwaldron/osgearth/blob/master/src/osgEarthDrivers/engine_rex/TileDrawable.cpp#L169

Hope that helps.
Glenn Waldron / Pelican Mapping