- Removes the cloud type re-use code - I think they aren't worth the graphical artefacts that they cause in light of Tim's improvements
- Changes the transparency of the clouds. Previously, the clouds were transparent at 0m distance, opaque at 200m, then gradually more transparent to the fog limits. This meant they were generally quite transparent. Now, they are opaque from 200m to 15km, then become transparent at 20km. A side effect of this is that the current textures could probably benefit from being made slightly transparent to improve the blending of the sprites against each other.
Here's a patch which refactors the 'plain' GPS code into a slightly
more manageable structure - i.e breaks the large update() method into
various sub-functions. I've tested the patch with B1900d, and things
seem to work as expected, but if anyone experiences GPS weirdness
after this is committed, of course please report it.
The motivation for this was helping me learn the code - I've planning
some changes in this area, and splitting up the logic will hopefully
make that task easier.
- updates how filtering is done on the various FGPositioned query functions - both spatial and ident-based.
- updates the KLN-89b / DCLGPS code to use FGPositioned for all Navaid/Airport queries.
me:
Add few include directives in globals.cxx to avoid such MSVC warning messages :
deletion of pointer to incomplete type 'FGAirportList'; no destructor called
deletion of pointer to incomplete type 'FGNavList'; no destructor called
deletion of pointer to incomplete type 'FGTACANList'; no destructor called
deletion of pointer to incomplete type 'FGFixList'; no destructor called
- Replaces simple shader attributes with vectors (this was missed out of the last patch by mistake)
- Includes Yon's Fog update code (Thanks!)
- Fixes a bug since 1.0 where --enable-real-weather-fetch stopped the other weather scenarios from working.
- Fix the chequer-board bug.
- Add proper cloud coverage function - so scattered clouds are now truly scattered.
- Add real-time control for visibility range.
- Use a limited set of clouds rather than generating a completely new Geode for each cloud. This saves sorting and display time.
- Add controls to Rendering dialog to allow fine-tuning of the number of sprites, cloud visibility and the number of different types of cloud.
- Add some variance to the sort back-off to avoid all clouds being sorted at the same time.
- Pack attributes into vectors for performance
- Re-order the cloud type determination code so that if a cloud layer could either be stratus or cumulus, cumulus is used.
- Lowered the cloud level in the standard cloud configuration slightly so a cumulus layer is generated rather than stratus.
These last two mean that you should see some 3D cumuli if disabling real weather fetch.
My thanks to Yon Uriarte for his help with performance work.
- a refactoring of the route manager to reduce indentation and duplication
- created a helper method to generate the ETA strings
- created a helper to update target_altitude and altitude_set when the active wp0 changes
- used early returns to make update() easier to follow
- removed spurious includes in both header and source file
Attached patch updates the route-manager to use FGPositioned to search
for waypoints, instead of a manual airport / fix / navaid search. This
is good because it's now using the 'strictly closest' match, rather
than arbitrarily picking a distant fix over a nearby navaid. In my
case, the TLA VOR is significant to several EGPH procedures, but also
happens to be the ident of a fix a long, long way away.
Also updates the FGPositioned class to stop using Point3D, partly
because it's deprecated and partly because I had misunderstood the
interface and was using it wrong. For now, all FGPositioned distance
checks use SGGeodesy::inverse, which is accurate but inefficient. Once
FGPositioned queries are used for something on a hot path, I'll
probably store the cartesian position as well as the geodetic, to make
these checks fast.
Right now, atlas.cxx uses the following code, in
FGAtlas::gen_message(), to retrieve the ADF frequency:
static SGPropertyNode *adf_freq =
fgGetNode("/instrumentation/kr-87/outputs/selected-khz", true);
I think it should be changed to:
static SGPropertyNode *adf_freq =
fgGetNode("/instrumentation/adf/frequencies/selected-khz", true);
temporarily lose control over the aircraft while pressing a
modifier for a button.
- cosmetics: remove trailing spaces and commented out debug messages
These functions are now called in fgOSMainLoop. The fgMainLoop
function was being called twice, which resulted in a slow-down, but
also caused the displayed frame rate to double!
free /models/model[*] slot and lets the model manager load the
model. The target address is returned under "property". Simple
use in Nasal:
fgcommand("add-model", props.Node.new({
"path": "Models/Fauna/cow.ac",
"latitude-deg": 16.234,
"longitude-deg": 48.321,
"elevation-ft": 300,
});
An "elevation-m" property can alternatively be used and overrides
the "elevation-ft" property.
Each of the properties "latitude-deg", "longitude-deg", "elevation-ft",
"heading-deg", "pitch-deg", and "roll-deg" can alternatively be used
with "-prop" suffix. Their values must then be property path strings
pointing to a node that can be changed at runtime to move the model.
coordinates that were set relative to the aircraft's position
are picked up before the view update rather than the next cycle.
This avoids ugly fluttering of "passengers" at higher speed.
Partition depth in CameraGroup:
Remove the ViewPartionNode scenegraph node. The split rendering of the
scene, done to avoid Z buffer precision problems, is now done by two
slave cameras of the viewer.
Rename FGManipulator to FGEventHandler.
Remove virtual member functions that aren't required for event handlers.
Begin using camera group properties to update cameras at runtime;
Initially only the viewport properties are used.
When no camera group is found in the property tree (the default),
create the properties for one. Expose the default window by name.
Add a test for Boost headers to configure.ac. Boost is now a
dependency.
Remove GLUT and SDL versions of the OSG graphics.
stabilize some of the odd artifacts we were hearing, that were especially
noticable in clean sound samples like the stall horn or the marker beacon
codes. The change still preserves the doppler effect and maintains the
good work of a previous developer figuring out how to align the model and
listener velocity vectors correctly.
It fixes the following issues (to a greater or lesser extent):
1) Performance. Quad trees used to improve culling, and the sprites are placed on the surface of a sphere rather than
randomly throughout the cloud, requiring fewer textures. This saves about 5-10fps on my machine.
2) Disabled 3D clouds have no performance impact. Previously they were still in the scenegraph. Now they are removed.
3) Clouds are now loaded on start-up, and don't require the scenario to be changed, they also work with METAR.
4) The cloud field is shifted as you travel. There's a small bug in that the clouds "jump" as you reach the edge of the field.
5) Iterative sorting of sprites. This doesn't appear to solve the alpha blending problem completely, but may help a bit.
the case where the removed child has no other referants, otherwise it
will be deleted on function exit. Also give the ghost type a name for
cleaner debugging.
or the unit was not serviceable. This search() routine needs to run every
iteration no matter what the power or serviceable state. If power is turned
off or the unit becomes unserviceable while a beacon sound is playing, the
search() routine still needs to be called so the sound effect can be properly
disabled.
This was a source of a spew of "NaN" error messages at night when the
sun is at a large angle to the zenith. I don't know why this wasn't a
problem before now.
This patch changes terrasync so it links against the subversion
library if you have it installed. It supports people who build binary
releases for use by non-developers by removing the runtime external
dependency on having command line svn or rsync available. Since the
patch changes autoconf to detect libsvn, I'd appreciate it if people
who release binaries could verify that the detection scripting works
for their platform.
Developer warning: If you do have libsvn developer libraries
installed, terrasync changes its default option from "-R" to "-S" to
remove the command line dependency. However, Martin has not yet
uploaded world scenery into the subversion repository so it won't be
useful to fly against and you may want to specify "-R" on the command
line in the short term. Or run both.
Me: Update MSVC 7.1 project file. Need svn-win32-1.x.y_dev.zip and svn-win32-1.x.y.zip
located at http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100
Regarding the Runway selection bug:
The logic here is a bit convoluted, but I also had a dumb bug in normaliseBearing - I was clamping to the wrong range (0..360 instead of -180..180). This caused the scoring code to pick weird runways. I've added some extra cases to my local tests, and here's a fix.
Trivial patch, but an important milestone:
Convert FGAirport to inherit FGPositioned. This concludes the first phase of the FGPositioned changes, and hopefully the most intrusive ones - adding in the base class. There's lots (and lots) of further work to do on the indexing and querying side, as well as cleaning up the accessors, but that will happen in single source files, or a group of related files at a time.
As a trivial note, this patch does fix a bug where the very last airport in apt.dat would get an invalid type. So for all you people who just love to fly to EHYB (Ypenburg, The Hague), things may work a little more sanely.
I'll intentionally let the dust settle after this patch, so any weird behaviour I may potentially have introduced shows up. Just to re-iterate, so far there should be absolutely no user-visible change in the behaviour of anything - navaids, position init, the route manager, AI flight plans, etc. If there is, please let me know and I'll fix it ASAP.
By way of example, here's a patch to make the position init code (in fg_init.cxx) cleaner, partly thanks to the FGPositioned changes. It reduces the file size by 200 lines - virtually all of which was copy-and-paste. Once the remaining class (FGAirport) is converted to inherit FGPositioned, all the future patches should be like this - touching one or a few files at most.
This factors the start-offset logic out into a helper, which also does the final property setting (which has to happen on both the /preset and 'real' values). Using the accessors in FGPositioned, and the offset helper, a couple of cases become trivial (fix and nav) and others become much simpler.
Convert FGNavRecord to inherit FGPositioned. This is much more self-contained than the FGRunway change, since FGNavRecord already had good encapsulation of its state. However, it's a large diff due to moving around two nasty pieces of code - the 'align navaid with extended runway centerline' logic and the 'penalise transmitters at the opposite runway end' logic.
In general things are more readable because I've replaced the Navaid type enum, and the use of Robin's integer type codes, with switches on the FGPositioned::Type code - no more trying to recall that '6' is an outer marker in Robin's data. The creation code path is also pushed down from navdb into navrecord itself.
Convert FGRunway to be heap-based, and inherit FGPositioned. This is a large, ugly change, since FGRunway was essentially a plain struct, with no accessors or abstraction. This change adds various helpers and accessors to FGRunway, but doesn't change many places to use them - that will be a follow up series of patches. It's still a large patch, but outside of FGAirport and FGRunway, mostly mechanical search-and-replace.
An interesting part of this change is that reciprocal runways now exist as independent objects, rather than being created on the fly by the search methods. This simplifies some pieces of code that search for and iterate runways. For users who only want one 'end' of a runway, the new 'isReciprocal' predicate allows them to ignore the 'other' end. Current the only user of this is the 'ground-radar' ATC feature. If we had data on which runways are truly 'single-ended', it would now be trivial to use this in the airport loader to *not* create the reciprocal.
Here's part 2 - converting FGFix (the simplest one) to be both heap-based and inherit FGPositioned. One minor benefit from this is replacing some dangerous code in FGFixList which used to return the address of an iterator member ('&it->second'). To keep the diff a sensible size, I'm not updating the callers to use the richer FGPositioned types - i.e replacing separate lat/lon handling with SGGeod. I will make those cleanups, but in future patches.
If someone could kindly apply the attached patch, that'll keep this from crashing, I believe. The fix is easy since FGAirport can now always provide an active runway - there's no need to guess at random, or rely on the tower having set one up.
Small patch fixing bugs I've encountered while getting the current CVS to build in MSVC.
* std::lower_bound was used with the key-type of a map, but lower_bound expects the value-type of the collection it works on, with is std::pair. MSVC seems to be more strict about this.
* Added an missing include statement.
* Replaced an rint() call with floor() (MSVC does not offer rint).
Here is a little patch that changes the behaviour of the VOR CDI and OFF-flag
for indicators like the HSI when getting outside the range of the VOR
station.
Currently, when flying at a distance between the effective_range and twice the
effective_range of a VOR station, the in-range property is computed based on
a random value, causing the OFF Flag and the CDI bar to perform an ugly
jitter.
The attached patch introduces a new property signal-quality-norm which is
computed based on the distance to the station and the range. It is 1.0 when
the distance is less than the range and decreases by 1/x^2 for distances
greater than the range leading to a signal-quality-norm of 0.25 for distances
two times the range, 0.125 for three times the range and so on.
The in-range flag is tied to a signal-quality-norm greater than 0.2 (fixed
squelch).
The CDI and GS needle deflection is multiplied with the signal-quality-norm.
The benefit is:
- Ability to animate the OFF-Flag with a smooth transition.
- CDI and GS needle deflection shows correct values when in range
(signal-quality-norm=1.0) and show some wrong indication when the range is
exceeded
- CDI and GS needle start to move, even when the OFF flag is visible
- No more jitter for flag and needles
See the new SenecaII ki525a hsi as an example at
http://www.t3r.de/fg/navpatch.jpg
The numbers on the image are:
(1) the new property signal-quality-norm
(2) distance exceeds the effective-range by 30%
(3) NAV flag has a rotation animation bound to signal-quality-norm and is
partially visible
(4) CDI is partially deflected even with NAV flag shown
This implementation better matches reality - at least, how I observed it ;-)
Good news: I'm working on some automatic testing of the 'core' FG pieces, especially those I'm likely to break in my Navaids / airports / runways work
Bad news: I already broke something, in my runways refactoring. (But my tests caught it!)
Attached patch fixes it - it's (of course) the stupidest thing in the world. Incidentally, standardising this kind of code into some (inlined) header is becoming more and more of a priority for me - I've lost count of the number of times I've seen the 'clamp heading to 0..360.0' and 'reverse a heading and clamp it' idioms in the code. The KLN89 and MkVIII code have (of course) their own helpers for this.
This is a little intrusive on the KLN89 code, but avoids the wasteful cloning of the airports, runways and navaids which current happens, and also combines the ugly string ordering code.
- removes various members from FGRunway which no-one was using
- any of these can be trivially re-instated if and when someone
actually wants to use them - but right now they're simply bloating up
FGRunway, which we have lots of, because it currently includes all the
taxiways in Robin's data.
- that's it.
- Runways are now part of an airport, instead of a separate list
- Runways are no longer represented as a boring struct, but as a class
of their own.
-Improved runway access to unify various runway access methods.
use <enabled>false</enabled> flag for widgets that shouldn't be drawn
instead of <hide>true</hide>. This is consistent with other places
in fgfs, like menu entries, hud elements, subsystem switches, etc.
Attached patch + new file make FGNavRecord have a .cxx file, and a constructor w
hich allows all the parameters to be supplied. Along the way I also cleaned up t
he navrecord.hxx header, lots more header pollution has been killed.
Some long methods are no longer inline, but were all suspiciously long to meet c
ompiler inlining criteria (I'm not clear if the 'inline' keyword is advisory or
mandatory in this situation) - I don't expect this to affect performance in any
way whatsoever.
The constructor addition is to support some hacking I'm doing improving the star
tup performance of the navDB by lazily loading the data, and caching it in a mor
e efficient format than text. I'm submitting this change (and probably some othe
r small tweaks in the future) since they are worthwhile as cleanups regardless o
f how my current experiments work out.
CameraGroup supports cameras opened in different windows or in the
same window, with flexible view and perspective specification.
Clean up mouse click handling via osgViewer. Don't let any camera
"have focus;" this forces events to be reported in window coordinates
and simplifies life. Don't use the osgViewer::View::requestWarpPointer
method; instead use our own code which only deals with window
coordinates.
Make glut and sdl versions work with CameraGroup too.
I thought that this would fix the "black hole in the sky" problem,
which turned out to be caused by an OpenSceneGraph bug. Nevertheless
it is a simplification.
* experimental clean-up / reduction on two of the FG headers:
(I'm going to await feedback on the developers list before doing more of
these, to avoiding going over files multiple times, but in principle it
seems pretty straightforward.)
* final fixes for SG_USING_STD removal
- this exposed a bizarre issue on Mac where dragging in <AGL/agl.h> in
extensions.hxx was pulling in all of Carbon to the global namespace
- very scary. As a result, I now need to explicitly include CoreFoundation
in fg_init.cxx.
- change SG_USING_STD(x) to using std::x
SimGear change. It changes all the SG_xxxx to be the 'real' includes, and gets
rid of many #ifdef SG_HAVE_STD_INCLUDES. As an added bonus, rather than
replacing 'SG_USING_NAMESPACE(std)' with 'using namespace std', I just fixed
the small number of places to use std:: explicitly. So we're no longer polluting
the global namespace with the entire contents of std, in many cases.
There is one more 'mechanical' change to come - getting rid of SG_USING_STD(X),
but I want to keep that separate from everything else. (There's another
mechnical change, replacing <math.h> with <cmath> and so on *everywhere*, but
one step at a time)
PLETE_FUNCTIONAL from SimGear and FlightGear.
As a result, SG_HAVE_STD_INCLUDES is now *always* set, so I will get the boring
fixes for that done, but separately. I'm still auditing the other things in comp
ilers.h - there's a lot that can die now BORLAND is gone.
- remove the OSX_BUNDLE crap *I* introduced years ago - we're always a a bun
dle on Mac now.
- fix up the default fg-root on Mac to be FlightGear.app/Contents/Resources/
data - i.e the location used by the macflightgear.org distro, and indeed the obv
ious 'correct' location. Not sure why I didn't use that in the first place, back
in the day.
- remove the CPSForegroundEnable hack. For one thing, we're a bundle and don
't need it, and for another, osgViewer on Mac does the same logic using a newer,
public API rather than a hack into the OS.
- remove the strange logic for doing fgOSInit 'early' (in bootstrap rather t
han main) when running from the command line on Mac; again this is obsolete, and
no one seems to know why it was ever necessary. I guess it was an interaction w
ith SDL when running without a bundle.
- (not Mac related) remove obsolete code bracketed by ENABLE_PLIB_JOYSTICK a
nd USE_GLIDE (neither of which are ever set, even from config.h that I can see)
in main.cxx
Various other patches that have been lingering around for a while:
* Moved trafficcontrol.[ch]xx from the Airports directory to ATC, where
it really belongs.
* AI aircraft will request startup clearance, and ground control will
approve.
* Starting AI Aircraft will be pushed back to a predefined holding point
on the ground network, and wait a while before taxiing out to the runway
- drop unused parts (MouseQuat/GuiQuat)
- move "old-reinit-dialog" fgcommand to fg_command.cxx under new name
"reset" for now. (May later get merged with fgcommand "reinit".)
- move reInit() to fg_init.cxx: This was used by Shift-Esc and
Menu->File-Reset (via fgcommand "old-reinit-dialog"). We have already
a similar function fgReInitSubsystems() in fg_init.cxx, so these two
functions will probably get merged later.)
where chosen to match the SGPropertyNode::WRITE/READ symbol names and
should make it more consistent, but this isn't really something that
should be exposed to the Nasal developer.)
we know the stack trace), it's better to use a separate function for
it, as this can be used conditionally, as in:
setlistener("/the/property", func(n) {
if (n.getValue() < 0) # who's writing negative numbers to /the/property?!
abort(); # let's check the backtrace ...
});
and its function called. This is useful for debugging purposes, to get
a core dump which unveils which C++ code was writing to the property.
This isn't any more of a security problem as other Nasal code that
makes fgfs crash, such as: var x = func call(x); x(); The difference
is that the listener doesn't use up all memory before and is much quicker.
- don't allow to do that from any XML file. This is to prevent malign
code from writing a new fg-home in ~/.fgfs/autosave.xml or other files
in ~/.fgfs/.
After the changes that moved the GUI and HUD to a slave camera, the
texture-based fonts wouldn't display. The main fixes here are making
sure that the TXF textures are all loaded into the font cache early,
and explicitly setting the active texture unit in the GUI / HUD
drawImplementation.
- don't keep oodles of class member variables public (eek!)
- use ::hasValue() instead of ::getType() != SGPropertyNode::NONE
- consistency fixes and cosmetics