This is a new improved patch for the previous tile manager fixes.
Rather than building dependencies between FGlocation or the viewer or fdm with
tilemgr what I ended up doing was linking the pieces together in the Mainloop
in main.cxx. You'll see what I mean...it's been commented fairly well. More
than likely we should move that chunk somewhere...just not sure where yet.
The changes seem clean now. As I get more ideas there could be some further
improvement in organizing the update in tilemgr. You'll note that I left an
override in there for the tilemgr::update() function to preserve earlier
functionality if someone needs it (e.g. usage independent of an fdm or
viewer), not to mention there are a few places in flightgear that call it
directly that have not been changed to the new interface (and may not need to be).
The code has been optimized to avoid duplicate traversals and seems to run
generally quite well. Note that there can be a short delay reloading tiles
that have been dropped from static views. We could call the tile scheduler on
a view switch, but it's not a big deal and at the moment I'd like to get this
in so people can try it and comment on it as it is.
Everything has been resycned with CVS tonight and I've included the
description submitted earlier (below).
Best,
Jim
Changes synced with CVS approx 20:30EDT 2002-05-09 (after this evenings updates).
Files:
http://www.spiderbark.com/fgfs/viewer-update-20020516.tar.gz
or
http://www.spiderbark.com/fgfs/viewer-update-20020516.diffs.gz
Description:
In a nutshell, these patches begin to take what was one value for ground
elevation and calculate ground elevation values seperately for the FDM and the
viewer (eye position). Several outstanding view related bugs have been fixed.
With the introduction of the new viewer code a lot of that Flight Gear code
broke related to use of a global variable called "scenery.cur_elev".
Therefore the ground_elevation and other associated items (like the current
tile bucket) is maintained per FDM instance and per View. Each of these has a
"point" or location that can be identified. See changes to FGLocation class
and main.cxx.
Most of the problems related to the new viewer in terms of sky, ground and
runway lights, and tower views are fixed.
There are four minor problems remaining. 1) The sun/moon spins when you pan
the "lookat" tower view only (view #3). 2) Under stress (esp. magic carpet
full speed with max visibility), there is a memory leak in the tile caching
that was not introduced with these changes. 3) I have not tested these
changes or made corrections to the ADA or External FDM interfaces. 4) The
change view function doesn't call the time/light update (not a problem unless
a tower is very far away).
Details:
FDM/flight.cxx, flight.hxx - FGInterface ties to FGAircraftModel so that it's
location data can be accessed for runway (ground elevation under aircraft)
elevation.
FDM/larsim.cxx, larcsim.hxx - gets runway elevation from FGInterface now.
Commented out function that is causing a namespace conflict, hasn't been
called with recent code anyway.
FDM/JSBSim/JSBSim.cxx, YASim/YASim.cxx - gets runway elevation from
FGInterface now.
Scenery/newcache.cxx, newcache.hxx - changed caching scheme to time based
(oldest tiles discard).
Scenery/tileentry.cxx, tileentry.hxx - added place to record time, changed
rendering to reference viewer altitude in order to fix a problem with ground
and runway lights.
Scenery/tilemgr.cxx, tilemgr.hxx - Modified update() to accept values for
multiple locations. Refresh function added in order to periodically make
the tiles current for a non-moving view (like a tower).
Main/fg_init.cxx - register event for making tiles current in a non-moving
view (like a tower).
Main/location.hxx - added support for current ground elevation data.
Main/main.cxx - added second tilemgr call for fdm, fixed places where viewer
position data was required for correct sky rendering.
Main/options.cxx - fixed segfault reported by Curtis when using --view-offset
command line parameter.
Main/viewer.cxx, viewer.hxx - removed fudging of view position. Fixed numerous
bugs that were causing eye and target values to get mixed up.
the wrong place. The Atmosphere::getStd*() calls are used by the
solver, and thus really need to return values for a "standard"
atmosphere. Otherwise, an aircraft started up in Moscow will behave
differently than one initialized in Cairo. :)
The place where environmental pressure and temperature get inspected
at runtime is in YASim.cxx. The changes there, happily, end up being
even smaller than the ones to Atmosphere. This ends up replacing code
only, and removing some comments.
Here is the new super improved telnet property interface. CVS changelog
is at the end of this message. Once this new telnet code is in and
compiles every where we can remove Network/props.[ch]xx. I've added a
--telnet=<port> command line option to invoke the new server. Later on
we could remove the --props option, or least change it to invoke the new
server. I'll let you decide.
I've added some new commands to the telnet interface:
view next Select the next view.
view prev Select the previous view.
view set <n> Select view 'n'
view get Return index of current view
I'm not sure if these same effects could be achieved through property
operations. The commands provide a convenient shortcut in any case.
I'm also planning on adding a panel command to manipulate panels and
objects contained therein (eg simulated mouse clicks). There is going
to be some commonality with the command objects so we may need to
rationalize this in the near future.
Finally, I've also included my python stuff. This is still very much a
work in progress, basically I've been using it to test the new telnet
server. I have tested it with python 2.2. Feel free to add it to the
repository if you want. I would suggest a scripts/python directory
CVS Changelog
Network/telnet.cxx: New property telnet protocol interface. It supports
the same user interface provided by the --props server. Additionally it
handles multiple simultaneous connections. Added "view" command to
manipulate viewmgr.
Network/protocol.hxx: Added protocol configuration exception.
Main/fg_io.cxx: Added new "telnet" protocol. Added protocol
configuration parse exceptions. Simplified protocol configuration
parsing.
Main/options.cxx: Added --telnet=<port> command line option and help
message.
set_Density; since JSBSim doesn't override the get_* methods from
FGInterface as well, the wrong values are always set anyway.
Take the static temperature, static pressure, and density values from
an external source if requested by the
/environment/params/control-fdm-atmosphere property. This isn't
working properly yet for JSBSim because of interactions with the
trimming routine.
Stratosphere). The atmospheric properties are as follow:
/environment/temperature-sea-level-degc
/environment/temperature-degc
/environment/pressure-sea-level-inhg
/environment/pressure-inhg
/environment/density-sea-level-slugft3
/environment/density-slugft3
Setting either the sea-level or altitude value automatically sets the
other value appropriate, except for temperature at altitude above the
Troposphere (where there's no reliable way to back-calculate it). The
atmosphere model appears in the atmosphere_data array in
environment.cxx, and can easily be extended into the upper
stratosphere and beyond.
These are not yet tied into the FDMs or steam module.
Removed configuration option --with-new-environment and
FG_NEW_ENVIRONMENT macro.
Added configuration option --with-weathercm and FG_WEATHERCM macro.
FGEnvironment is now the default; use --with-weathercm to get the old
weather.
object rather than a pointer.
FGEnvironment now has the beginning of an atmospheric model, and will
recalculate temperature (not pressure or density, yet) based on
elevation.
FGEnvironment has a copy constructor.
- changed FGSubsystem::update(int) to
FGSubsystem::update(delta_time_sec); the argument is now delta time
in seconds rather than milliseconds
- added FGSubsystem::suspend(), FGSubsystem::suspend(bool),
FGSubsystem::resume(), and FGSubsystem::is_suspended(), all with
default implementations; is_suspended takes account of the master
freeze as well as the subsystem's individual suspended state
- the FDMs now use the delta time argument the same as the rest of
FlightGear; formerly, main.cxx made a special case and passed a
multiloop argument
- FDMs now calculate multiloop internally instead of relying on
main.cxx
There are probably some problems -- I've done basic testing with the
major FDMs and subsystems, but we'll probably need a few weeks to
sniff out bugs.
The FlightGear patch is to take account the change in the getChildren
function that now returns a vector<SGPropertyNode_ptr>. If the
removeChild functionnality is to be added in FlightGear, all those
SGPropertyNode * floating around should be changed to
SGPropertyNode_ptr.
- don't send "set" confirmation when in data mode. If an external
program really cares if the settings were accepted, which is
rather unlikely, it simply has to "get" the property again.
The returned line would have been a pain to parse, anyway
(something like "from-model = 'true' (bool)").
- do not only "set" the first token, but concatenate all given
tokens with a space in between. This won't be used much, but
makes sense for setting strings, while it does no harm when setting
numbers. Silently ignoring all but the first token is impolite. ;-)
- remove old, commented out debug message that doesn't make much
sense any more.
Due to jumpy joystick read-outs the UFO jitters a lot in turns.
This patch implements simple damping for aileron/elevator/throttle.
Furthermore it lets the UFO fly backwards if brake[0] is active
(by default associated with the joystick's fire button). After all,
everyone knows that UFO's can fly backwards!
It's cumbersome to use the MagicCarpet as 3D cursor, because everytime
you shoot over the target you have first to turn by 180 degrees and to
fly back.
This patch lets the magic carpet fly backwards if brake[0] is active,
which is by default associated with the joystick's fire button.
Turns out it was a problem with a long string, not the font. Plib is limited
to 80 characters in things like this listbox. BTW I checked and all the fonts
are missing those characters. So, no point in changing.
Description:
Fixed segfault caused by long string.
> I have attached some new additions to the UIUC code. Most of the
> changes allow for the addition of apparent mass. This is very
> useful with light aircraft and gliders.
I changed the sound code to let it use FGCondition. This changes the
code and configuration files rather drastically. Furthermore I've added
an in-transit mode which plays the sound only when the tied property is
changing.
Changes:
Code:
* Added condition support to trigger an event
* Removed the <type> section from the main event definition
(this could be done using conditions)
* Removed the abillity to use several events with the same name,
instead it is required to use conditions.
* Updated the README.xmlsound
Base package:
* Changed the configuration files accordingly.
* Changed flaps and gear to use the new in-stransit mode.
* Changed the flps.wav file so it can be looped.
* Created a new gear.wav file (whcih can be looped)
and a gear-lck.wav file for gear locking sound.
IMPORTANT:
To change existing configuration files to the new ones, it is important
to pack events with the same name together into one singel event, using
the condition specification. Also, when using special types (inverted,
flip-flop, raise or fall) these should be changed to a conditions also.
For more information, please look at
FLightGear/docs-mini/README.xmlsound and the supplied aircraft
configuration files located under FlightGear/Aircraft (espesially
c172/c172-sound.xml and c310/c310-sound.xml).
default implementation that uses user-supplied params. Currently, the
only parameters are
/environment/params/base-wind-speed-kt
/environment/params/gust-wind-speed-kt
but others will show up soon (i.e. sheer, variable direction, variable
visibility, etc.). To activate these properties, you have to
configure --with-new-environment.
The gusting function is simplistic and needs to be replaced with
something better, though it doesn't feel too far off.
subproperty, 'spherical', which is true if the object has spherical
symmetry and should rotate around both the x-axis and z-axis to face
the camera (i.e. a simple cloud), and false if the object has only
cylindrical symmetry and should rotate only around the z-axis (i.e. a
tree).
1. If /position/longitude-deg and /position/latitude-deg are in range,
use them.
2. Otherwise, if /sim/startup/airport-id is not empty, use it.
3. Otherwise, set the lon/lat to the middle of the KSFO field.
The default used to be Globe, AZ, but that doesn't make sense since we
don't distribute that scenery by default any more.
With this change, starting from a save file seems to work properly:
fgfs myflight.sav
- Added initial_value argument, in milliseconds, that specifies when
event is first run. The default value of -1 triggers the event
immediately as per the existing behaviour. A repeat_value greater than
zero runs the event no less than every 'repeat_value' milliseconds
afterwards. A repeat_value of zero deletes the event.
- Modified run queue behaviour such that only one event per frame is
run.