From f1d21eef9c791cfc3931ce7aa5285c7548d5b450 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 11 Jul 1997 03:23:18 +0000 Subject: [PATCH] Solved some scenery display/orientation problems. Still have a positioning (or transformation?) problem. --- Main/GLmain.c | 19 ++++++++++++------- Main/mesh2GL.c | 26 +++++++++++++++----------- Scenery/mesh.c | 22 +++++++++++++--------- Scenery/scenery.c | 10 +++++++--- 4 files changed, 47 insertions(+), 30 deletions(-) diff --git a/Main/GLmain.c b/Main/GLmain.c index 652c1d40e..d299528c7 100644 --- a/Main/GLmain.c +++ b/Main/GLmain.c @@ -173,7 +173,7 @@ static void fgUpdateViewParams() { /* MAT3mult_vec(vec, vec, R); */ /* MAT3rotate(TMP, vec, M_PI + M_PI_2 + FG_Psi + view_offset); */ MAT3rotate(TMP, vec, FG_Psi - M_PI_2); - /* printf("Yaw matrix\n"); + /* printf("Yaw matrix\n"); MAT3print(TMP, stdout); */ MAT3mult(R, R, TMP); @@ -496,10 +496,11 @@ int main( int argc, char *argv[] ) { /* Initial Position */ FG_Latitude = ( 120070.41 / 3600.0 ) * DEG_TO_RAD; FG_Longitude = ( -398391.28 / 3600.0 ) * DEG_TO_RAD; - /* FG_Latitude = 0.0; - FG_Longitude = 0.0; */ FG_Altitude = FG_Runway_altitude + 3.758099; - FG_Altitude = 15000.0; + + /* FG_Latitude = 0.0; */ + /* FG_Longitude = 0.0; */ + /* FG_Altitude = 15000.0; */ printf("Initial position is: (%.4f, %.4f, %.2f)\n", FG_Latitude, FG_Longitude, FG_Altitude); @@ -512,7 +513,7 @@ int main( int argc, char *argv[] ) { /* Initial Orientation */ FG_Phi = -2.658474E-06; FG_Theta = 7.401790E-03; - FG_Psi = 282.0 * DEG_TO_RAD; + FG_Psi = 270.0 * DEG_TO_RAD; /* Initial Angular B rates */ FG_P_body = 7.206685E-05; @@ -611,9 +612,13 @@ int main( int argc, char *argv[] ) { /* $Log$ -/* Revision 1.31 1997/07/11 01:29:58 curt -/* More tweaking of terrian floor. +/* Revision 1.32 1997/07/11 03:23:18 curt +/* Solved some scenery display/orientation problems. Still have a positioning +/* (or transformation?) problem. /* + * Revision 1.31 1997/07/11 01:29:58 curt + * More tweaking of terrian floor. + * * Revision 1.30 1997/07/10 04:26:37 curt * We now can interpolated ground elevation for any position in the grid. We * can use this to enforce a "hard" ground. We still need to enforce some diff --git a/Main/mesh2GL.c b/Main/mesh2GL.c index 8d41c51dc..2b84ce9fd 100644 --- a/Main/mesh2GL.c +++ b/Main/mesh2GL.c @@ -86,10 +86,10 @@ GLint mesh2GL(struct mesh *m) { p22 = fgGeodetic2Cartesian(x2*ARCSEC_TO_RAD, y2*ARCSEC_TO_RAD); p22 = fgRotateCartesianPoint(p22); - z11 = 0.001 * m->mesh_data[j * m->rows + i ]; - z12 = 0.001 * m->mesh_data[j * m->rows + (i+istep)]; - z21 = 0.001 * m->mesh_data[(j+jstep) * m->rows + i ]; - z22 = 0.001 * m->mesh_data[(j+jstep) * m->rows + (i+istep)]; + z11 = 0.001 * m->mesh_data[i * m->cols + j ]; + z12 = 0.001 * m->mesh_data[(i+istep) * m->cols + j ]; + z21 = 0.001 * m->mesh_data[i * m->cols + (j+jstep)]; + z22 = 0.001 * m->mesh_data[(i+istep) * m->cols + (j+jstep)]; 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; @@ -101,8 +101,8 @@ GLint mesh2GL(struct mesh *m) { if ( j == 0 ) { /* first time through */ - glVertex3d(p11.y, p11.z, z11); glVertex3d(p12.y, p12.z, z12); + glVertex3d(p11.y, p11.z, z11); } glVertex3d(p22.y, p22.z, z22); @@ -116,13 +116,13 @@ GLint mesh2GL(struct mesh *m) { glVertex3d(p21.y, p21.z, z21); - x1 = x2; - x2 = x1 + (m->row_step * jstep); + x1 += m->row_step * jstep; + x2 += m->row_step * jstep; } glEnd(); - y1 = y2; - y2 = y1 + (m->col_step * istep); + y1 += m->col_step * istep; + y2 += m->col_step * istep; } glEndList(); @@ -133,9 +133,13 @@ GLint mesh2GL(struct mesh *m) { /* $Log$ -/* Revision 1.29 1997/07/11 01:29:58 curt -/* More tweaking of terrian floor. +/* Revision 1.30 1997/07/11 03:23:18 curt +/* Solved some scenery display/orientation problems. Still have a positioning +/* (or transformation?) problem. /* + * Revision 1.29 1997/07/11 01:29:58 curt + * More tweaking of terrian floor. + * * Revision 1.28 1997/07/10 04:26:37 curt * We now can interpolated ground elevation for any position in the grid. We * can use this to enforce a "hard" ground. We still need to enforce some diff --git a/Scenery/mesh.c b/Scenery/mesh.c index de1f149c5..ff49208f5 100644 --- a/Scenery/mesh.c +++ b/Scenery/mesh.c @@ -116,7 +116,7 @@ void mesh_set_option_value(struct mesh *m, char *value) { /* mesh data is a pseudo 2d array */ /* printf("Setting mesh_data[%d][%d] to %s\n", m->cur_row, m->cur_col, value); */ - m->mesh_data[m->cur_row * m->rows + m->cur_col] = atof(value); + m->mesh_data[m->cur_row * m->cols + m->cur_col] = atof(value); m->cur_col++; if ( m->cur_col >= m->cols ) { m->cur_col = 0; @@ -193,15 +193,15 @@ double mesh_altitude(double lon, double lat) { x1 = xindex; y1 = yindex; - z1 = eg.mesh_data[x1 * eg.rows + y1]; + z1 = eg.mesh_data[y1 * eg.cols + x1]; x2 = xindex + skip; y2 = yindex; - z2 = eg.mesh_data[x2 * eg.rows + y2]; + z2 = eg.mesh_data[y2 * eg.cols + x2]; x3 = xindex + skip; y3 = yindex + skip; - z3 = eg.mesh_data[x3 * eg.rows + y3]; + z3 = eg.mesh_data[y3 * eg.cols + x3]; /* printf(" dx = %.2f dy = %.2f\n", dx, dy); printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1); @@ -220,15 +220,15 @@ double mesh_altitude(double lon, double lat) { x1 = xindex; y1 = yindex; - z1 = eg.mesh_data[x1 * eg.rows + y1]; + z1 = eg.mesh_data[y1 * eg.cols + x1]; x2 = xindex; y2 = yindex + skip; - z2 = eg.mesh_data[x2 * eg.rows + y2]; + z2 = eg.mesh_data[y2 * eg.cols + x2]; x3 = xindex + skip; y3 = yindex + skip; - z3 = eg.mesh_data[x3 * eg.rows + y3]; + z3 = eg.mesh_data[y3 * eg.cols + x3]; /* printf(" dx = %.2f dy = %.2f\n", dx, dy); printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1); @@ -249,9 +249,13 @@ double mesh_altitude(double lon, double lat) { /* $Log$ -/* Revision 1.11 1997/07/11 01:30:02 curt -/* More tweaking of terrian floor. +/* Revision 1.12 1997/07/11 03:23:19 curt +/* Solved some scenery display/orientation problems. Still have a positioning +/* (or transformation?) problem. /* + * Revision 1.11 1997/07/11 01:30:02 curt + * More tweaking of terrian floor. + * * Revision 1.10 1997/07/10 04:26:38 curt * We now can interpolated ground elevation for any position in the grid. We * can use this to enforce a "hard" ground. We still need to enforce some diff --git a/Scenery/scenery.c b/Scenery/scenery.c index 00e032791..922dbe429 100644 --- a/Scenery/scenery.c +++ b/Scenery/scenery.c @@ -41,7 +41,7 @@ struct scenery_params cur_scenery_params; /* Initialize the Scenery Management system */ void fgSceneryInit() { /* set the default terrain detail level */ - cur_scenery_params.terrain_skip = 10; + cur_scenery_params.terrain_skip = 4; } @@ -65,9 +65,13 @@ void fgSceneryRender() { /* $Log$ -/* Revision 1.4 1997/07/11 01:30:03 curt -/* More tweaking of terrian floor. +/* Revision 1.5 1997/07/11 03:23:19 curt +/* Solved some scenery display/orientation problems. Still have a positioning +/* (or transformation?) problem. /* + * Revision 1.4 1997/07/11 01:30:03 curt + * More tweaking of terrian floor. + * * Revision 1.3 1997/06/29 21:16:50 curt * More twiddling with the Scenery Management system. * -- 2.39.2