]> git.mxchange.org Git - flightgear.git/commitdiff
Looking at potential scenery transformation/coordinate system problems.
authorcurt <curt>
Sat, 12 Jul 1997 02:27:07 +0000 (02:27 +0000)
committercurt <curt>
Sat, 12 Jul 1997 02:27:07 +0000 (02:27 +0000)
Main/depend
Main/mesh2GL.c
Scenery/depend
Scenery/mesh.c

index d507caa67c3017ef8fbbc17c13c3602a85145c0d..96bb33611034ad5dd43f032648247ca85d71fa44 100644 (file)
@@ -19,5 +19,6 @@ GLmain.o: GLmain.c ../constants.h ../Aircraft/aircraft.h \
  ../Aircraft/../Controls/../limits.h ../Scenery/mesh.h \
  ../Scenery/scenery.h ../Math/mat3.h ../Math/polar.h \
  ../Math/../types.h ../Timer/fg_timer.h
-mesh2GL.o: mesh2GL.c ../constants.h ../Scenery/mesh.h ../Math/mat3.h \
- ../Math/polar.h ../Math/../types.h
+mesh2GL.o: mesh2GL.c ../constants.h ../Scenery/mesh.h \
+ ../Scenery/scenery.h ../Math/mat3.h ../Math/polar.h \
+ ../Math/../types.h
index 2b84ce9fd355600fddc290ec581726f97ad35c77..4b2d4726506745f629bf77a0b3a91c735cabac68 100644 (file)
 #include "../Math/polar.h"
 
 
+/* The following routine is a real hack used for testing puposes only
+ * and should probably be removed. */
+void mesh_make_test_object(double lon, double lat) {
+    struct fgCartesianPoint origin;
+    double elev;
+    double b = 0.25;
+    double h = 0.50;
+    static GLfloat color[4] = { 1.0, 0.25, 0.25, 1.0 };
+
+    glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color );
+
+    elev = mesh_altitude(lon, lat) * 0.001;
+    printf("Elevation of test structure is:  %.2f\n", elev);
+
+    printf("Center of structure geodetic:  (%.2f, %.2f\n", lon, lat);
+    origin = fgGeodetic2Cartesian(lon*ARCSEC_TO_RAD, lat*ARCSEC_TO_RAD);
+    printf("Center (unit circle) is (%.8f, %.8f, %.8f)\n", origin.x, origin.y, 
+          origin.z);
+
+    origin = fgRotateCartesianPoint(origin);
+    printf("Center of structure is:  (%.4f, %.4f\n", origin.y, origin.z);
+
+    glBegin(GL_TRIANGLE_STRIP);
+    glVertex3d(origin.y + b, origin.z-b, elev);
+    glVertex3d(origin.y - b, origin.z-b, elev);
+    glVertex3d(origin.y, origin.z, elev+h);
+    glVertex3d(origin.y - b, origin.z+b, elev);
+    glVertex3d(origin.y + b, origin.z+b, elev);
+    glVertex3d(origin.y + b, origin.z-b, elev);
+    glEnd();
+
+}
+
 /* walk through mesh and make ogl calls */
 GLint mesh2GL(struct mesh *m) {
     GLint mesh;
@@ -48,7 +81,10 @@ GLint mesh2GL(struct mesh *m) {
 
     printf("In mesh2GL(), generating GL call list.\n");
 
-    istep = jstep = cur_scenery_params.terrain_skip ;  /* Detail level */
+    /* Detail level.  This is how big a step we take as we walk
+     * through the DEM data set.  This value is initialized in
+     * .../Scenery/scenery.c:fgSceneryInit() */
+    istep = jstep = cur_scenery_params.terrain_skip ;
 
     /* setup the batch transformation */
     fgRotateBatchInit(-m->originx * ARCSEC_TO_RAD, -m->originy * ARCSEC_TO_RAD);
@@ -125,6 +161,9 @@ GLint mesh2GL(struct mesh *m) {
        y2 += m->col_step * istep;
     }
 
+    /* this will go, it's only here for testing/debugging */
+    mesh_make_test_object(-398391.28, 120070.41);
+
     glEndList();
 
     return(mesh);
@@ -133,10 +172,13 @@ GLint mesh2GL(struct mesh *m) {
 
 
 /* $Log$
-/* 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.31  1997/07/12 02:27:07  curt
+/* Looking at potential scenery transformation/coordinate system problems.
 /*
+ * 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.
  *
index 7a6e5240e70a64e6ef1144f1e975745b1d0bba3e..0dbd7ff05e1bf4fc1c51c5d979c8d08b9aa30357 100644 (file)
@@ -1,6 +1,6 @@
 common.o: common.c common.h
 geometry.o: geometry.c geometry.h mesh.h
-mesh.o: mesh.c mesh.h common.h
+mesh.o: mesh.c scenery.h mesh.h common.h
 parser.o: parser.c parsevrml.h geometry.h common.h mesh.h scenery.h
 scanner.o: scanner.c parser.h
 scenery.o: scenery.c scenery.h parsevrml.h
index ff49208f56bbb58f9120c7ed7fef0c8f29de1c05..f540bb37c0bfc677454571ce98297fbc4ba60d3f 100644 (file)
@@ -24,7 +24,9 @@
  **************************************************************************/
 
 
-#include <malloc.h>
+#ifndef __CYGWIN32__
+#  include <malloc.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>  /* atof(), atoi() */
 #include <string.h>
@@ -249,10 +251,13 @@ double mesh_altitude(double lon, double lat) {
 
 
 /* $Log$
-/* 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.13  1997/07/12 02:27:11  curt
+/* Looking at potential scenery transformation/coordinate system problems.
 /*
+ * 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.
  *