Sam Varner <[EMAIL PROTECTED]> said:

> I want to get the elevation of the ground for points other than my
> current location.  I suppose I could do this by moving to a new location
> and calling scenery.get_cur_elev().  Is there a better way?  If not,
> what operations will update the output of FGScenery::get_cur_elev() in
> the most efficient way? 
> 

That's actually a problem that I'm working on currently.  If you look at
tilemgr.cxx, the update() function you'll see where the value for current
elevation gets set.  What you can do is modify that function to accept an
"absolute view position" vector along with the longitude and latitude
paramters and pass it along to the hitlist fgCurrentElev call.

Take a look at "location.cxx" to see how that "absolute position" vector is
calculated (it is actually based on the latitude and longitude with the
altitude integraded to give you coordinates in 3D space).  Calling the
update() routine in this way causes some trouble with the tile caching because
the caching is based on distance from the longitude and latitude you specify. 

When the routine was written we were dealing with a single view location and
an a longitude and latitude that changed gradually, not abruptly.  If you keep
jumping that around the tile cache starts thrashing a bit (unless the
locations are reasonably close to each other).  All this said, calling
update() will give you the readings you are looking for.  Just make sure that
the current elevation gets set right back to whatever is correct for the
aircraft (the value returned by scenery->get_cur_elev()), otherwise you'll see
some other issues come up.

Sometime in the next week or so look for updates to this code that will make
what you want to do a little easier and fix the numerous bugs in the scenery
and sky rendering that have come up since the new viewer code was introduced.

Best,

Jim

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to