1
0
Fork 0
Commit graph

398 commits

Author SHA1 Message Date
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
7e73a87882 Improove FGTileMgr::scenery_available for small ranges.
Use SGGeod in FGTileMgr, FGScenery apis.

Modified Files:
	src/AIModel/AIBallistic.cxx src/Main/main.cxx
	src/Scenery/scenery.cxx src/Scenery/scenery.hxx
	src/Scenery/tilemgr.cxx src/Scenery/tilemgr.hxx
	src/Scripting/NasalSys.cxx
2009-03-18 08:00:07 +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
85be5659a7 Remove SGLocation based api.
Modified Files:
	src/Scenery/tilemgr.cxx src/Scenery/tilemgr.hxx
2009-03-11 23:14:34 +01:00
frohlich
1845a95fd3 Add scenery functions working on SGGeod in place of SGLocation. 2009-03-11 23:14:33 +01:00
frohlich
fc35624a4f Use that static material function instead of the member one.
Modified Files:
 	src/FDM/groundcache.cxx src/Scenery/scenery.cxx
2009-02-27 23:42:34 +01:00
Tim Moore
0603aba9ae Merge branch 'tbm/graphics-bug' into next 2009-01-04 00:03:26 +01:00
timoore
ada7f622d7 Change the order of the main cameras from NESTED_RENDER to POST_RENDER
This seems to be accepted OSG usage for slave cameras. It's possible
that this order is important for rendering instruments that use RTT
textures on systems without frame buffer object support. I'm thinking
that the resulting bugs may be implicated in the "black rectangle" problem.
2009-01-03 23:56:03 +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
77318b23a5 msg 2008-11-25 22:49:19 +00:00
timoore
4f4434787f Cleanup of camera code in preperation for shadows
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.
2008-11-18 22:45:57 +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
timoore
5d5b1f3ca4 One more try at the osg 2.5.1 pager fix 2008-06-03 07:32:03 +00:00
timoore
97d86e10f7 Fix typo in DatabasePager interface changes for OSG 2.4 2008-06-03 05:36:19 +00:00
timoore
8d1c97d94b Changes for new DatabasePager interface in OSG 2.5.1 2008-06-02 21:10:13 +00:00
timoore
4dea9807f6 fg: move most scenery-related code to simgear
From Till Busch.
2008-05-14 22:10:07 +00:00
mfranz
a04d4cbed6 Till BUSCH:
"the [...] patch (for fg) increases the time before invisible geometry (i.e.
geometry not inside the view frustrum) gets deleted. default was 10 seconds
which i am increasing to 2 minutes."
2008-04-25 08:43:59 +00:00
timoore
fd492a297a model paging patch from Till Busch
From Till:
i started the project at the end of february with a simple idea: move all
3d-model loading to the DatabasePager-thread. my first attempts looked
promising, though they were a little too optimistic (or naive?). the patch
has evolved a lot since.

currently it does the following things:
1. revive SGModelLib, move functions for xml-model-loading there

2. replace all calls to sgLoad3dModel with calls to either
SGModelLib::loadModel() or SGModelLib::loadPagedModel()
almost all models will be loaded by the DatabasePager. the few exceptions are:
your own plane, shared models in scenery, random objects, AIBallistic models.

3. simplify mode-loading functions (avoid passing around fg_root)

4. avoid supurious MatrixTransform nodes in loaded models

5. fix some memory leaks
2008-03-22 09:31:06 +00:00
timoore
b8de58bcdd cleanup of precipitation contribution
Reindent to Stroustrup style.

Make FGPrecipitationMgr an SGSubsystem and remove all references to it
in main.cxx and renderer.cxx.

Use SGGeod::makeZUpFrame instead of a private function in
tileentry.cxx. Rewrite that function, WorldCoordinate, to use
makeZUpFrame too.
2008-03-04 09:03:54 +00:00
timoore
eb26cb3590 precipitation effects from Nicolas Vivien 2008-03-04 09:02:24 +00:00
timoore
72a42c2240 Cleaned up comments to tile entry code 2008-02-21 22:50:05 +00:00
curt
c3ee389fe0 Till Busch:
As discussed with Tim on irc: Here is a quick fix for the memory-hungry tile
manager. Due to bugs in FGNewCache, old tiles were never deleted.

I left the timestamp-updates in the cull-traversal. but imho things work
just as well when timestamps are updated in FGNewCache::insert_tile() and
FGNewCache::get_tile()
2008-02-21 21:36:20 +00:00
timoore
f6723429a0 Toggle tree effect on /sim/rendering/random-vegetation property 2008-02-07 23:02:51 +00:00
timoore
853e371d1e Fix for "falling through ground" problem
The LOD far range on the tile entry scenegraph node was initialized to
0. This meant that any traverals of active children that happened
before the tile manager updated the node would ignore the node
altogether. Among these is the groundcache traversal which was failing
at startup even though scenery was loaded.

Also added a function to dump scene graph nodes to files; very handy
in gdb.
2007-12-20 23:20:51 +00:00
timoore
f105f47e91 Added copyright to SceneryPager. Removed FGTileLoader 2007-12-15 06:01:24 +00:00
timoore
7ca1a60e91 Check if request has already been satisfied 2007-12-14 22:52:57 +00:00
timoore
7cb5fd170a schedule tiles in Inited state if we get a valid bucket 2007-12-14 22:52:31 +00:00
timoore
616b2bf4f6 Use the OSG DatabasePager instead of FGTileLoader
Make an OSG file reader for .stg files.

New class flightgear::SceneryPager, which is a subclass
osg::DatabasePager to handle explicit delete requests.

Modify FGNewCache, FGTileEntry, and FGTileManager to use
SceneryPager. Mostly this involved removing the queues that talked to
FGTileLoader.

Calculate accurate tile timestamps from the time they are traversed in
the cull stage (which means that they are visible) instead of updating
them periodically.

Replace tile entry transform and range node with one LOD node
2007-12-14 22:51:56 +00:00
timoore
ec61e15e89 backport of code using ModelRegistry 2007-11-29 23:59:47 +00:00
timoore
a76f3863bf Move to loading tiles and their submodels only by name.
Some cleanup in tileentry.cxx, but mostly code to implement loading of tiles
and their models without reference to FGTileEntry or SGBucket structures.
Also, don't do deferred model loading; load them when the tile is loaded.
2007-11-29 23:59:14 +00:00
timoore
acaf611495 Load BTG files through the osgDB::Registry
This is part of changes leading towards using the OSG database pager thread.
2007-07-29 22:34:15 +00:00
frohlich
ed677676c0 Modified Files:
src/Scenery/scenery.cxx: Use geodetic down vector for
	ground intersection.
2007-07-29 10:51:41 +00:00
frohlich
17262df51c Modified Files:
src/FDM/flight.cxx src/FDM/flight.hxx
	src/FDM/LaRCsim/LaRCsim.cxx src/FDM/SP/ADA.cxx
	src/Scenery/scenery.cxx src/Scenery/scenery.hxx:
	Remove obviously unused variables from FGInterface, make use of
	SGMath functions. No longer use plib math functions in FGInterface.
2007-07-29 10:21:22 +00:00
mfranz
1e6fa7d2a5 a token can be empty (empty line), in which case there's no token[0] 2007-07-11 15:18:24 +00:00
mfranz
5abe6dffdb degrade "Warning: catching up on tile delete queue" from SG_ALERT to SG_WARN.
* it says it's a warning (while in fact it's just saying what it's doing)
* the user can't do much here (yes, flying slower, but it doesn't say that :-)
* scrolling those countless messages in the terminal puts stress on the CPU
  in a time when it's apparently already struggling
2007-06-24 08:30:55 +00:00
frohlich
4317dbf729 Modified Files:
src/Scenery/tileentry.cxx: Jonathan Wagner:
	Removes black dots by accounting for radius of nodes
	when calculating visible nodes for traversal without removing the
	optimization.  Confirmed fix with a few people on IRC.
2007-05-26 13:51:23 +00:00
frohlich
16a2bb0118 Modified Files:
src/ATC/AIPlane.cxx src/ATC/ATC.cxx src/ATC/ATCDialog.cxx
	src/ATC/ATCmgr.cxx src/ATC/Makefile.am src/ATC/approach.cxx
	src/ATC/atis.cxx src/ATC/ground.cxx src/ATC/tower.cxx
	src/GUI/mouse.cxx src/Main/Makefile.am src/Main/fg_init.cxx
	src/Main/fg_props.cxx src/Main/globals.cxx
	src/Main/globals.hxx src/Main/main.cxx src/Main/renderer.cxx
	src/Model/acmodel.cxx src/Scenery/scenery.cxx
	src/Scenery/scenery.hxx src/Scenery/tilemgr.cxx
	src/Scenery/tilemgr.hxx
Removed Files:
	src/ATC/ATCdisplay.cxx src/ATC/ATCdisplay.hxx:
	Remove unused functions and the disabled ATC display.
2007-05-09 20:41:08 +00:00
frohlich
b51292d9db Modified Files:
src/FDM/groundcache.cxx src/Main/fg_commands.cxx
	src/Main/main.cxx src/Main/renderer.cxx
	src/Scenery/FGTileLoader.cxx src/Scenery/scenery.cxx
	src/Scenery/scenery.hxx src/Scenery/tileentry.cxx
	src/Scenery/tileentry.hxx src/Scenery/tilemgr.cxx
	src/Scenery/tilemgr.hxx: Simplify scenegraph structure.
2007-05-08 06:12:26 +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
19e2e7a461 Modified Files:
src/Main/renderer.cxx src/Scenery/Makefile.am
Added Files:
	src/Scenery/redout.cxx src/Scenery/redout.hxx:
	Add simple redout effect.
2007-05-03 18:47:39 +00:00
frohlich
2f8beb56ea Modified Files:
src/GUI/new_gui.cxx src/GUI/new_gui.hxx src/Main/main.cxx
 	src/Main/renderer.cxx src/Main/renderer.hxx
	src/Main/splash.cxx src/Main/splash.hxx
	src/Scenery/scenery.hxx: Move splash screen into the scenegraph.
2007-05-03 18:12:29 +00:00
frohlich
a533e0c39d Modified Files:
src/Scenery/newcache.cxx: Olaf Flebbe:
	make destructor work.
	Bug: Do not modify a map while iterating over  it.
2007-02-14 17:55:52 +00:00
frohlich
a788ebf487 Modified Files:
src/Input/input.cxx src/Main/renderer.cxx
	src/Main/renderer.hxx src/Scenery/scenery.cxx
	src/Scenery/scenery.hxx: Move scenery picking into the renderer.
	There is most of the required data defined. Also we can better use
	the pick visitor that will be needed with th upcommung panel code.
2007-01-07 12:02:50 +00:00
frohlich
059c906be5 Modified Files:
src/Cockpit/panel.cxx src/Cockpit/panel.hxx
 	src/Cockpit/panel_io.cxx src/GUI/dialog.cxx src/GUI/dialog.hxx
	src/GUI/menubar.cxx src/GUI/menubar.hxx src/GUI/new_gui.hxx
	src/Input/input.cxx src/Input/input.hxx src/Main/renderer.cxx
	src/Scenery/scenery.cxx src/Scenery/scenery.hxx:
	Use SGBinding instead of FGBinding. Remove FGBinding. Install hooks
	to make the pick animation work.
2007-01-04 13:22:27 +00:00
frohlich
0a522b383a Modified Files:
src/Scenery/tileentry.cxx: No longer need to lift lights due to agl.
2006-12-27 10:36:18 +00:00
frohlich
b8f9a40fc6 Removed Files:
hitlist.cxx hitlist.hxx: Is obsolete.
2006-11-01 21:14:28 +00:00
frohlich
b0f9d24f9d Modified Files:
configure.ac src/AIModel/AIAircraft.cxx src/AIModel/AIBase.cxx
 	src/AIModel/AIBase.hxx src/AIModel/AICarrier.cxx
 	src/AIModel/AICarrier.hxx src/AIModel/AIManager.cxx
 	src/AIModel/AIManager.hxx src/ATC/AIEntity.cxx
 	src/ATC/AIEntity.hxx src/ATC/AIMgr.cxx src/ATC/AIMgr.hxx
 	src/ATC/ATCdisplay.cxx src/ATC/ATCdisplay.hxx
 	src/Cockpit/cockpit.cxx src/Cockpit/cockpit.hxx
 	src/Cockpit/hud.cxx src/Cockpit/hud.hxx
 	src/Cockpit/hud_rwy.cxx src/Cockpit/panel.cxx
 	src/Cockpit/panel.hxx src/Cockpit/built_in/FGMagRibbon.cxx
 	src/Cockpit/built_in/FGMagRibbon.hxx src/FDM/flight.cxx
 	src/FDM/groundcache.cxx src/FDM/groundcache.hxx
 	src/GUI/gui_funcs.cxx src/Input/input.cxx
 	src/Instrumentation/od_gauge.cxx
 	src/Instrumentation/od_gauge.hxx
 	src/Instrumentation/render_area_2d.cxx
 	src/Instrumentation/render_area_2d.hxx
 	src/Instrumentation/wxradar.cxx
 	src/Instrumentation/wxradar.hxx
 	src/Instrumentation/HUD/HUD.cxx
 	src/Instrumentation/HUD/HUD.hxx
 	src/Instrumentation/HUD/HUD_runway.cxx src/Main/Makefile.am
 	src/Main/main.cxx src/Main/renderer.cxx src/Main/renderer.hxx
 	src/Main/viewmgr.cxx src/Model/acmodel.cxx
 	src/Model/acmodel.hxx src/Model/model_panel.cxx
 	src/Model/model_panel.hxx src/Model/modelmgr.cxx
 	src/Model/modelmgr.hxx src/Model/panelnode.cxx
 	src/Model/panelnode.hxx src/Navaids/awynet.cxx
 	src/Scenery/Makefile.am src/Scenery/hitlist.cxx
 	src/Scenery/hitlist.hxx src/Scenery/newcache.cxx
 	src/Scenery/scenery.cxx src/Scenery/scenery.hxx
 	src/Scenery/tileentry.cxx src/Scenery/tileentry.hxx
 	src/Scenery/tilemgr.cxx src/Scripting/NasalSys.cxx
 	src/Scripting/NasalSys.hxx src/Time/light.cxx
	Big BLOB on the way to OSG.
2006-10-29 19:30:21 +00:00
mfranz
5656526d83 as the "Attempting to schedule tiles for bogus lon and lat = (-1000,0)"
bug happens now on a regular basis, and just ignoring it doesn't seem to
cause any harm, just return after it, rather than abort.
2006-08-19 07:30:52 +00:00
frohlich
cdb725528d Clean up scenery center handling. It is set now less often. 2006-07-27 16:36:22 +00:00
frohlich
d11ec8c8e7 Don't bail out for lon == 180 or lat == 90 2006-06-15 08:55:42 +00:00
frohlich
14fe03ba6f Modified Files:
src/AIModel/AIAircraft.cxx src/ATC/AILocalTraffic.cxx
	src/FDM/flight.cxx src/FDM/flight.hxx src/FDM/groundcache.cxx
	src/FDM/groundcache.hxx src/Main/fg_init.cxx src/Main/main.cxx
	src/Scenery/hitlist.cxx src/Scenery/hitlist.hxx
	src/Scenery/scenery.cxx src/Scenery/scenery.hxx
	Make use of the attached SGMaterial reference userdata on scenegraph
	leafs. Make the SGMaterial pointer available to the ground query
	routines.
2006-06-11 13:34:18 +00:00
frohlich
4fde3031eb Make use of the ground material types 2006-06-08 05:58:36 +00:00
mfranz
ec5ea9f344 rename OBJECT_TAXI_SIGN to OBJECT_SIGN. This isn't about taxi signs any
more, but all sorts of signs. Now is the best time to get rid of a
misleading name.
2006-04-14 14:50:11 +00:00
frohlich
292ad8f5af Remove unused variable 2006-03-20 18:16:09 +00:00
mfranz
2796f3f4a5 NasalSys.[ch]xx:
implement FGNasalModelData class for execution of XML <load> and <unload>
  scripts. modelLoaded() is called by the model loader, and the destructor
  on branch removal.

modelmgr.cxx:
tilemgr.cxx:
tileentry.[ch]xx:
  make scenery and custom objects run their Nasal scripts on loading
  and unloading. Let OBJECT_STATIC object not be cached.
2006-03-09 09:04:03 +00:00
mfranz
c9813d1b5d new FSF address 2006-02-21 01:16:04 +00:00
ehofman
a47725e92f Mathias Frhlich:
Make use of the automatic reference counting class for ssg* data in flightgear.
2006-02-08 10:25:56 +00:00
curt
880a43bdbf John Ellson:
Changes require to compile with a Fedora-Core Development system running
on an X86_64 platform with gcc-4.1.0.
2005-12-29 16:22:38 +00:00
ehofman
90a149ffa3 Vassilii Khachaturov:
* in some cases more specific sg exception types were used in place
  of the more generic one, e.g., sg_io_exception instead of sg_exception
  when the context of the error was an IO error
* in some cases, the error message was made more specific
* minor style fix for exception rethrowing --- using throw; whenever
  a re-throw is made; sometimes optimizing away the exception symbol name
  in the catch handler at all
* more specific catch handlers added in some places -- e.g.,
  an sg_io_exception caught ahead of sg_exception
2005-12-11 13:37:06 +00:00
mfranz
72f46a4a6f globals.cxx -- FGGlobals::set_fg_scenery():
Insert empty string as marker between FG_SCENERY path elements.
    FG_SCENERY=A:B expands to [A/Terrain, A/Objects, "", B/Terrain, B/Objects, ""]
    (assuming that both A/ and B/ have Terrain/ and Objects/ subdirs).

tileentry.cxx -- FGTileEntry::load():
    Check all tile dirs in FG_SCENERY from left to right: add all objects
    to the scenery until a terrain tile was found: In this case read the
    rest of that group (i.e. the Objects/ twin dir) and then stop scanning.

    Better structuring of log messages & fix warnings.
2005-12-03 10:20:35 +00:00
mfranz
00e0546cab FGTileEntry::load(): store objects in a vector, then generate terrain or
sea tile, and finally process the objects. This guarantees that all objects
are placed relative to a valid tile center, rather than to the origin (0/0/0).
This is important for objects in sea tiles, and allows to display objects
of *.stg files that came sooner in FG_SCENERY.
2005-12-02 21:46:33 +00:00
curt
e807c7f95c A long, long time ago, a bug was inadvertently introduced into the threaded
metar fetcher.  Effectively this caused the metar thread and the main
thread to both attempt to fetch weather data.  This could lead to long pauses
when the main thread decided to fetch the weather, and introduced a race
condition that could cause a segfault/crash.

Investigating this issue, I discovered that even longer ago, someone confused
#defines and #ifdef symbols with C/C++ variables.  If I #define XYZ 0 it is
defined so #ifdef XYZ is true, not false like a variable.  Our thread
detection made this mistake and there were follow up patches to work around
it.

So I fixed the configure script (ahhh, reading the autoconf manual is highly
recommended excercise for people editing the configure.ac file.)  I also
discovered that we were hardwiring with_threads=yes with no way via configure
options to disable threads from the build so I fixed that.

Then I patched up the #ifdef's scattered through the code to match the
configure script changes, oh and by the way, I stumbled upon a past typo
that led to the race condition in the metar fetching thread and fixed that.
2005-11-22 17:02:31 +00:00
curt
b06049219e Mathias Fröhlich:
Take any arbitrary vector (not necessarily vertical) and intersect it with
the current set of loaded terrain tiles.  Returns lon, lat, elev.  This
could have a multitude of useful applications such as testing line of sight
between two objects, faking a terrain following lookahead radar system,
virtual georeferencing, etc.
2005-11-09 17:08:04 +00:00
ehofman
b24dbb3f8b Alex Romosan:
I tried to make sure accessor functions which return by reference act
on const objects. also replaced some iterators with const_iterator
and a few return/pass by reference that were missed the first time
around.
2005-10-26 09:03:49 +00:00
ehofman
62a359cc4a Alex Romosan:
* Use "const string&" rather than "string" in function calls when appropriate.
* Use "const Point3D&" instead of "Pint3D" in function calls when appropriate.
* Improved course calculation in calc_gc_course_dist()
* Safer thread handling code.

Vassilii Khachaturov:

Dont use "const Point3D&" for return types unless you're absolutely sure.

Erik Hofman:

* Use SGD_(2)PI(_[24]) as defined in simgear/constants.h rather than
  calculating it by hand every time.
2005-10-25 13:49:55 +00:00
ehofman
2631cf9cc5 Ladislav Michnovic:
Using new gcc 4.0 I have some serios warnings about uninitialized
variables, that are used. I created a patch, but I have no idea if it
is possible to do it my way. Can you check this out please?


Erik: I've modified the patch slightly based on the contents of an older
      version of hitlist.cxx. I think this is correct now.
2005-10-16 09:05:40 +00:00
ehofman
54a33c3899 Mathias Frhlich:
I had a quick view over the ssgBase::ref() calls in flightgear.
I made them all symmetric and used ssgDeRefDelete to dereference them.
This has the basic advantage that ssgDeRefDelete additionaly deletes the
memory instead of just decrementing the reference cound without deletion ...

This includes an incorrect deref instead of a ssgDeRefDelete in the placement
transform registration I introduced earlier. I believe that this causes the
problems with long flights (unverified, but with a big propability).
2005-10-15 14:51:52 +00:00
ehofman
dafa6ced1b Mathias Frhlich:
I have done a valgrind run in flightgear. Just start it up and close it at the
fist change I had about half an hour later.

source-leak.diff:
   Also two minor ones, but leaks ...
2005-10-14 16:25:14 +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
ehofman
7b824755ee Mathias Frhlich:
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.
2005-08-14 12:57:12 +00:00
ehofman
83b414482f Harald JOHNSEN:
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 ;
2005-07-31 09:04:18 +00:00
ehofman
f2cf76171f 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.


known bugs
==========
- ghost objects
2005-06-26 17:21:18 +00:00
ehofman
557a879483 Mathias Frhlich:
this is basically the past patch I sent to the list and which should now
really (...!?!?) fix the no ground below aircraft problem.
Reasons:
I understood my remaining thinko I introduced with the prevous patch, and the
same thinko I made in my test cases.
The feedback from the list told me that it should help.
2005-06-02 08:51:47 +00:00
ehofman
807d2cc3ca Mathias Frhlich:
2.
I made YASim query the the ground cache at the wrong place. This one fixed
this, one can now land the bo105 on top of the oracle buildings  :)

3.
Is a followup of the scenery center update code: Register the scenery center
transform at the time it is put into the scene graph not at creation time.

4.
I held that part back from the past hitlist patch, because I hoped that it
will be sufficient (and the last one was in fact the biggest part) without.
As some test cases from Melchior showed me, it is not. We have additionally
to the wrong computed transform from the prevous patch some roundoff
problems. This patch adds some small tolerance to for the point in triangle
test.
... may be one even needs to increase the eps value further if starting at
some tile boundaries still fails.

5.
That is a big chunk.
Tested now for two days while hunting the second patch  :) .
That is a partial rewrite of the groundcache to use its own datastructures for
that flat scenegraph in the cache. The basic advantage is, what Erik
suggested, to precompute some often used values of these triangles. Also
allmost all computations are now in double precision which should decrease
(hopefully fix), together with a similar tolerance for some point in triangle
tests, the problems with 'no ground below aircraft'.
I am playing with octrees for the groundcache, that will finally solve the
performance problem when high triangular count models end up in the
groundcache. This patch is also some prework for those octrees ...
2005-05-30 08:48:27 +00:00
ehofman
b71b3af66c A patch from Mathias to fix the startup at a tile boundry problem. 2005-05-26 08:13:06 +00:00
mfranz
61b5efb772 The "catching up on tile delete queue" doesn't justify an ALERT message.
It happens regularly during normal operation (ufo!) and only informs about
unfortunate, but known and deliberate behavior. The user can't do anything
about it, anyway. And finally: flooding the console with this message does
only *add* to fgfs' sluggish performance and makes every other message
go unnoticed.
2005-05-22 17:14:15 +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
40170cb722 The view frustum is defined in plib apps using calls to ssgSetFOV() and
ssgSetNearFar().  This by default creates a symmetric view frustum which is
typically what an application wants.

However, to get control of the view frustum in order to build support for
asymmetric view frustums, we need to wrap these calls with a bit of our own
logic.

This set of changes wraps all calls to ssgSetFOV() and ssgSetNearFar() with
FGRenderer methods.

I also standardized how the FGRenderer class is handled in globals.[ch]xx.
This led to some cascading changes in a variety of source files.

As I was working my way through the changes, I fixed a few warnings along
the way.
2005-02-25 19:41:53 +00:00
curt
dd2ea8f77d Throw an exception when no valid scenery path defined. 2005-01-17 22:10:53 +00:00
ehofman
38d327ba24 Tie the Scenery loader thread and the real weather fetching thread to CPU1 (if supported). 2005-01-09 10:27:01 +00:00
ehofman
ac27ead4a6 Melchior FRANZ:
The attached patch allows to put comments in *.stg files[1]. Lines with
# in the first column (and only there!) are skipped. This has no effect
on overall performance, but has two advantages:

A) possibility to temporarily comment out objects during scenery design,
   (or to put other remarks there);

B) possibility to put marks like "# BEGIN" and "# END" there that allow
   automated merging of local landmarks etc.

--

[1] actually, comments are possible now, too. But they aren't explicitly
    handled and fgfs tries to parse words in "comments" piece by piece. Ugly!

[2] Idea by Chris METZLER, that I make already use of. I have a local
    scenery dir for some tiles with extra objects, such as VOR/DME for
    all of Austria. These are surrounded by "# BEGIN LOCAL" and "# END LOCAL",
    and today I was able to merge the new 0.9.7 scenery with my locally
    changed files.   :-)
2004-12-08 14:45:47 +00:00
ehofman
7159e318e1 Mathias Frhlich:
I have now split out the ground cache functions into src/FDM/groundcache.[ch]xx
Attached are the two files and the patch to integrate that cache into
FGInterface.

The code is nowhere used at the moment, the fdm's need to be updated to use
that ground cache. The JSBSim-dropin.tar.gz from Martins ftp server does this
for example.

The carrier's scenegraph is not yet processed to be visible for ground
intersection testing. So the only benefit up to now is that the api is set
up. Using this I can put the changes to make JSBSim work with that into
JSBSim's cvs. Also I aim to provide Andy a patch to make use of that with
YASim.
2004-11-22 10:10:33 +00:00
curt
d05121ef46 Fix my mailing address by replacing it with my web page. 2004-11-19 22:10:41 +00:00
ehofman
7f6466d6f1 Frederic Bouvier:
This is a patch to make display list usage optional. They are on by default.
Use --prop:/sim/rendering/use-display-list=false to use immediate mode.
There is also a change in exception handling in main.cxx and bootstrap.cxx
2004-10-17 17:23:19 +00:00
ehofman
c0c394c188 PLIB_VERSION is localted in plib/ul.h 2004-10-10 19:19:23 +00:00
ehofman
b7afe856c3 Check for the plib version when using display lists, just to be sure. 2004-10-10 19:06:32 +00:00
ehofman
f61014c2ea Frederic: Add display list support without changing plib. 2004-10-10 17:41:11 +00:00
ehofman
986492d72d Finish what was committed in a broken state yesterday.
Split up main.cxx into a program manegement part (which remains in
main.cxx) and a render part (the new renderer.?xx files). Also turn
the renderer into a small class of it's own. At this time not really
exctining because most of the stuff is still global, but it allows us
to slowly migrate some of the global definitions into the new class.

The FGRenderer class is now managed by globals, so to get the renderer
just call gloabals->get_renderer()

At some pijt it might be a good idea to also turn the remaining code in
main into a class of it's own. With a bit of luck we end up with a more
robust, and better maintainable code.
2004-09-20 13:21:51 +00:00
ehofman
3b3600fd21 Make it compile, link and run again (pfew\!) 2004-09-19 18:34:47 +00:00
ehofman
de47d1a7d8 Revert to CVS as of 5000 seconds ago. 2004-09-19 17:59:40 +00:00
ehofman
409dee5a9d Remove unnecessary inclusions of sg.h ans ssg.h 2004-09-19 16:33:38 +00:00
curt
cc3d0221ea Make a subtle change to tile loading/unloading policy in order to make the tile
paging system much more robust when position change is very rapid and sporadic.

Recall that we must load 3d models in the main render thread because model
loading can trigger opengl calls (i.e. with texture loading) and all opengl
calls *must* happen in the main render thread.

To accomplish this we load the base tile in the pager thread and build a work
queue of external models that need to be loaded.  We never allow a tile to be
paged out of the tile cache until all it's pending model loads are complete.

However, when changing position very rapidly, we can quickly create a huge
backlog of pending model loads because we are changing positions faster than we
can load the associated models for the existing tiles.  The end result is
that tiles that are long out of range can't be removed because there is still
a huge backlog of pending model load requests and memory blows up.

This change being committed allows the tile paging system to remove tiles
if they are out of range, even when there are pending models to load.  The
model loading code in the render thread can now check to see if the tile
exists and discard any model load request for tiles that no longer exist.

This situation should never occur in normal operation, but could occur in
"contrived" situations where an external script was rapidly changing
the simulator position to then be able to query FG terrain height, and doing
this for a large number of points that are distributed across a large area.
2004-09-15 15:52:05 +00:00
ehofman
9d972d86bf Jim Wilson: This patch prevents FDM execution until intial scenery load completes making
midair starts in the KSFO area possible again.
2004-07-22 16:42:14 +00:00
ehofman
56f085b6f1 Melchior FRANZ:
Remove an unused test, counter_hack is initialized to 0 and the test never reaches the increment section but instead will always call loader.update();
2004-06-13 18:47:55 +00:00
ehofman
ff9258528c Melchior FRANZ:
Wouldn't it be better to prepare the whole list of paths (or two
separate ones for Terrain/Objects if necessary) in FGGlobals::set_fg_scenery,
and to pass the vector<string>s to FGTileEntry::load? It doesn't seem to make
a lot of sense to split the path up, modify it, mount it together to one string
again, and then let FGTileEntry::load split it up again.

Here we go:

Main/globals.cxx
================
As fg_scenery is now a string_list, we don't need initialization. Furthermore,
this list is cleared with every set_fg_scenery() call.

ctor: create default dir from fg_root if necessary. Otherwise check all paths
of --fg-scenery/FG_SCENERY: If the path doesn't exist, ignore it. If it contains
a dir Terrain and/or Objects, then only add that to the list. If it contains
neither, then use the path as is.


Scenery/tileentry.cxx
=====================
Trivial: don't split a "base path", but use the given path_list as is.
(I considered a variable name "path_list" better suited than "search".)


Scenery/FGTileLoader.cxx
========================
No more fiddling with sub-paths. This has to be delivered by get_fg_scenery
already.
2004-06-08 15:32:09 +00:00
ehofman
079890e955 Make use of the new SGPath::add() function and automatically append 'Terren' and 'Objects' the the scenery path when one or both of those subdirectories exsist. 2004-06-07 09:52:11 +00:00
ehofman
1bdcbd69f3 Windows uses ';' instead of ':' as a path separator. 2004-06-06 19:34:31 +00:00
ehofman
372920236f Make it possible to split the Scenery into Scenery/Terrain and Scenery/Objects in preparation for the next scenery release. 2004-06-06 19:15:04 +00:00
andy
7ceb85d454 Changes to get FlightGear (well, the src directory at least) to
configure and compile out-of-the-box on a MinGW target:

Use -lSDL instead of -lglut32 on windows builds when --enable-sdl
is set.

Link against alut.dll in addition to openal32.dll.

Replace BSD bcopy() with ANSI C memmove() in a few places.  This is
simpler than trying to abstract it out as a platform dependency in a
header file; bcopy() has never been standard.

The ENABLE_THREADS handling has changed to be set to 0 when threads
are not in use.  This breaks expressions like #ifdef ENABLE_THREADS.
Replace with a slightly more complicated expression.  It might have
been better to fix the configure.ac script, but I didn't know how and
this whole setting is likely to go away soon anyway.

The MinGW C runtime actually does include snprintf, so only MSVC
builds (and not all WIN32 ones) need _snprintf in JSBSim/FGState.cpp

Building on a platform with no glut at all exposed some spots where
plib/pu.h was being included without a toolkit setting (it defaults to
glut).  Include fg_os.hxx first.

And when still using glut, glut.h has a bizarre dependency on a
_WCHAR_T_DEFINED symbol.  It it's not defined, it tries to redefine
(!!) wchar_t to disasterous effect.
2004-04-30 00:52:11 +00:00
ehofman
7902c04905 Plib is willing callbacks to return 0, 1 or 2 and not simply a boolean 2004-04-02 19:49:51 +00:00