1
0
Fork 0
Commit graph

86 commits

Author SHA1 Message Date
ThorstenB
07fe929288 Fixed helicopter view.
Corrected the new panning check: panning rotates around the y-axis,
so the x- or z-axis need an offset != 0 (not x-/y-axis).
2011-02-01 19:23:05 +01:00
ThorstenB
91d001ff4e Fix viewer issue with Tower and Chase View.
When looking _at_ a model with an x,y offset of 0,
then the view heading has no effect. So, force heading offset property
to 0 to keep other property consumers from running incorrect calculations.
=> Trying to rotate the heading offset in Tower/Chase view no longer
rotates the blue sky around the aircraft, though the viewer itself
isn't rotating anything.
2011-01-30 17:35:07 +01:00
Torsten Dreyer
4371a18771 resurrection of /sim/rendering/draw-otw 2010-10-26 21:20:01 +02:00
James Turner
d1852430bf Make various implicit includes (via PLIB) explicit. 2010-07-28 10:25:42 +01:00
James Turner
9604908a8d Remove all (2) uses of simgear/math/vector.h from FlightGear. 2010-07-23 13:26:07 +01:00
jmt
bc7c3ad4c6 bug99 - Fix case where damping is enabled, but factor is 0. 2010-04-03 22:34:07 +02:00
jmt
a33745e888 Bug #99 - change viewer damping calculation, to work correctly regardless of set/recalc/update ordering per frame. 2010-04-03 22:34:00 +02:00
ehofman
c56c520ab5 initlialize _playing for FGATC. Proper listerner orientation based on view offset. proper velocity orientation 2009-10-28 23:23:53 +01:00
frohlich
2f6107982c Use the new vector conversion functions.
Modified Files:
	src/FDM/groundcache.cxx src/Main/renderer.cxx
	src/Main/viewer.cxx src/Scenery/scenery.cxx
2009-09-09 08:56:31 +02:00
frohlich
4e7b084568 Simplify, fix some comments.
Modified Files:
	src/Main/viewer.cxx
2009-09-09 08:56:31 +02:00
jmt
2fa160d41a Replace plain doubles with SGGeod in FGViewer for position and target pos. 2009-06-11 16:05:20 +02:00
mfranz
35ed31972a Csaba HALASZ: fix uninitialized _aspect_ratio member in Main/viewer.cxx 2009-04-01 09:23:54 +02:00
frohlich
a99ea1c7b5 Port over remaining Point3D usage to the more type and unit safe SG* classes.
Remove leftover headers from plib/sg.

Modified Files:
 	src/AIModel/AIBase.cxx
 	src/AIModel/AIFlightPlanCreateCruise.cxx
 	src/ATCDCL/AIEntity.cxx src/ATCDCL/AIEntity.hxx
 	src/ATCDCL/AIGAVFRTraffic.cxx src/ATCDCL/AIGAVFRTraffic.hxx
 	src/ATCDCL/AILocalTraffic.cxx src/ATCDCL/AILocalTraffic.hxx
 	src/ATCDCL/AIMgr.cxx src/ATCDCL/ATC.hxx
 	src/ATCDCL/ATCDialog.cxx src/ATCDCL/ATCProjection.cxx
 	src/ATCDCL/ATCProjection.hxx src/ATCDCL/ATCutils.cxx
 	src/ATCDCL/ATCutils.hxx src/ATCDCL/approach.cxx
 	src/ATCDCL/commlist.cxx src/ATCDCL/ground.cxx
	src/ATCDCL/ground.hxx src/ATCDCL/tower.cxx
 	src/ATCDCL/tower.hxx src/Airports/calc_loc.cxx
 	src/Airports/dynamics.cxx src/Airports/groundnetwork.cxx
 	src/Airports/parking.cxx src/Airports/runwayprefs.cxx
 	src/Airports/simple.cxx src/Cockpit/cockpit.cxx
 	src/Cockpit/hud.hxx src/Cockpit/hud_card.cxx
 	src/Cockpit/hud_rwy.cxx src/Environment/environment.cxx
 	src/FDM/UFO.cxx src/FDM/SP/MagicCarpet.cxx src/GUI/dialog.hxx
 	src/Instrumentation/HUD/HUD.hxx
 	src/Instrumentation/HUD/HUD_runway.cxx
 	src/Instrumentation/KLN89/kln89.cxx src/Main/fg_init.cxx
 	src/Main/viewer.cxx src/Main/viewmgr.cxx
 	src/Model/panelnode.cxx src/MultiPlayer/mpmessages.hxx
 	src/Scenery/tilemgr.cxx src/Traffic/SchedFlight.cxx
 	src/Traffic/TrafficMgr.cxx
2009-03-18 08:00:08 +01:00
frohlich
19331f2813 Fix problem introduced with yesterdays viewer change.
Modified Files:
	src/Main/viewer.cxx
2009-03-11 23:14:34 +01:00
frohlich
e51c8bdce9 Silence valgrind error.
Modified Files:
	src/Main/viewer.cxx
2009-03-11 23:14:34 +01:00
frohlich
b125315e50 Avoid SGLocation usage.
Again, the previous commit did not complete for some reason.

Modified Files:
        configure.ac src/AIModel/AIBase.cxx
        src/ATCDCL/AILocalTraffic.cxx src/FDM/Makefile.am
        src/FDM/flight.hxx src/FDM/LaRCsim/LaRCsim.cxx
        src/Main/Makefile.am src/Main/fg_init.cxx src/Main/main.cxx
        src/Main/viewer.cxx src/Main/viewer.hxx
        src/Scenery/tilemgr.cxx src/Scenery/tilemgr.hxx
2009-03-11 23:14:34 +01:00
frohlich
30b05ee7a3 ompute some vectors from the current view when they are used.
Simplifies the update hell in the viewer a bit.

Modified Files:
	src/Main/renderer.cxx src/Main/viewer.cxx src/Main/viewer.hxx
	src/Time/tmp.cxx
2009-03-11 23:14:34 +01:00
jmt
0f4f044a94 Kill off many Point3D includes, and a couple of uses in the HUD code.
Requires a SimGear update to get some new SGGeodesy helpers.
2008-12-26 12:28:05 +00:00
timoore
6f802959ce CameraGroup class for managing multiple cameras.
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.
2008-08-01 15:57:29 +00:00
mfranz
7810fbc632 revert swapping of x & y offsets in "lookat" mode
This was correct in the old repository and in revision 1.1 of the new,
but then broken in revision 1.2. After that, "lookat" and "lookfrom"
mode used different coordinate systems, and the "Adjust View Distance"
didn't work correctly in "lookat" mode.
2007-11-05 22:19:39 +00:00
frohlich
4fe615fff5 Modified Files:
src/AIModel/AIBase.cxx src/AIModel/AICarrier.cxx
	src/ATC/AIEntity.cxx src/Cockpit/hud_rwy.cxx
 	src/FDM/Makefile.am src/FDM/flight.hxx src/FDM/groundcache.cxx
	src/Instrumentation/HUD/HUD_runway.cxx src/Main/Makefile.am
	src/Main/fg_init.cxx src/Main/main.cxx src/Main/renderer.cxx
	src/Main/viewer.cxx src/Main/viewer.hxx src/Model/acmodel.cxx
	src/Model/modelmgr.cxx src/Scenery/scenery.cxx
	src/Scenery/scenery.hxx src/Scenery/tileentry.cxx
	src/Time/tmp.cxx: Remove the scenery center handling.
	Osg has double valued transforms at any relevant place.
2007-05-05 08:08:24 +00:00
frohlich
bb3d4ad3af Modified Files:
src/Main/renderer.cxx src/Main/viewer.cxx: Clean up the viewers
	frames a bit. Do no longer require a axis permutation in osg's
	viewer.
2006-12-27 09:28:15 +00:00
frohlich
7e5d6d1d75 Modified Files:
Time/tmp.cxx Main/viewer.hxx Main/viewer.cxx Main/renderer.cxx
	Get rid of an other OSGFIXME. The view matrix had some plib specials
	included. The viewer is now updated for that.
2006-11-01 21:22:25 +00:00
frohlich
cdb725528d Clean up scenery center handling. It is set now less often. 2006-07-27 16:36:22 +00:00
mfranz
c9813d1b5d new FSF address 2006-02-21 01:16:04 +00:00
fredb
36e4045810 Add missing include files needed by the new math code under windows 2006-02-18 13:58:09 +00:00
ehofman
fad67bda10 Mathias Frhlihlich:
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
2005-09-05 13:25:09 +00:00
mfranz
fb9453fc2d Patrick Quirk: fix typo (Norman: "looks like this is probably a bug") 2005-07-07 12:57:00 +00:00
ehofman
4c10ef139c Mathias:
I have done a patch to eliminate the jitter of 3D-objects near the viewpoint
(for example 3D cockpit objects).
The problem is the roundoff accuracy of the float values used in the
scenegraph together with the transforms of the eyepoint relative to the
scenery center.

The solution will be to move the scenery center near the view point.
This way floats relative accuracy is enough to show a stable picture.

To get that right I have introduced a transform node for the scenegraph which
is responsible for that shift and uses double values as long as possible.
The scenery subsystem now has a list of all those transforms required to place
objects in the world and will tell all those transforms that the scenery
center has changed when the set_scenery_center() of the scenery subsystem is
called.
The problem was not solvable by SGModelPlacement and SGLocation, since not all
objects, especially the scenery, are placed using these classes.

The first approach was to have the scenery center exactly at the eyepoint.
This works well for the cockpit.
But then the ground jitters a bit below the aircraft. With our default views
you can't see that, but that F-18 has a camera view below the left engine
intake with the nose gear and the ground in its field of view, here I could
see that.
Having the scenery center constant will still have this roundoff problems, but
like it is now too, the roundoff error here is exactly the same in each
frame, so you will not notice any jitter.

The real solution is now to keep the scenery center constant as long as it is
in a ball of 30m radius around the view point. If the scenery center is
outside this ball, just put it at the view point.

As a sideeffect of now beeing able to switch the scenery center in the whole
scenegraph with one function call, I was able to remove a one half of a
problem when switching views, where the scenery center was far off for one or
two frames past switching from one view to the next. Also included is a fix
to the other half of this problem, where the view position was not yet copied
into a view when it is switched (at least under glut). This was responsible
for the 'Error: ...' messages of the cloud subsystem when views were
switched.
2005-04-29 14:38:24 +00:00
curt
5accfdeb90 Currently, aspect ratio is computed directly from the window dimensions.
I have added a --aspect-ratio-multiplier=x.xx option to give some end user
control over the aspect ratio.  (This may seem a little strange, but it's a
building block towards the capability of doing asymmetric view frustums in
FlightGear.)
2005-02-25 21:20:17 +00:00
curt
d05121ef46 Fix my mailing address by replacing it with my web page. 2004-11-19 22:10:41 +00:00
curt
f7fc455b0d Jim Wilson:
Remove some hardcoded dependencies between fdm, viewer and acmodel classes and
replaced them with property references.   Fix roll offset in viewer.
2004-03-19 03:30:18 +00:00
ehofman
536d135856 MSVC .NET 2003 fix 2004-03-07 09:37:49 +00:00
curt
1d058b0bac Jim Wilson:
This makes it possible to setup multiple cockpit views and have the correct
clipping plane set for rendering the model.
2003-10-22 18:48:31 +00:00
ehofman
ae8199be38 Melchior FRANZ:
The jitter is most likely caused by the irregular frame rate and CPU clock dependent intervals. There's no easy way around that. I tried some fancy interpolation and all that -- to no avail.
2003-07-24 15:00:16 +00:00
ehofman
9b545fd648 Fix a bug that would occur on 5GHz computers, and disable the altitude damping feature. 2003-07-22 08:51:31 +00:00
ehofman
a0d90b9746 Framerate independent viewer fixes from Melchior FRANZ 2003-07-14 14:20:45 +00:00
ehofman
7e15ed39a1 Latest changes to the viewer code from Melchior FRANZ 2003-07-12 09:52:26 +00:00
ehofman
6e174947df Melchior FRANZ:
The current chase view respects heading but ignores roll & pitch. And it follows heading without delay, which makes the viewer behave quite strange. This change makes the chase view feel more natural. You aren't fixed behind the plane, but follow all its movements with a delay.

Erik Hofman:
I've decided not to add the patch to preferences.xml in the base package because something feels funny with that. I think there needs to be some more discussion about it.
2003-07-11 08:58:26 +00:00
curt
3c7bdc31d9 Cosmetic changes for new code moved into simgear to make the naming scheme
better follow simgear conventions.
2003-05-13 03:18:42 +00:00
curt
51c04e9e4c - Added "SG" prefix to sound classes that recently moved to SimGear.
- Cleaned up some minor compiler warnings.
- Moved src/Model/placement.[ch]xx over into simgear/scene/model/
2003-05-09 19:39:48 +00:00
ehofman
8ef4374edb Jim Wilson:
What is actually happening is the camera is pointing to the right place (try zooming in),  but the camera is also travelling up and down with the nose and it should be staying more steady (in sync with the CG altitude).

Attached is a fix for this. There is still something a little funky going on with the camera, but this solves the biggest problem.  You will note that I deleted an unecessary reference to scenery.hxx in the patch.
2003-05-09 08:31:14 +00:00
curt
575b3ac98c Working at unraveling and breaking dependencies inside of src/Model.
I split the FGModelPlacement code out into it's own set of source files.
I created two versions of the fgLoad3DModel() routine.  One that is
  unecumbered by a panelnode dependency and one that is.  acmodel.cxx is
  the only place that needs to load an aircraft with instrument panels.
model.[ch]xx are now pretty much free to move over into simgear.
loader.[ch]xx should be able to follow closely behind.
This will be a big step towards being able to move the material management
code over into simgear.
2003-05-08 20:28:46 +00:00
curt
2119db35c3 This is step "1" of probably "many" in the process of separating out the
scene management code and organizing it within simgear.  My strategy is
to identify the code I want to move, and break it's direct flightgear
dependencies.  Then it will be free to move over into the simgear package.

- Moved some property specific code into simgear/props/
- Split out the condition code from fgfs/src/Main/fg_props and put it
  in it's own source file in simgear/props/
- Created a scene subdirectory for scenery, model, and material property
  related code.
- Moved location.[ch]xx into simgear/scene/model/
- The location and condition code had dependencies on flightgear's global
  state (all the globals-> stuff, the flightgear property tree, etc.)  SimGear
  code can't depend on it so that data has to be passed as parameters to the
  functions/methods/constructors.
- This need to pass data as function parameters had a dramatic cascading
  effect throughout the FlightGear code.
2003-05-06 23:46:24 +00:00
curt
79b3e39251 There are a number of little changes. Tested with current cvs as of 20:30EST
04Feb.  Actually been running since the beginning of January with these
patches.  All changes work without crashing with the current base package cvs,
but there are some visual problems with the views (other than pilot view)
without changes to the base package.

As soon as you can build test and commit I can add in those base package
updates that will make it all work nicely.  I will also go through all the 3D
Aircraft configs to make sure the change in the "pitch-offset" for cockpit
views (see below) are made to maintain current behavior.

Here are the files (changes listed below):
http://www.spiderbark.com/fgfs/viewerupdate.diffs.gz
http://www.spiderbark.com/fgfs/viewerupdate.tar.gz
2003-02-06 19:44:32 +00:00
david
bf1e7c7881 Patch from Cameron Moore:
* Rearranged member initializers
2002-07-18 22:32:32 +00:00
curt
8ae364a220 Jim Wilson:
This is a small fix for what turned out to be a major bug.  Ground elevation
was calculated incorrectly when distant from one of the view locations. This
resulted in several problems including bizarre gear trimming, mid air
"crashes" (as in thinking we hit the ground) and so on when close to or on the
ground.

Unfortunately it does require a second ssg traversal when in tower view
(only), but the increased load isn't all that noticable.  For the time being
this really is the best solution.  In a future update I will be eliminating
the unecessary per frame traversals for the static views (without having to
maintain multiple ssgRoots).

When we go to multiple FDM instances we will perhaps need to put the ssg
traversal and ground elevation queries for the FDMs into an event timer that
updates the FDMs ground elevation in a round robin fashion (maybe every 1/n
seconds where n is the number of FDM instances running).
2002-05-20 16:13:37 +00:00
curt
b1674cb506 From: "Jim Wilson" <jimw@kelcomaine.com>
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.
2002-05-17 17:25:28 +00:00
curt
47825dcbae Moved "scenery" from being declaried in scenery.cxx to being declared
in globals.hxx.
2002-05-14 05:22:52 +00:00
david
5a849b66e8 Major overhaul:
- 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.
2002-05-11 16:28:50 +00:00