]> git.mxchange.org Git - flightgear.git/commitdiff
Working on making the ground "hard."
authorcurt <curt>
Wed, 9 Jul 1997 21:31:08 +0000 (21:31 +0000)
committercurt <curt>
Wed, 9 Jul 1997 21:31:08 +0000 (21:31 +0000)
Main/GLmain.c
Main/mesh2GL.c
Scenery/mesh.c
Simulator/make.inc

index 998a4e328be2eebfc9a9e34027379068d5fed23c..7b7dcbc3930d451b41c3901226242b4c3544b0c1 100644 (file)
@@ -81,7 +81,7 @@ static GLfloat sun_vec[4] = {-3.0, 1.0, 2.0, 0.0 };
 /* 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;
 
@@ -403,8 +403,15 @@ static void fgMainLoop( void ) {
     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);
     }
 }
 
@@ -603,9 +610,12 @@ int main( int argc, char *argv[] ) {
 
 
 /* $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.
index 88ed7acafa83161f7f912f85083d9bb5e60e3b8e..2921db190d74c085105577a4f893ff9ade7ac56b 100644 (file)
@@ -90,7 +90,7 @@ GLint mesh2GL(struct mesh *m) {
            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);
@@ -104,17 +104,16 @@ GLint mesh2GL(struct mesh *m) {
                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);
@@ -133,9 +132,12 @@ GLint mesh2GL(struct mesh *m) {
 
 
 /* $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.
index 579d1f34fd5b309b2131f8363c97141f06024067..f91281f4daf80fc7b4733076011d90e4648bdbf2 100644 (file)
@@ -153,29 +153,69 @@ void mesh_do_it(struct mesh *m) {
 /* 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.
  *
index 013c503771bb5334a65132db4b9dae2845028a17..4d6201089f49344e6cb56376f9eb0ffe1c923d9f 100644 (file)
@@ -57,8 +57,7 @@ AR = ar
 #                much smoother.
 #---------------------------------------------------------------------------
 
-# FG_CFLAGS = -g -Wall -DUSE_ITIMER
-FG_CFLAGS = -g -Wall 
+FG_CFLAGS = -g -Wall
 
 
 #---------------------------------------------------------------------------
@@ -69,7 +68,9 @@ 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
@@ -100,6 +101,9 @@ GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS)
 
 #---------------------------------------------------------------------------
 # $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.