Attached is a patch to the airport data storage that I would like committed
after review if acceptable. Currently the storage of airports mapped by ID
is by locally created objects - about 12 Meg or so created on the stack if
I am not mistaken. I've changed this to creating the airports on the heap,
and storing pointers to them - see FGAirportList.add(...) in
src/Airports/simple.cxx. I believe that this is probably better practice,
and it's certainly cured some strange problems I was seeing when accessing
the airport data with some gps unit code. Changes resulting from this have
cascaded through a few files which access the data - 11 files are modified
in all. Melchior and Durk - you might want to test this and shout if there
are problems since the metar and traffic code are probably the biggest
users of the airport data. I've also added a fuzzy search function that
returns the next matching airport code in ASCII sequence in order to
support gps units that have autocompletion of partially entered codes.
More generally, the simple airport class seems to have grown a lot with the
fairly recent addition of the parking, runway preference and schedule time
code. It is no longer just an encapsulation of the global airport data
file, and has grown to 552 bytes in size when unpopulated (about 1/2 a K!).
My personal opinion is that we should look to just store the basic data in
apt.dat for all global airports in a simple airport class, plus globally
needed data (metar available?), and then have the traffic, AI and ATC
subsystems create more advanced airports for themselves as needed in the
area of interest. Once a significant number of airports worldwide have
ground networks and parking defined, it will be impractical and unnecessary
to store them all in memory. That's just a thought for the future though.
I have prepared a new patch for multiplayer, which fixes endianess issues with
multiplayer code. It's basically identical to the patch I sent before my
vacation, but contains minor fixes.
Multiplayer should now be working under all unix-like environments and windows
native. The basic trick is to let configure check for endianess of the host
system.
It will not work on system not using configure in the build process (excluding
windows), ie. possibly MACOS. For those system we should provide #ifdefs in
tiny_xdr.hpp.
Erik:
I've updated the patch to use the Plib utils package for endian swapping an
used a preprocessor directive to detect endianess.
>> Hello List,
>>
>> I think there's a small bug in the moving-average filter in
>> xmlauto.cxx
>>
>> I noticed that the output from it was always out a bit and
>> checking with a calculator showed that it seemed to be dividing
>> by the number of samples + 1 instead of just the number of
>> samples.
>>
>> subtracting 1 from 'samples' in line 702 seems to fix the problem
>> and as 'samples' doesn't seem to be used elsewhere I think it's
>> safe. Possibly implies that the number of samples may be one
>> less than specified but I'm not familiar enough with c++ to spot
>> it.
Roy Ovesen:
You are right. I would suggest resizing input[] to (samples + 1) instead.
Change lines 654 and 661 to:
input.resize(samples + 1, 0.0);
That way we average over the number of samples as configured.
There was a patch from Manuel Masing a few months ago which cleaned up
SGLocation's way depending on input values. That means that with that patch
SGLocation does no longer have calls with unneeded input arguments.
I took his patch and integrated that into flightgear and made maximum use of
that changes.
Erik Hofman:
Remove some duplicate code that was moved to simgear/compiler.h
curt [Sat, 27 Aug 2005 20:00:58 +0000 (20:00 +0000)]
Created a utility (similar to GPSsmooth) that can take a recorded file of
MIDG-II binary data and replay it in FG. For more details on the MIDG-II
see: http://www.microboticsinc.com/midg.html
ehofman [Mon, 22 Aug 2005 17:49:50 +0000 (17:49 +0000)]
Harald JOHNSEN:
- replay.cxx :
corrected a bug, now reinitialize the recording data when replay is
deactivated
- fgclouds.cxx :
cloud layers and weather condition are saved when choosing a weather scenario,
added a new scenario 'none' so we can switch back to standard flightgear
weather
- navradio.cxx :
force a search() on init to initialize some variables, preventing a nearly
infinite loop when delta-time == 0 on the first update()
- electrical.cxx :
uninitialized variable in apply_load() for FG_EXTERNAL supplier
- panel.cxx, panelnode.cxx :
added a property "depth-test" for 2.5D panels so that they update the depth
buffer and are no more visible from the outside of the aircraft when the
aircraft uses textures without an alpha channel
- panel.cxx :
moved the computation of the instruments diffuse color outside the
texturelayer code since this is constant during a frame, this is a big speedup
for 2D panels
ehofman [Tue, 16 Aug 2005 09:37:23 +0000 (09:37 +0000)]
Vivian Meazza:
Some quite extensive changes to the AIModel code:
1. Mathias has made major changes to the AICarrier code to provide better
alignment of an aircraft on deck with the carrier - this feature is a major
improvement on the existing, but has a bug which might cause it to fail when
the computer carries out other tasks - changing window size is a known
example. This bug is outwith this code.
2. I have made significant changes to the AIShip code to enable a ship the
turn and roll smoothly.
3. I have added some simple AI which enables the carrier to remain within,
or return to, an operating box.
4. An automated turn into wind for flying operations.
5. A simplistic implementation of TACAN within AICarrier. I am in the course
of implementing this as a generic instrument, but this is some time off
completion.
ehofman [Sun, 14 Aug 2005 12:57:12 +0000 (12:57 +0000)]
Mathias Fröhlich:
I have prepared a patch that:
- Introduces a FGTileMgr::scenery_available method which asks the tilemanager
if scenery for a given range around a lat/lon pair is already loaded and make
use of that method at some -9999 meter checks.
- Introduces a FGScenery::get_elevation_m method which queries the altitude at
a given position. In constrast to the groundcache functions this is the best
choice if you ask for one *single* altitude value. Make use of that thing in
AI/ATC classes and for the current views ground level. At the current views
part the groundcache is reused if possible.
- The computation of the 'current groundlevel' is no longer done on the
tilemanagers update since the required functions are now better seperated.
Alltogether it eliminates somehow redundant terrain level computations which
are now superseeded by that more finegrained functions and the existence of
the groundcache. Additionally it introduces an api to commonly required
functions which was very complex to do prevously.
- automatic detection of axis directionality, so that axis inputs are appropriately inverted only when necessary
- fixed trim axis names for better understandability
- fixed signs for flaps up/down property increments
- button 0 was previously used for skipping axes and buttons in both loops. Now button 0 can be assigned a binding (e.g., brakes). Instead, moving any axis during the button-assignment-loop indicates skipping.
- The user is now told how to skip a control.
I did some profiling of the code and found a few interessant things. Some corrections are obvious like the one in the multiplayer code, the fps is no more divided by 2 or 3 when another plane is on screen.
Other things like collision detection and computation of agl can not really be optimized. I changed a few things in hitlist.cxx but this only give a very low increase of fps. The groundcache eats a lot of cpu but I think that the real way to do it is to use a real collision system like OPCODE or something like that.
And I added an option to disable the recording of replay data. It takes more cpu than we can think.
Changes
=======
- panel.cxx :
moved the computation of the instruments diffuse color outside the texturelayer code
since this is constant during a frame, this is a big speedup for 2D panels ;
- hitlist.cxx :
changed the computation of the intersection between ray and triangle, optimized
the sphere culling by using a normalized direction vector. This can give a
35% speedup on the computation of elevation in some situations ;
- renderer.cxx, acmodel.cxx :
call ssgDrawAndCull with plane scene graph in external or internal view,
calling ssgDrawAndCull with the root scene graph was drawing other players plane
a second time in multiplayer mode ;
- mplayer.cxx :
removed the calls to ssgFlatten and ssgStripify because it was degenerating models,
causing a massive drop in frame rate ;
- replay.cxx :
added an option to disable the recording of the flight
- fgclouds.cxx :
changed the path of cloudlayer properties to match preferences.xml ;
set the altitude of clouds from scenarios to a more correct value if metar is not enabled ;
I have now included a patch to the multiplyer protocoll which does:
1. place the 3d model into the scenery using a placement transform which can
dynamically change its scenry center.
2. Transmits unique position and orientation data for the 3d model.
3. Thus breaks protocol compatibility.
Oliver Schroeder:
With help from Norman I fixed the alignment in the used headers.
But this patch again fixes only symtoms, not the problems. I suggest to
put it into cvs anyway, as it will enable the majority to get experience
with the multiplayer mode.
Turns out to be a bad interaction between jsbsims crash detection and my
past initialization changes.
The attached patch fixes this by moving crash detection out of the
initialization phase of jsbsim.
- AIManager.cxx :
- we can now have multiple <scenario> entries in the sim/ai entry in preferences.xml
- AIBase.cxx :
- added an exception handler around the loading of the 3D model to not exit FG
if the model is not found
- AIScenario.cxx :
- removed a duplicated read of the xml file, this was also exiting FG is the xml file
does not exist
- shadowvolume.cxx, renderer.cxx :
- reduced the polygon offset a bit to eliminate some artifact ;
- changed again the cleanup code for objects inside a tile because it could crash on rare occasion ;
- the culling of shadow casters has been rewritten to traverse the scene graph, it should be
a bit faster when there is a lot of objects ;
- the range selector was not correctly handled, sometimes the wrong LOD was casting shadows.
- added the option to display aircraft's transparent objects after the shadows, this will
reduce the problem of shadows being hidden by the transparent object (propeller disk,
rotor, etc). A side effect is that aircraft's transparent objects won't receive shadows
anymore. This is usually a good thing except when the aircraft use a 'transparent'
texture where it should not. A transparent texture in the plib context is a texture
with an alpha channel or a material with alpha <= 0.99.
- model.cxx, animation.cxx, shadowvolume.cxx :
- added an optional <condition> under the <noshadow> animation
- tower.cxx
- correct a rare bug where all occurences of the aircraft are not deleted from the
departure list causing a crash in FGTower::CheckDepartureList function.
IRIX fixes.
Somehow the MIPSpro compiler doesn't like an STL map entry being called
using a variable when the reference is an object and not a pointer to an
object.
Preliminary support for a fontcache is added which prevents fonts from
being loaded more than once and takes care of freeing them up again.
The fontcache isn't used yet since there seems to be a problem somewhere.
I have traced that reset on carrier problem down to several problems. One of
them is the fact that on reset the carrier is updated while the aircraft is
not. That made the aircraft drop down an elevator sometimes. Depending on the
passed realtime while loading some parts of the scenery.
- make tabula rasa on re-init
- check /sim/current-gui for where to get gui colors (default "/sim/gui[0]")
- call getFont() with gui font address (default "/sim/gui[0]/font")
tell the layouter about the default font (I wonder why
LayoutWidget::setDefaultFont() wants puFont* /and/ pointsize as extra
parameters, when puFont knows its pointsize anyway. Didn't want to change
that yet, though.) Now the HELVETICA_10 font makes actually sense. :-)
rename VERA_12B font to SANS_12B (as in sans-serif). This is a "Grotesk"
font similar to Helvetica/Swiss. The license doesn't allow to redistribute
modified fonts under the original name. While it's only a converted font,
and not manually modified, it can no longer be seen as original. Changes
so far are (a) conversion from vector to bitmap, (b) different empty space
width, (c) different & constant gap value, without other kerning information.
Further changes may be necessary in the future.
[new_gui is] "using copies of puFont objects that are not yet initialized, I
think that dependant of link order (and so tor execution order) it can
work or not. Changing puFont font by puFont *font should work in all cases."
read the splash font color from the gui style file. This is a bit of a
gimmick, but it may be nice to adjust the font color to match the splash
image, e.g. to make it darker for dark images, etc.
make property picker consider the new_gui colors; unfortunately, plib
hardcodes the text color as black, which makes them a bit hard to read
on dark backgrounds; fix sent to the plib list; (the added code isn't
pretty and hence fits the existing style quite well ;-)
- use color map information from new_gui.cxx and set puObject colors
accordingly;
- cleanup (call all puObjects "obj" for easier editing/copying)
- commented out code: (not-yet functional props preprocessor)
- add gui color support: maintain color map with default colors and all
colors from /sim/gui/colors/ into map;
- set default color scheme
- handle fonts
- implement color class
- close all dialogs on reinit, set up style again, and then reopen all
(non-nasal generated) dialogs again
contains two fntBitmap fonts with iso8859-1 character set; this was
generated by freeglut's genfont utility. That application also generates
a copyright message that I did not copy into this file, because it is
wrong: the author of genfont claims copyright for data that *I* generated
using his program; this doesn't fly. Of course, the copyright will remain
in the (heavily edited) version of *his* code. I'll commit that, too.
- abstract out reading colors from the property tree into a routine.
This could also be used to read the default foreground/background color
from a definition in preferences.xml or gui/color.xml.
Rename "menu-reload" to "gui-reload", which is what is actually done
behind the scenes: It reloads all gui files from $FG_ROOT/gui/. That's
useful for gui development. Maybe we'll have a "menu-reload" later ...
- make menubar reloadable ... again. This was lost because FGBindings does
no longer save inaccessible bindings copies, but only pointer to the
bindings in the property tree (which was desirable to get accurate
error messages for Nasal bindings).
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
Add a small utility that can read a saved GPS track, interpolate data points
at some higher frequency, approximate roll/pitch angles, and blast the result
over to FlightGear using FGNetFDM udp packets.
andy [Sat, 2 Jul 2005 17:09:42 +0000 (17:09 +0000)]
Rework the MP calculation to make super/turbocharger output dependent
on RPM via a model developed by Vivian Meazza. Add a "boost" output
to the property tree. Fix a bug where MP would be reported "before"
the wastegate clamping.
mfranz [Thu, 30 Jun 2005 18:34:20 +0000 (18:34 +0000)]
- replace one SGPropertyNode* by SGPropertyNode_ptr to avoid crash with
temporary removeChild(); should be done even after reverting; the node
is accessed after removal
- cleanup: if (foo) delete foo --> delete foo
mfranz [Mon, 27 Jun 2005 13:59:48 +0000 (13:59 +0000)]
- fix type warnings
- use new removeChildren() to remove the named js nodes that we don't
need any more (they are now *really* removed, not just detached), and
- move it into postinit(). (getChildren() returns a SGPropertyNode_ptr,
so all nodes are refcounted and, thus, after the last sg/props change
no longer removable in that scope ;-) Maybe we'll need an alternative
getChildren() that returns SGPropertyNode* ...
mfranz [Mon, 27 Jun 2005 07:13:02 +0000 (07:13 +0000)]
Frederic Bouvier:
- This doesn't do what the author though it would do:
if (modifiers&KEYMOD_RELEASED == 0) ... (see below)
- MSVC and type fixes
mf:
fixing this uncovered an old bug: the "key pressed" branch was
actually never executed -- always only "released". And that is why
the <repeatable> property didn't work. And *that* was the reason
why the Spitfire's starter didn't work with freeglut, and Vivian
had to write a nasty workaround for it.
ehofman [Sun, 26 Jun 2005 17:21:18 +0000 (17:21 +0000)]
Harald JOHNSEN:
Changes
=======
New volumetric shadows for FlightGear.
There is now two new checkboxes in the rendering dialog to enable/disable shadows
for the user aircraft and for static scenery objects (ie those defined in the .stg files).
AI and random objects are not handled for the moment.
ehofman [Sat, 25 Jun 2005 08:46:58 +0000 (08:46 +0000)]
TJ:
Annexed an IVSI (instantaneous ertical speed indicator), which bypasses a
limitation with Concorde :
- the cruise at Mach 2 must be with a slow climb rate of 50/60 ft/min
(2h from 50000 ft).
- with /velocities/vertical-speed-fpm, the real climb rate (altimeter) varies :
One must constantly (every 5-10 minutes) change the vertical speed hold of
the autopilot between 10 ft/min and 200 ft/min.
This is very annoying because not a constant offset : that could be a lack of
sensitivity of /velocities/vertical-speed-fpm (FDM ?).
This new IVSI :
- Is an emulation with works with environment pressure : a real IVSI works with
static pressure (with lag) + accelerometers.
It is not forbidden to later upgrade to the real model.
- Doesn't require a tuning of the autopilot made with
/velocities/vertical-speed-fpm (also tested with 737, 747) :
Concorde's autoland works without update.