1
0
Fork 0

Solved some scenery display/orientation problems. Still have a positioning

(or transformation?) problem.
This commit is contained in:
curt 1997-07-11 03:23:18 +00:00
parent 5667631a45
commit f1d21eef9c
4 changed files with 47 additions and 30 deletions

View file

@ -173,7 +173,7 @@ static void fgUpdateViewParams() {
/* MAT3mult_vec(vec, vec, R); */ /* MAT3mult_vec(vec, vec, R); */
/* MAT3rotate(TMP, vec, M_PI + M_PI_2 + FG_Psi + view_offset); */ /* MAT3rotate(TMP, vec, M_PI + M_PI_2 + FG_Psi + view_offset); */
MAT3rotate(TMP, vec, FG_Psi - M_PI_2); MAT3rotate(TMP, vec, FG_Psi - M_PI_2);
/* printf("Yaw matrix\n"); /* printf("Yaw matrix\n");
MAT3print(TMP, stdout); */ MAT3print(TMP, stdout); */
MAT3mult(R, R, TMP); MAT3mult(R, R, TMP);
@ -496,10 +496,11 @@ int main( int argc, char *argv[] ) {
/* Initial Position */ /* Initial Position */
FG_Latitude = ( 120070.41 / 3600.0 ) * DEG_TO_RAD; FG_Latitude = ( 120070.41 / 3600.0 ) * DEG_TO_RAD;
FG_Longitude = ( -398391.28 / 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 = 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, printf("Initial position is: (%.4f, %.4f, %.2f)\n", FG_Latitude,
FG_Longitude, FG_Altitude); FG_Longitude, FG_Altitude);
@ -512,7 +513,7 @@ int main( int argc, char *argv[] ) {
/* Initial Orientation */ /* Initial Orientation */
FG_Phi = -2.658474E-06; FG_Phi = -2.658474E-06;
FG_Theta = 7.401790E-03; FG_Theta = 7.401790E-03;
FG_Psi = 282.0 * DEG_TO_RAD; FG_Psi = 270.0 * DEG_TO_RAD;
/* Initial Angular B rates */ /* Initial Angular B rates */
FG_P_body = 7.206685E-05; FG_P_body = 7.206685E-05;
@ -611,9 +612,13 @@ int main( int argc, char *argv[] ) {
/* $Log$ /* $Log$
/* Revision 1.31 1997/07/11 01:29:58 curt /* Revision 1.32 1997/07/11 03:23:18 curt
/* More tweaking of terrian floor. /* 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 * Revision 1.30 1997/07/10 04:26:37 curt
* We now can interpolated ground elevation for any position in the grid. We * 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 * can use this to enforce a "hard" ground. We still need to enforce some

View file

@ -86,10 +86,10 @@ GLint mesh2GL(struct mesh *m) {
p22 = fgGeodetic2Cartesian(x2*ARCSEC_TO_RAD, y2*ARCSEC_TO_RAD); p22 = fgGeodetic2Cartesian(x2*ARCSEC_TO_RAD, y2*ARCSEC_TO_RAD);
p22 = fgRotateCartesianPoint(p22); p22 = fgRotateCartesianPoint(p22);
z11 = 0.001 * m->mesh_data[j * m->rows + i ]; z11 = 0.001 * m->mesh_data[i * m->cols + j ];
z12 = 0.001 * m->mesh_data[j * m->rows + (i+istep)]; z12 = 0.001 * m->mesh_data[(i+istep) * m->cols + j ];
z21 = 0.001 * m->mesh_data[(j+jstep) * m->rows + i ]; z21 = 0.001 * m->mesh_data[i * m->cols + (j+jstep)];
z22 = 0.001 * m->mesh_data[(j+jstep) * m->rows + (i+istep)]; 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; 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; 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 ) { if ( j == 0 ) {
/* first time through */ /* first time through */
glVertex3d(p11.y, p11.z, z11);
glVertex3d(p12.y, p12.z, z12); glVertex3d(p12.y, p12.z, z12);
glVertex3d(p11.y, p11.z, z11);
} }
glVertex3d(p22.y, p22.z, z22); glVertex3d(p22.y, p22.z, z22);
@ -116,13 +116,13 @@ GLint mesh2GL(struct mesh *m) {
glVertex3d(p21.y, p21.z, z21); glVertex3d(p21.y, p21.z, z21);
x1 = x2; x1 += m->row_step * jstep;
x2 = x1 + (m->row_step * jstep); x2 += m->row_step * jstep;
} }
glEnd(); glEnd();
y1 = y2; y1 += m->col_step * istep;
y2 = y1 + (m->col_step * istep); y2 += m->col_step * istep;
} }
glEndList(); glEndList();
@ -133,9 +133,13 @@ GLint mesh2GL(struct mesh *m) {
/* $Log$ /* $Log$
/* Revision 1.29 1997/07/11 01:29:58 curt /* Revision 1.30 1997/07/11 03:23:18 curt
/* More tweaking of terrian floor. /* 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 * Revision 1.28 1997/07/10 04:26:37 curt
* We now can interpolated ground elevation for any position in the grid. We * 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 * can use this to enforce a "hard" ground. We still need to enforce some

View file

@ -116,7 +116,7 @@ void mesh_set_option_value(struct mesh *m, char *value) {
/* mesh data is a pseudo 2d array */ /* mesh data is a pseudo 2d array */
/* printf("Setting mesh_data[%d][%d] to %s\n", m->cur_row, m->cur_col, /* printf("Setting mesh_data[%d][%d] to %s\n", m->cur_row, m->cur_col,
value); */ 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++; m->cur_col++;
if ( m->cur_col >= m->cols ) { if ( m->cur_col >= m->cols ) {
m->cur_col = 0; m->cur_col = 0;
@ -193,15 +193,15 @@ double mesh_altitude(double lon, double lat) {
x1 = xindex; x1 = xindex;
y1 = yindex; y1 = yindex;
z1 = eg.mesh_data[x1 * eg.rows + y1]; z1 = eg.mesh_data[y1 * eg.cols + x1];
x2 = xindex + skip; x2 = xindex + skip;
y2 = yindex; y2 = yindex;
z2 = eg.mesh_data[x2 * eg.rows + y2]; z2 = eg.mesh_data[y2 * eg.cols + x2];
x3 = xindex + skip; x3 = xindex + skip;
y3 = yindex + 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(" dx = %.2f dy = %.2f\n", dx, dy);
printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1); printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1);
@ -220,15 +220,15 @@ double mesh_altitude(double lon, double lat) {
x1 = xindex; x1 = xindex;
y1 = yindex; y1 = yindex;
z1 = eg.mesh_data[x1 * eg.rows + y1]; z1 = eg.mesh_data[y1 * eg.cols + x1];
x2 = xindex; x2 = xindex;
y2 = yindex + skip; y2 = yindex + skip;
z2 = eg.mesh_data[x2 * eg.rows + y2]; z2 = eg.mesh_data[y2 * eg.cols + x2];
x3 = xindex + skip; x3 = xindex + skip;
y3 = yindex + 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(" dx = %.2f dy = %.2f\n", dx, dy);
printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1); printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1);
@ -249,9 +249,13 @@ double mesh_altitude(double lon, double lat) {
/* $Log$ /* $Log$
/* Revision 1.11 1997/07/11 01:30:02 curt /* Revision 1.12 1997/07/11 03:23:19 curt
/* More tweaking of terrian floor. /* 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 * Revision 1.10 1997/07/10 04:26:38 curt
* We now can interpolated ground elevation for any position in the grid. We * 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 * can use this to enforce a "hard" ground. We still need to enforce some

View file

@ -41,7 +41,7 @@ struct scenery_params cur_scenery_params;
/* Initialize the Scenery Management system */ /* Initialize the Scenery Management system */
void fgSceneryInit() { void fgSceneryInit() {
/* set the default terrain detail level */ /* 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$ /* $Log$
/* Revision 1.4 1997/07/11 01:30:03 curt /* Revision 1.5 1997/07/11 03:23:19 curt
/* More tweaking of terrian floor. /* 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 * Revision 1.3 1997/06/29 21:16:50 curt
* More twiddling with the Scenery Management system. * More twiddling with the Scenery Management system.
* *