I've made a couple of trivial changes to FlightGear so that runway
lights turn off during the day in VMC.

Plib has callbacks for branches as well as leaves, but the branch
callbacks are not documented, so I had to dig trough the plib source
code (they're the same ones I used for the dynamic scenery objects).
For a branch, you can set pre-traversal and post-traversal callbacks;
if the pre-traversal callback return false, then the branch will be
skipped.  Here's a trivial (and not-so-efficient) example:

  static int cloaking_callback (ssgEntity * e, int mask)
  {
    return !fgGetBool("/controls/cloaking-device");
  }

  ssgBranch * ship;

  // ...

  ship->setTravCallback(SSG_CALLBACK_PRETRAV, cloaking_callback);

Now, the 'ship' branch will automatically vanish whenever the
/controls/cloaking-device property is true and reappear when it's
false.

For the dynamic objects, I use a much more complicated approach -- the
branches are actually empty until ssg attempts to traverse them, then
(at first traversal) FlightGear populates them with pseudo-randomly
placed objects.  That way, branches that never come into range or into
the view direction are never populated.  I also have a callback to
depopulate the branches once they fall out of range.  That turns out
to be a fairly efficient way to add many objects (such as buildings or
trees) to the scenery nearby without overwhelming the system.


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

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

Reply via email to