/* static GLint scenery, runway; */
/* Another hack */
-double fogDensity = 80.0; /* in meters = about 70 miles */
+double fogDensity = 60.0; /* in meters = about 70 miles */
double view_offset = 0.0;
double goal_view_offset = 0.0;
printf("Ground elevation is about %.2f meters here.\n", rough_elev);
/* FG_Runway_altitude = rough_elev * METER_TO_FEET; */
- if ( FG_Altitude < FG_Runway_altitude ) {
- FG_Altitude = FG_Runway_altitude + 3.758099;
+ if ( FG_Altitude * FEET_TO_METER < rough_elev ) {
+ /* set this here, otherwise if we set runway height above our
+ current height we get a really nasty bounce. */
+ FG_Runway_altitude = FG_Altitude - 3.758099;
+
+ /* now set aircraft altitude above ground */
+ FG_Altitude = rough_elev * METER_TO_FEET + 3.758099;
+ printf("<*> reseting altitude to %.0f meters\n",
+ FG_Altitude * FEET_TO_METER);
}
}
/* $Log$
-/* Revision 1.28 1997/07/08 18:20:12 curt
-/* Working on establishing a hard ground.
+/* Revision 1.29 1997/07/09 21:31:12 curt
+/* Working on making the ground "hard."
/*
+ * Revision 1.28 1997/07/08 18:20:12 curt
+ * Working on establishing a hard ground.
+ *
* Revision 1.27 1997/07/07 20:59:49 curt
* Working on scenery transformations to enable us to fly fluidly over the
* poles with no discontinuity/distortion in scenery.
z21 = 0.001 * m->mesh_data[(j+jstep) * m->rows + i ];
z22 = 0.001 * m->mesh_data[(j+jstep) * m->rows + (i+istep)];
- v1[0] = p21.y - p11.y; v1[1] = p21.z - p11.z; v1[2] = z21 - z11;
+ v1[0] = p22.y - p11.y; v1[1] = p22.z - p11.z; v1[2] = z22 - z11;
v2[0] = p12.y - p11.y; v2[1] = p12.z - p11.z; v2[2] = z12 - z11;
MAT3cross_product(normal, v1, v2);
MAT3_NORMALIZE_VEC(normal,temp);
glVertex3d(p12.y, p12.z, z12);
}
- glVertex3d(p21.y, p21.z, z21);
-
- v1[0] = p21.y - p12.y; v1[1] = p21.z - p12.z; v1[2] = z21 - z12;
- v2[0] = p22.y - p12.y; v2[1] = p22.z - p12.z; v2[2] = z22 - z12;
- MAT3cross_product(normal, v1, v2);
+ glVertex3d(p22.y, p22.z, z22);
+
+ v2[0] = p21.y - p11.y; v2[1] = p21.z - p11.z; v2[2] = z21 - z11;
+ MAT3cross_product(normal, v2, v1);
MAT3_NORMALIZE_VEC(normal,temp);
glNormal3d(normal[0], normal[1], normal[2]);
/* printf("normal 2 = (%.2f %.2f %.2f\n", normal[0], normal[1],
normal[2]); */
- glVertex3d(p22.y, p22.z, z22);
+ glVertex3d(p21.y, p21.z, z21);
x1 = x2;
x2 = x1 + (m->row_step * jstep);
/* $Log$
-/* Revision 1.26 1997/07/08 18:20:13 curt
-/* Working on establishing a hard ground.
+/* Revision 1.27 1997/07/09 21:31:13 curt
+/* Working on making the ground "hard."
/*
+ * Revision 1.26 1997/07/08 18:20:13 curt
+ * Working on establishing a hard ground.
+ *
* Revision 1.25 1997/07/07 20:59:50 curt
* Working on scenery transformations to enable us to fly fluidly over the
* poles with no discontinuity/distortion in scenery.
/* return the current altitude based on mesh data. We should rewrite
* this to interpolate exact values, but for now this is good enough */
double mesh_altitude(double lon, double lat) {
- /* we expect things in arcsec for now */
+ /* we expect incoming (lon,lat) to be in arcsec for now */
double xoffset, yoffset;
int xindex, yindex;
+ /* determine if we are in the lower triangle or the upper triangle
+ ______
+ | /|
+ | / |
+ | / |
+ |/ |
+ ------
+ */
+
xoffset = lon - eg.originx;
yoffset = lat - eg.originy;
xindex = xoffset / eg.col_step;
yindex = yoffset / eg.row_step;
+ if ( xindex > yindex ) {
+ }
if ( (xindex >= 0) && (xindex < eg.cols) ) {
if ( (yindex >= 0) && (yindex < eg.rows) ) {
return( eg.mesh_data[xindex * eg.rows + yindex] );
}
}
+
+ /*
+ given (x1, y1, z1) (x2, y2, z2) and (x3, y3, z3)
+ calculate z = ax + by + c (the equation of the plane intersecting the
+ three given points
+
+ Then, given a position we can calculate the current ground elevation
+
+ tmp1 = (x2 * z1 / x1 - z2);
+ tmp2 = (y2 - x2 * y1 / x1);
+ tmp3 = (x2 * y1 / x1 - y2);
+ tmp4 = (1 - x2 / x1);
+ tmp5 = (x3*(z1 + y1*tmp1 / tmp2) / x1 - z3 + y3*tmp1 / tmp3);
+ tmp6 = x3*(y1*tmp4 / tmp2 - 1);
+ tmp7 = tmp5 / (y3*tmp4 / tmp2 - tmp6 / x1 - 1);
+ tmp8 = (tmp6 / x1 + y3*tmp4 / tmp3 + 1);
+ tmp9 = (z1 + tmp5 / tmp8);
+ tmp10 = (tmp7 + x2*tmp9 / x1 - z2);
+
+ a = (tmp9 + y1*tmp10 / tmp2) / x1;
+
+ b = tmp10 / tmp3;
+
+ c = tmp7;
+ */
+
}
/* $Log$
-/* Revision 1.7 1997/07/08 18:20:13 curt
-/* Working on establishing a hard ground.
+/* Revision 1.8 1997/07/09 21:31:15 curt
+/* Working on making the ground "hard."
/*
+ * Revision 1.7 1997/07/08 18:20:13 curt
+ * Working on establishing a hard ground.
+ *
* Revision 1.6 1997/06/29 21:16:49 curt
* More twiddling with the Scenery Management system.
*
# much smoother.
#---------------------------------------------------------------------------
-# FG_CFLAGS = -g -Wall -DUSE_ITIMER
-FG_CFLAGS = -g -Wall
+FG_CFLAGS = -g -Wall
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
-# SGI IRIX with the GLUT toolkit
+# SGI IRIX with the GLUT toolkit (surprisingly, this also works on our
+# SunOS 4.x machine with the way we have
+# Mesa & Glut installed.)
#
# INTERFACE_FLAGS = -DGLUT
# INTERFACE_LIBS = -lglut
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.3 1997/07/09 21:31:08 curt
+# Working on making the ground "hard."
+#
# Revision 1.2 1997/07/07 20:59:48 curt
# Working on scenery transformations to enable us to fly fluidly over the
# poles with no discontinuity/distortion in scenery.