Cool stuff, thanks for addition...

I could have done with it a few weeks ago before I wrote some it for a
project here ;)


Best Regards



Gordon

__________________________________________________________

Gordon Tomlinson
Email  : gordon.tomlinson @ overwatch.com
YIM/AIM: Gordon3dBrit
MSN IM : Gordon3dBrit @ 3dSceneGraph.com


__________________________________________________________


"Self defence is not a function of learning tricks
but is a function of how quickly and intensely one
can arouse one's instinct for survival"
- Master Tambo Tetsura




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Robert Osfield
Sent: Tuesday, October 31, 2006 10:43 AM
To: osg users
Subject: [osg-users] Introducing
osgUtil::IntersectionVisitor,osgSim::LineOfSight and
osgSim::HeightAboveTerrain


Last week I mentioned that I'd be checking in some work on
intersection testing, the first cut of it is now checked into CVS.
The work is preliminary, but good enough to get testing with.

In osgUtil you'll find:

  osgUtil::Intersector - a new base class for doing intersection tests
between nodes and
       drawable leaves, the intersector stores the intersection hits
as well as the abilty to
       clone and reproject itself into local coordinates.

  osgUtil::LineSegmentIntersector - a concrete implementation of an
Intersector, that provides
       line segment intersection functionality.

  osgUtil::IntersectorGroup - a concrete implementation of an
Intersector, that provides
       the ability to test a group of Intersectors.

  osgUtil::IntersectionVisitor - the base traverserser for new
intersection support.  All the
      actual intersection work is done by the Intersectors, so its a
general purpose
      traverser.  It also contains a callback to enable reading of
external PagedLOD
      tiles, there isn't an implementation of the reading though, as
osgUtil doesn't
      know about osgDB, and its only osgDB that can do the actual reading.

In the future I expect to have osgUtil::PolytopeIntersector, and
osgUtil::Pick/BoxIntersector that will work in window coordinates, as
well as object coordinates like the existing LineSegmentIntersector
does.  Some more work needs to happen in IntersectionVisitor before
this can happen, but the actual design work has been done, the
architecture is designed to encompass screen picking requirements.

In osgSim you'll find some specialist helper classes for vis-sim type work:

   osgUtil::LineOfSight - a class for setting up a group of line of
sight tests and running the
       computation of the intersections.

   osgUtil::HeightAboveTerrain - class of setting a group of height
above terrain tests and
       running the computation of the intersections.

The later handles the local up vector that geocentric coordinates
require if the model pass into the compute has a CoordinateSystemNode
at the top - this allows you to handle whole earth database.

In osgSim there is also a DatabaseCacheReadCallback that adds the
support for reading paged databases along with the ability to cache
these loads for later reuse.  You can share a single
DatabaseCacheReadCallback between multiple LineOfSight and
HeightAboveTerrain operations so the cahce will be remain relevant
across all your intersections tests.

One important aspect to this work is that the support for paged
database is such that you can automatically query the database for the
highest resolution tile available - it'll automatically do all the
nested loads for you.  You can tweak the cache to balance how much
memory you use.

This database support feature is something I have been asked about
from time to time, and I never gave a simple answer too, as I believed
it'd be rather convoluted, suffer from high latencies and really
thrash memory.  This recent work lead me to an eureka moments when I
realised that problem was actually quite a bit simpler if you avoided
using the tradition osgDB::DatabasePager support, and did the reading
directly within the traversal.  So rather than try to explain how to
do it, I can now simply point to the solution!

The code also doesn't require the use of OpenGL graphics context so
you do all the tests in non graphics applications, yes even I have to
recognise that such applications do exist :-D

There is also the beginnings on an osgintersection example, its a bit
convoluted right now due to the needs of testing the code, but it
should at least give you an inkling of how to use the new classes.

There is possibility that the new design will stretch to doing
multi-threaded intersection tests, this isn't implemented yet though,
and won't be done straight away, but perhaps some point in the future
we can tackle this.

Please feel free to test the new classes out and give feedback.

Have fun,
Robert.
_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/


_______________________________________________
osg-users mailing list
osg-users@openscenegraph.net
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to