Various floating point / initial value bug fixes from Christian Mayer.
This commit is contained in:
parent
2653a8dc7e
commit
2fbab0d702
6 changed files with 52 additions and 16 deletions
|
@ -83,13 +83,19 @@ FGRadioStack::FGRadioStack() :
|
||||||
lat_node(fgGetNode("/position/latitude-deg", true)),
|
lat_node(fgGetNode("/position/latitude-deg", true)),
|
||||||
alt_node(fgGetNode("/position/altitude-ft", true)),
|
alt_node(fgGetNode("/position/altitude-ft", true)),
|
||||||
need_update(true),
|
need_update(true),
|
||||||
|
nav1_freq(0.0),
|
||||||
|
nav1_alt_freq(0.0),
|
||||||
nav1_radial(0.0),
|
nav1_radial(0.0),
|
||||||
|
nav2_freq(0.0),
|
||||||
|
nav2_alt_freq(0.0),
|
||||||
nav2_radial(0.0),
|
nav2_radial(0.0),
|
||||||
dme_freq(0.0),
|
dme_freq(0.0),
|
||||||
dme_dist(0.0),
|
dme_dist(0.0),
|
||||||
dme_prev_dist(0.0),
|
dme_prev_dist(0.0),
|
||||||
dme_spd(0.0),
|
dme_spd(0.0),
|
||||||
dme_ete(0.0)
|
dme_ete(0.0),
|
||||||
|
adf_freq(0.0),
|
||||||
|
adf_alt_freq(0.0)
|
||||||
{
|
{
|
||||||
SGPath path( globals->get_fg_root() );
|
SGPath path( globals->get_fg_root() );
|
||||||
SGPath term = path;
|
SGPath term = path;
|
||||||
|
|
|
@ -113,8 +113,8 @@
|
||||||
// Should already be inlcluded by gl.h if needed by your platform so
|
// Should already be inlcluded by gl.h if needed by your platform so
|
||||||
// we shouldn't include this here.
|
// we shouldn't include this here.
|
||||||
// #include <GL/glext.h>
|
// #include <GL/glext.h>
|
||||||
PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT = 0;
|
// PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT = 0;
|
||||||
PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT = 0;
|
// PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT = 0;
|
||||||
float default_attenuation[3] = {1.0, 0.0, 0.0};
|
float default_attenuation[3] = {1.0, 0.0, 0.0};
|
||||||
//Required for using GL_extensions
|
//Required for using GL_extensions
|
||||||
void fgLoadDCS (void);
|
void fgLoadDCS (void);
|
||||||
|
@ -1866,16 +1866,24 @@ int mainLoop( int argc, char **argv ) {
|
||||||
|
|
||||||
// Main entry point; catch any exceptions that have made it this far.
|
// Main entry point; catch any exceptions that have made it this far.
|
||||||
int main ( int argc, char **argv ) {
|
int main ( int argc, char **argv ) {
|
||||||
// FIXME: add other, more specific
|
|
||||||
// exceptions.
|
#ifdef _MSC_VER
|
||||||
try {
|
// Christian, we should document what this does
|
||||||
mainLoop(argc, argv);
|
_control87( _EM_INEXACT, _MCW_EM );
|
||||||
} catch (sg_throwable &t) {
|
#endif
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT,
|
|
||||||
"Fatal error: " << t.getFormattedMessage()
|
// FIXME: add other, more specific
|
||||||
<< "\n (received from " << t.getOrigin() << ')');
|
// exceptions.
|
||||||
exit(1);
|
try {
|
||||||
}
|
mainLoop(argc, argv);
|
||||||
|
} catch (sg_throwable &t) {
|
||||||
|
SG_LOG(SG_GENERAL, SG_ALERT,
|
||||||
|
"Fatal error: " << t.getFormattedMessage()
|
||||||
|
<< "\n (received from " << t.getOrigin() << ')');
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1966,7 +1974,7 @@ void fgLoadDCS(void) {
|
||||||
SG_LOG( SG_TERRAIN, SG_ALERT, "Cannot open file: " << modelpath.str() );
|
SG_LOG( SG_TERRAIN, SG_ALERT, "Cannot open file: " << modelpath.str() );
|
||||||
} else {
|
} else {
|
||||||
while ( ! in1.eof() ) {
|
while ( ! in1.eof() ) {
|
||||||
in1 >> skipws;
|
in1 >> ::skipws;
|
||||||
if ( in1.get( c ) && c == '#' ) {
|
if ( in1.get( c ) && c == '#' ) {
|
||||||
in1 >> skipeol;
|
in1 >> skipeol;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
#include <simgear/constants.h>
|
||||||
|
|
||||||
#include "viewer.hxx"
|
#include "viewer.hxx"
|
||||||
|
|
||||||
|
@ -40,6 +41,10 @@ FGViewer::FGViewer( void ):
|
||||||
goal_view_offset(0.0)
|
goal_view_offset(0.0)
|
||||||
{
|
{
|
||||||
sgSetVec3( pilot_offset, 0.0, 0.0, 0.0 );
|
sgSetVec3( pilot_offset, 0.0, 0.0, 0.0 );
|
||||||
|
sgdZeroVec3(geod_view_pos);
|
||||||
|
sgdZeroVec3(abs_view_pos);
|
||||||
|
sea_level_radius = SG_EQUATORIAL_RADIUS_M;
|
||||||
|
//a reasonable guess for init, so that the math doesn't blow up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,12 @@ inline istream&
|
||||||
operator >> ( istream& in, FGILS& i )
|
operator >> ( istream& in, FGILS& i )
|
||||||
{
|
{
|
||||||
double f;
|
double f;
|
||||||
in >> i.ilstype >> i.ilstypename >> i.aptcode >> i.rwyno
|
in >> i.ilstype;
|
||||||
|
|
||||||
|
if ( i.ilstype == '[' )
|
||||||
|
return in;
|
||||||
|
|
||||||
|
in >> i.ilstypename >> i.aptcode >> i.rwyno
|
||||||
>> f >> i.locident >> i.locheading >> i.loclat >> i.loclon
|
>> f >> i.locident >> i.locheading >> i.loclat >> i.loclon
|
||||||
>> i.gselev >> i.gsangle >> i.gslat >> i.gslon
|
>> i.gselev >> i.gsangle >> i.gslat >> i.gslon
|
||||||
>> i.dmelat >> i.dmelon
|
>> i.dmelat >> i.dmelon
|
||||||
|
|
|
@ -111,7 +111,12 @@ operator >> ( istream& in, FGNav& n )
|
||||||
first_time = false;
|
first_time = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
in >> n.type >> n.lat >> n.lon >> n.elev >> f >> n.range
|
in >> n.type;
|
||||||
|
|
||||||
|
if ( n.type == '[' )
|
||||||
|
return in >> skipeol;
|
||||||
|
|
||||||
|
in >> n.lat >> n.lon >> n.elev >> f >> n.range
|
||||||
>> c >> n.ident >> magvar_s;
|
>> c >> n.ident >> magvar_s;
|
||||||
|
|
||||||
n.freq = (int)(f*100.0 + 0.5);
|
n.freq = (int)(f*100.0 + 0.5);
|
||||||
|
|
|
@ -199,6 +199,13 @@ int FGHitList::IntersectLeaf( ssgLeaf *leaf, sgdMat4 m,
|
||||||
sgdXformPnt3( tri[1], leaf->getVertex( i2 ), m );
|
sgdXformPnt3( tri[1], leaf->getVertex( i2 ), m );
|
||||||
sgdXformPnt3( tri[2], leaf->getVertex( i3 ), m );
|
sgdXformPnt3( tri[2], leaf->getVertex( i3 ), m );
|
||||||
|
|
||||||
|
//avoid division by zero when two points are the same
|
||||||
|
if ( sgdEqualVec3(tri[0], tri[1]) ||
|
||||||
|
sgdEqualVec3(tri[1], tri[2]) ||
|
||||||
|
sgdEqualVec3(tri[2], tri[0]) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
sgdVec4 plane;
|
sgdVec4 plane;
|
||||||
sgdMakePlane( plane, tri[0], tri[1], tri[2] );
|
sgdMakePlane( plane, tri[0], tri[1], tri[2] );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue