1
0
Fork 0
flightgear/src/FDM/groundcache.hxx

161 lines
5.5 KiB
C++
Raw Normal View History

// groundcache.hxx -- carries a small subset of the scenegraph near the vehicle
//
// Written by Mathias Froehlich, started Nov 2004.
//
// Copyright (C) 2004 Mathias Froehlich - Mathias.Froehlich@web.de
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
2006-02-21 01:16:04 +00:00
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#ifndef _GROUNDCACHE_HXX
#define _GROUNDCACHE_HXX
#include <osg/Node>
namespace osgUtil
{
class PolytopeIntersector;
}
#include <simgear/compiler.h>
#include <simgear/constants.h>
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
#include <simgear/math/SGMath.hxx>
#include <simgear/math/SGGeometry.hxx>
class SGMaterial;
class WireIntersector;
class FGGroundCache {
public:
FGGroundCache();
~FGGroundCache();
//////////////////////////////////////////////////////////////////////////
// Ground handling routines
//////////////////////////////////////////////////////////////////////////
// Prepare the ground cache for the wgs84 position pt_*.
// That is take all vertices in the ball with radius rad around the
// position given by the pt_* and store them in a local scene graph.
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
bool prepare_ground_cache(double ref_time, const SGVec3d& pt,
double rad);
// Returns true if the cache is valid.
// Also the reference time, point and radius values where the cache
// is valid for are returned.
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
bool is_valid(double& ref_time, SGVec3d& pt, double& rad);
// Return the nearest catapult to the given point
// pt in wgs84 coordinates.
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
double get_cat(double t, const SGVec3d& pt,
SGVec3d end[2], SGVec3d vel[2]);
// Return the altitude above ground below the wgs84 point pt
Mathias Fröhlich: I have introduced the posibility to start directly on the carrier. With that patch you will have a --carrrier=id argument where id can either be the pennant number configured in the nimitz scenario or the carriers name also configured in the carriers scenario. Additionaly you can use --parkpos=id to select different positions on the carrier. They are also configured in the scenario file. That includes the switch of the whole FGInterface class to make use of the groundcache. That means that an aircraft no longer uses the current elevation value from the scenery class. It rather has its own local cache of the aircrafts environment which is setup in the common_init method of FGInterface and updated either manually by calling FGInterface::get_groundlevel_m(lat, lon, alt_m); or implicitly by calling the above method in the FGInterface::_updateGeo*Position(lat, lon, alt); methods. A call get_groundlevel_m rebuilds the groundcache if the request is outside the range of the cache. Note that for the real usage of the groundcache including the correct information about the movement of objects and the velocity information, you still need to set up the groundcache in the usual way like YASim and JSBSim currently does. If you use the native interface, you will get only static objects correctly. But for FDM's only using one single ground level for a whole step this is IMO sufficient. The AIManager gets a way to return the location of a object which is placed wrt an AI Object. At the moment it only honours AICarriers for that. That method is a static one, which loads the scenario file for that reason and throws it away afterwards. This looked like the aprioriate way, because the AIManager is initialized much later in flightgears bootstrap, and I did not find an easy way to reorder that for my needs. Since this additional load is very small and does only happen if such a relative location is required, I think that this is ok. Note that moving on the carrier will only work correctly for JSBSim and YASim, but you should now be able to start and move on every not itself moving object with any FDM.
2005-07-03 09:39:14 +00:00
// Search for highest triangle not higher than pt + max_altoff.
// Return ground properties like the ground type, the maximum load
// this kind kind of ground can carry, the friction factor between
// 0 and 1 which can be used to model lower friction with wet runways
// and finally the altitude above ground.
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
bool get_agl(double t, const SGVec3d& pt, double max_altoff,
SGVec3d& contact, SGVec3d& normal, SGVec3d& vel,
int *type, const SGMaterial** material, double *agl);
// Return 1 if the hook intersects with a wire.
// That test is done by checking if the quad spanned by the points pt*
// intersects with the line representing the wire.
// If the wire is caught, the cache will trace this wires endpoints until
// the FDM calls release_wire().
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
bool caught_wire(double t, const SGVec3d pt[4]);
// Return the location and speed of the wire endpoints.
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
bool get_wire_ends(double t, SGVec3d end[2], SGVec3d vel[2]);
// Tell the cache code that it does no longer need to care for
// the wire end position.
void release_wire(void);
private:
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
friend class GroundCacheFillVisitor;
// Helper class to hold some properties of the ground triangle.
struct GroundProperty {
GroundProperty() : type(0), wire_id(0), material(0) {}
int type;
int wire_id;
// The linear and angular velocity.
SGVec3d vel;
SGVec3d rot;
SGVec3d pivot;
// the simgear material reference, contains friction coeficients ...
const SGMaterial* material;
};
Mathias Fröhlich: 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
struct Triangle {
GroundProperty gp;
// The triangle we represent
SGTriangled triangle;
SGSphered sphere;
Mathias Fröhlich: 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
};
struct Catapult {
GroundProperty gp;
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
SGVec3d start;
SGVec3d end;
Mathias Fröhlich: 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
};
struct Wire {
GroundProperty gp;
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
SGVec3d ends[2];
Mathias Fröhlich: 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
};
// Approximate ground radius.
// In case the aircraft is too high above ground.
double ground_radius;
// Ground type
int _type;
// the simgear material reference, contains friction coeficients ...
const SGMaterial* _material;
// The time reference for later call to intersection test routines.
// Is required since we will have moving triangles in carriers.
double cache_ref_time;
// The wire identifier to track.
int wire_id;
Mathias Fröhlich: 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
// Containers which hold all the essential information about this cache.
std::vector<Triangle> triangles;
std::vector<Catapult> catapults;
std::vector<Wire> wires;
// The point and radius where the cache is built around.
// That are the arguments that were given to prepare_ground_cache.
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
SGVec3d reference_wgs84_point;
double reference_vehicle_radius;
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
SGVec3d down;
bool found_ground;
void getGroundProperty(osg::Drawable* drawable,
const osg::NodePath& nodePath,
GroundProperty& gp, bool& backfaceCulling);
static void velocityTransformTriangle(double dt, SGTriangled& dst,
SGSphered& sdst, const Triangle& src);
void getTriIntersectorResults(osgUtil::PolytopeIntersector* triInt);
void getWireIntersectorResults(WireIntersector* wireInt,
double wireCacheRadius);
};
#endif