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)),
|
||||
alt_node(fgGetNode("/position/altitude-ft", true)),
|
||||
need_update(true),
|
||||
nav1_freq(0.0),
|
||||
nav1_alt_freq(0.0),
|
||||
nav1_radial(0.0),
|
||||
nav2_freq(0.0),
|
||||
nav2_alt_freq(0.0),
|
||||
nav2_radial(0.0),
|
||||
dme_freq(0.0),
|
||||
dme_dist(0.0),
|
||||
dme_prev_dist(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 term = path;
|
||||
|
|
|
@ -113,8 +113,8 @@
|
|||
// Should already be inlcluded by gl.h if needed by your platform so
|
||||
// we shouldn't include this here.
|
||||
// #include <GL/glext.h>
|
||||
PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT = 0;
|
||||
PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT = 0;
|
||||
// PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT = 0;
|
||||
// PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT = 0;
|
||||
float default_attenuation[3] = {1.0, 0.0, 0.0};
|
||||
//Required for using GL_extensions
|
||||
void fgLoadDCS (void);
|
||||
|
@ -1866,6 +1866,12 @@ int mainLoop( int argc, char **argv ) {
|
|||
|
||||
// Main entry point; catch any exceptions that have made it this far.
|
||||
int main ( int argc, char **argv ) {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Christian, we should document what this does
|
||||
_control87( _EM_INEXACT, _MCW_EM );
|
||||
#endif
|
||||
|
||||
// FIXME: add other, more specific
|
||||
// exceptions.
|
||||
try {
|
||||
|
@ -1876,6 +1882,8 @@ int main ( int argc, char **argv ) {
|
|||
<< "\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() );
|
||||
} else {
|
||||
while ( ! in1.eof() ) {
|
||||
in1 >> skipws;
|
||||
in1 >> ::skipws;
|
||||
if ( in1.get( c ) && c == '#' ) {
|
||||
in1 >> skipeol;
|
||||
} else {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#endif
|
||||
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
#include <simgear/constants.h>
|
||||
|
||||
#include "viewer.hxx"
|
||||
|
||||
|
@ -40,6 +41,10 @@ FGViewer::FGViewer( void ):
|
|||
goal_view_offset(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 )
|
||||
{
|
||||
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
|
||||
>> i.gselev >> i.gsangle >> i.gslat >> i.gslon
|
||||
>> i.dmelat >> i.dmelon
|
||||
|
|
|
@ -111,7 +111,12 @@ operator >> ( istream& in, FGNav& n )
|
|||
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;
|
||||
|
||||
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[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;
|
||||
sgdMakePlane( plane, tri[0], tri[1], tri[2] );
|
||||
|
||||
|
|
Loading…
Reference in a new issue