andy [Thu, 21 Mar 2002 03:35:52 +0000 (03:35 +0000)]
Found by inspection a bug in the generation of orientation matrices
for fuselage Surface objects. If the fuselage wasn't aligned perpendicular
to the Y axis, the matrix wouldn't be orthonormal. Since all of, perhaps,
three aircraft have ever been built this way, it's doubtful I would have
found this as a bug report. :)
david [Wed, 20 Mar 2002 17:43:28 +0000 (17:43 +0000)]
Major viewer-code overhaul from Jim Wilson:
Description:
This update includes the new viewer interface as proposed by David M. and
a first pass at cleaning up the viewer/view manager code by Jim W.
Note that I have dropped Main/viewer_lookat.?xx and Main/viewer_rph.?xx and
modified the Makefile.am accordingly.
Detail of work:
Overall:
The code reads a little easier. There are still some unnecessary bits in
there and I'd like to supplement the comments in the viewer.hxx with a tiny
bit on each interface group and what the groupings mean (similar but briefer
than what you emailed me the other day). I tried not to mess up the style,
but there is an occasional inconsistency. In general I wouldn't call it done
(especially since there's no tower yet! :)), but I'd like to get this out
there so others can comment, and test.
In Viewer:
The interface as you suggested has been implemented. Basically everything
seems to work as it did visually. There is no difference that I can see in
performance, although some things might be a tiny bit faster.
I've merged the lookat and rph (pilot view) code into the recalc for the
viewer. There is still some redundancy between the two, but a lot has been
removed. In some cases I've taken some code that we'd likely want to inline
anyway and left it in there in duplicate. You'll see that the code for both
looks a little cleaner. I need to take a closer look at the rotations in
particular. I've cleaned up a little there, but I suspect more can be done
to streamline this.
The external declaration to the Quat_mat in mouse.cxx has been removed. IMHO
the quat doesn't serve any intrinsic purpose in mouse.cxx, but I'm not about
to rip it out. It would seem that there more conventional ways to get
spherical data that are just as fast. In any case all the viewer was pulling
from the quat matrix was the pitch value so I modified mouse.cxx to output to
our pitchOffset input and that works fine.
I've changed the native values to degrees from radians where appropriate.
This required a conversion from degrees to radians in a couple modules that
access the interface. Perhaps we should add interface calls that do the
conversion, e.g. a getHeadingOffset_rad() to go along with the
getHeadingOffset_deg().
On the view_offset (now headingOffset) thing there are two entry points
because of the ability to instantly switch views or to scroll to a new view
angle (by hitting the numeric keys for example). This leaves an anomaly in
the interface which should be resolved by adding "goal" settings to the
interface, e.g. a setGoalHeadingOffset_deg(), setGoalPitchOffset_deg(), etc.
Other than these two issues, the next step here will be to look at some
further optimizations, and to write support code for a tower view. That
should be fairly simple at this point. I was considering creating a
"simulated tower view" or "pedestrian view" that defaulted to a position off
to the right of whereever the plane is at the moment you switch to the tower
view. This could be a fall back when we don't have an actual tower location
at hand (as would be the case with rural airports).
ViewManager:
Basically all I did here was neaten things up by ripping out excess crap and
made it compatible as is with the new interface.
The result is that viewmanager is now ready to be developed. The two
preexisting views are still hardcoded into the view manager. The next step
would be to design configuration xml (eg /sim/view[x]/config/blahblah) that
could be used to set up as many views as we want. If we want to take the easy
way out, we might want to insist that view[0] be a pilot-view and have
viewmanager check for that.
david [Tue, 19 Mar 2002 17:12:13 +0000 (17:12 +0000)]
Major property-manager rewrite, using const char * throughout
interface instead of string. This will result in a lot more
efficiency later, once I add in a simple hash table for caching
lookups, since it will avoid creating a lot of temporary string
objects. The major considerations for users will be that they cannot
use
node->getName() == "foo";
any more, and will have to use c_str() when setting a string value
from a C++ string.
curt [Mon, 18 Mar 2002 19:46:24 +0000 (19:46 +0000)]
Somewhere along the line in the recent changes some std::cout were
inclueded in some of the files. Irix doesn't have cout in the std class,
so I changed it to "cout" and included SG_USING_NAMESPACE(std) at the
beginning of the files.
And some minor warning cleanups.
curt [Mon, 18 Mar 2002 16:25:16 +0000 (16:25 +0000)]
Here is a cleaned up hitlist that should solve the PLib conflict
and fixes a 'potential bug' if the FGFS View code were to change
I also consolidated the specialized IntersectLeaf()
as they really didn't gain us much outside of their having
'more direct access into the SSG controlled data'
I would like to see the fgCurrentElevation functions moved
out of hitlist.cxx.
The one obstacle is their being dependent on my PLib
auxillary functions
ssgGetEntityTransform()
ssgGetCurrentBSphere()
code has been run through astyle with the default options
curt [Sun, 17 Mar 2002 00:36:39 +0000 (00:36 +0000)]
Oops, fixing the ghosts of bugs past. :-) Good thing I remembered how I
fixed this when I made the mistake the first time.
The view code wasn't properly handling the transition across tile
boundaries so we'd get a 'flash' of the scene wrongly transformed for
one frame at every tile boundary crossing. This is what
scenery.get_next_center() is for.
david [Sat, 16 Mar 2002 20:31:27 +0000 (20:31 +0000)]
Major weather update from Christian Mayer, tying the weather code into
the property system, among other things. A separate integration into
the FDMs will follow shortly.
This code will be used only if the --with-new-environment option is
*not* passed to configure.
david [Sat, 16 Mar 2002 00:18:38 +0000 (00:18 +0000)]
Patches from Tony Peden to separate property XML I/O operations into a
separate header file. This change will help integrate properties into
JSBSim.
Also, I (David Megginson) removed most of the SimGear include
statements from globals.hxx, reducing the amount of recompilation
every time SimGear changes. This required making minor changes to a
lot of files that were depending on the side-effects of the inclusions
in globals.hxx.
david [Thu, 14 Mar 2002 14:25:30 +0000 (14:25 +0000)]
More work on saving and restoring flights. Restoring a flight is not
working in a running FlightGear session because of JSBSim trim-routine
problems, but it does work from the command-line now, i.e.
david [Wed, 13 Mar 2002 16:31:21 +0000 (16:31 +0000)]
Autopilot cleanup:
- implement the standard FGSubsystem interface, for consistency
- eliminate current_autopilot and add get/set_autopilot to FGGlobals,
for consistency
- use private methods rather than static functions for tying
properties
curt [Wed, 13 Mar 2002 06:07:07 +0000 (06:07 +0000)]
Working on the start of a 'standard' <grin> remote FDM interface. This
is a work in progress and needs severe enhancement before it will be
useful. It provides a UDP data channel that goes both ways between
flightgear and the fdm. It also provides a TCP 'command' channel so
flightgear can 'reliably' send commands to the remote fdm (such as set
starting position, reset on ground, etc.)
curt [Wed, 13 Mar 2002 06:03:37 +0000 (06:03 +0000)]
Better support of the newer more flexible object file format. This
includes the ability to specify per vertex normals rather than depending
the normals list being the same as the vertices list. (Support for
previous binary file format scenery is maintained.)
david [Wed, 13 Mar 2002 04:58:08 +0000 (04:58 +0000)]
Patch from Jim Wilson to fix internal cockpit view rotations:
This seems to pretty much correct the problem. Part of the problem is that
rotations are occuring at the firewall (model origin) which seems a little
un-natural inside the cockpit. The rest of the problem is I am just learning
how this stuff works (I know I've been saying this for a couple months
now...but hey I'm slow :-)).
david [Sun, 10 Mar 2002 19:31:30 +0000 (19:31 +0000)]
Sound patch from Erik Hofman:
* Add new trigger types: raise, fall
* Add new trigger offset parameter
* Add new volume/pitch types: inv, abs, sqrt
* Add initial support for multiple events to intervere in a single sound
(by using the same name, see the crank section of 172-sound.xml)
* Cached the volume/pitch type fucntions
(No more if's inside the loops in update())
david [Wed, 6 Mar 2002 16:03:33 +0000 (16:03 +0000)]
First baby steps towards restructuring the view architecture. I've
created a new class, FGViewPoint (declared in viewer.hxx) that holds a
single position in FlightGear coordinates, and have used it to factor
a lot of the common code out of viewer_lookat.cxx and viewer_rph.cxx.
I don't know whether this new class will stay or not; it might just be
a temporary step, or it might end up taking over much of the current
viewer functionality. It would be a bad idea to code against it right
now.
david [Wed, 6 Mar 2002 16:01:19 +0000 (16:01 +0000)]
If the (temporary) property /cockpit is true, set the near clipping
plane to 0.2; otherwise, use the old defaults.
This is a temporary step that will allow me to work on a 3D cockpit
without breaking current behaviour; the final approach will be to put
the 3D model in its own scene graph, with different clipping plane.
david [Wed, 6 Mar 2002 13:53:18 +0000 (13:53 +0000)]
Patch from Andy Ross to allow virtual panel to tilt with mouse view:
OK, attached is a replacement for mouse.cxx that works the view using
the view-offset/tilt interface, rather than the (kinda odd) GuiQuat
stuff. It's kind of a hack job, as I left the hooks to GuiQuat in in
other places for fear of breaking something. Still, it removed more
code from mouse.cxx than it added, which has to count for some
elegance points.
david [Wed, 6 Mar 2002 13:51:05 +0000 (13:51 +0000)]
Patch from Andy Ross to hide virtual panel when required:
Oh yeah, I forgot to send that one along. This one is my bug, I
goofed the precedence in the fgPanelVisible() function in panel.cxx
such that the panel was *always* visible if virtual cockpit was
enabled. Here's a replacement. I've modified the style from a single
boolean expression to an if-list, since that's more readable to my
eyes for expressions this big:
david [Tue, 5 Mar 2002 13:39:45 +0000 (13:39 +0000)]
Start of an internal 3-D view. If the property "/cockpit" (temporary
and soon to be renamed) is true, FlightGear will draw the 3-D model
even in internal view. This makes sense right now only with the C310
model, since the others don't have any kind of interiors modeled and
all surfaces in all models are one-sided.
This isn't quite working yet -- the view code is very hard to
disentangle, and currently, if the view is not forward, roll and pitch
are applied incorrectly. It looks interesting (modulo a messy model)
on the ground, in level flight, or looking straight ahead under any
other flight conditions.
david [Tue, 5 Mar 2002 13:35:48 +0000 (13:35 +0000)]
Changed the near clip plane to 0.1f regardless. Previously, it jumped
to 10m after takeoff, but that doesn't really make sense any more,
especially if models are going to have interior views. Is there any
real saving in pushing the near plane out anyway?
curt [Mon, 4 Mar 2002 20:12:30 +0000 (20:12 +0000)]
Fixed a bug with view-offset specification from the command line. There
was some confusion between degrees and radians which would lead to a huge
goal_view_offset value. The display would sit and spin for a *long* time
trying to wind it's way up to this large value.
curt [Mon, 4 Mar 2002 16:03:11 +0000 (16:03 +0000)]
This patch creates a sample manager next to the sound manager. The
difference between the two is this: A sample is file related and sound
is a authonomus entity. This means you can have several sounds pointing
to a single sample. In that case, just one sample is loaded into memory.
The advantage is you can play the same sample with different pitch or
volume, but with just one sample loaded into memory.
To fully support this there is a new fucntion call:
FGSimpleSound *sample = new FGSimpleSound("filename");
mgr->add(sample, "name");
david [Mon, 4 Mar 2002 13:27:53 +0000 (13:27 +0000)]
Patch from Andy Ross:
Actually, I think I'm off the hook here; the problem is pre-existing.
What's happening is that the x/y offsets enter the modelview matrix at
line 346 in the current panel.cxx. But note that the same
transformation also occurs before each instrument rendered at line
403. What's happening is that the instruments are double-translated
relative to the background.
Unless I'm not understanding something, the one inside the instrument
render loop looks unnecessary. Removing it fixes the issue and
doesn't cause any bugs that I can find. It also fixes a bug where you
could scroll the instruments on top of the 3D panel, where the offsets
are supposed to be ignored. :)
Attached is a new panel.cxx which fixes that bug, and substantially
simplifies the virtual panel code (the matrix inversion that I thought
was needed wasn't, but there were some offsetting scale bugs that hid
the problem).
david [Mon, 4 Mar 2002 00:03:25 +0000 (00:03 +0000)]
Patch from Jim Wilson:
These changes add to the "Add Waypoint" dialog so that you can see the entire
list in the pui dialog that you are adding to. Also made some minor changes
so that the autopilot is now activated (toward first waypoint target heading)
when a waypoint is added.
david [Sun, 3 Mar 2002 22:48:40 +0000 (22:48 +0000)]
Added write-all parameter to save command. If set to true, the
command will save *all* properties, rather than just those marked as
archivable. This feature was requested by Tony Peden to make it
easier to write documentation on the properties, but it should also be
useful for debugging. There is currently no default binding for the
command with the write-all parameter set to true.
david [Sun, 3 Mar 2002 00:06:24 +0000 (00:06 +0000)]
Virtual cockpit patches from Andy Ross:
What the attached patch does is map your panel definition onto a (non
z-buffered) quad in front of your face. You can twist the view around
and see it move in the appropriate ways.
Apply the patch (let me know if folks need help with that step), and
then set the /sim/virtual-cockpit property to true. You can do this
on the command line with --prop:/sim/virtual-cockpit=1, or via the
property picker. Bind it to a key for fast toggling if you like.
The default bindings don't allow for "panning" the view, so you'll
have to modify yours. These are the mappings to my joystick's hat
switch, for those who need hints:
While the current implementation is happy with just plastering the
panel's notion of "screen" into the 3D world, this is actually more
general. Each panel can, in principle, have it's own coordinate
system, and you could build a cockpit out of a bunch of them. The
mapping is specified by providing a 3D coordinate for three corners of
the quad the panel should be mapped to; this should be pretty simple
to work with.
All that's needed for a perfectly general solution is a convention on
where to store the information (a cockpit xml file, or put it in the
aircraft -set file, or...), and some work on the panel's coordinate
system conventions (some of which don't coexist very nicely with a
generalized 3D environment). Combine that with a plib model for the
non-panel interior of the cockpit, and we're golden.
I'm actually really pleased with this. It worked better and more
quickly than I could have imagined, and impact on the surrounding code
is quite light -- a few property tests only. But some stuff is still
missing:
+ No equivalent work was done to the HUD, so it still displays
incorrect headings when the view changes. The use of pixel
coordinates deep in the HUD code is going to give me fits doing the
port, I sure. It's not nearly so well put together as the panel
(where I just changed the setup code -- none of the rendering code
changed at all).
+ I forgot that the panel was clickable. :) Input events still have
the screen coordinates, which essentially kills the interactivity
when in virtual cockpit mode. This won't be hard to fix; it's only
broken because I forgot the feature existed.
And one note about the implementation choice: to get away from the
inevitable near clip plane issue, the virtual cockpit renderer simply
disables the z buffer. This means that cockpits built using these
panels need to be z-sorted, which isn't too hard since they are static
geometry. It also means that no two "virtual panels" can ever be
allowed to interpenetrate. No biggie.
david [Sat, 2 Mar 2002 16:07:42 +0000 (16:07 +0000)]
Added min/max parameters to clamp range of movement. These are
actually very powerful when combined with factor and offset -- for
example, on the C310 model the nose wheel can now retract completely
before the doors start closing.
curt [Fri, 1 Mar 2002 17:39:52 +0000 (17:39 +0000)]
Attached is a reasonably large patch to add a proper ATC
subsystem to Flightgear. No more functionality is implemented
than at present (apart from an ATIS bug-fix - station wouldn't
change if the radio was switched directly from one station to
another) but it is much neater than the current hack and should be
easily extendable.
Some cruft is still probably left over in radiostack.[ch]xx such as
the bindings to the comm frequencies but I'll leave removing those
until I'm sure they're not needed there.
curt [Fri, 1 Mar 2002 16:54:50 +0000 (16:54 +0000)]
This is the change where autopilot bindings are moved from fg_props.cxx to
newauto.cxx. Basically everything is the same functionally except for a
changed in the initial altitude setting to 3000ft instead of meters (the panel
is in feet).
andy [Fri, 1 Mar 2002 06:47:28 +0000 (06:47 +0000)]
Added a property output feature to ControlMap that allows arbitrary binding
and scaling of control values to properties. Also added a time interpolation
feature that replaces the hacked-in "retract-time" feature for the gear in
a more general way (applicable to flaps, too!). Incompatibly breaks
the XML syntax; get new files!
curt [Thu, 28 Feb 2002 23:59:28 +0000 (23:59 +0000)]
Latest version of hitlist.cxx from Norman Vine:
- Addresses some ot the recent profiling results.
- Added a 'lazy evaluation' in IntersectBranch and inlined a couple
of HEAVILY called functions.