]> git.mxchange.org Git - flightgear.git/blobdiff - Main/mesh2GL.c
Capitalized subdirectory names.
[flightgear.git] / Main / mesh2GL.c
index ed3b555c07c453f13d26f2f48cbccea1b4c03aaf..64a3a28418f194070c1a8ed0bd30dab153eadcdf 100644 (file)
     #include "gltk.h"
 #endif
 
-#include "../scenery/mesh.h"
-#include "mat3.h"
-
-
-/* Sets the first vector to be the cross-product of the last two
-    vectors. */
-static void mat3_cross_product(float result_vec[3], register float vec1[3], 
-                       register float vec2[3]) {
-   float tempvec[3];
-   register float *temp = tempvec;
-
-   temp[0] = vec1[1] * vec2[2] - vec1[2] * vec2[1];
-   temp[1] = vec1[2] * vec2[0] - vec1[0] * vec2[2];
-   temp[2] = vec1[0] * vec2[1] - vec1[1] * vec2[0];
-
-   MAT3_COPY_VEC(result_vec, temp);
-}
+#include "../Scenery/mesh.h"
+#include "../mat3/mat3.h"
 
 
 /* walk through mesh and make ogl calls */
 GLint mesh2GL(struct mesh *m) {
     GLint mesh;
+    static GLfloat color[4] = { 0.3, 0.7, 0.2, 1.0 };
 
     float x1, y1, x2, y2, z11, z12, z21, z22;
-    float v1[3], v2[3], normal[3]; 
+
+    MAT3vec v1, v2, normal; 
     int i, j, istep, jstep, iend, jend;
     float temp;
 
-    istep = jstep = 100;  /* Detail level 1 -- 1200 ... */
+    istep = jstep = 25;  /* Detail level 1 -- 1200 ... */
 
     mesh = glGenLists(1);
     glNewList(mesh, GL_COMPILE);
 
+    glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color );
+       
     iend = m->cols - 1;
     jend = m->rows - 1;
     
@@ -84,9 +73,9 @@ GLint mesh2GL(struct mesh *m) {
 
            v1[0] = x2 - x1; v1[1] = 0;       v1[2] = z21 - z11;
            v2[0] = 0;       v2[1] = y2 - y1; v2[2] = z12 - z11;
-           mat3_cross_product(normal, v1, v2);
+           MAT3cross_product(normal, v1, v2);
            MAT3_NORMALIZE_VEC(normal,temp);
-           glNormal3fv(normal);
+           glNormal3d(normal[0], normal[1], normal[2]);
 
            if ( j == 0 ) {
                /* first time through */
@@ -98,9 +87,9 @@ GLint mesh2GL(struct mesh *m) {
            
            v1[0] = x2 - x1; v1[1] = y1 - y2; v1[2] = z21 - z12;
            v2[0] = x2 - x1; v2[1] = 0; v2[2] = z22 - z12;
-           mat3_cross_product(normal, v1, v2);
+           MAT3cross_product(normal, v1, v2);
            MAT3_NORMALIZE_VEC(normal,temp);
-           glNormal3fv(normal);
+           glNormal3d(normal[0], normal[1], normal[2]);
            glVertex3f(x2, y2, z22);
 
            x1 = x2;
@@ -119,9 +108,48 @@ GLint mesh2GL(struct mesh *m) {
 
 
 /* $Log$
-/* Revision 1.9  1997/05/29 22:39:51  curt
-/* Working on incorporating the LaRCsim flight model.
+/* Revision 1.21  1997/06/21 17:12:54  curt
+/* Capitalized subdirectory names.
 /*
+ * Revision 1.20  1997/06/18 04:10:32  curt
+ * A couple more runway tweaks ...
+ *
+ * Revision 1.19  1997/06/18 02:21:24  curt
+ * Hacked in a runway
+ *
+ * Revision 1.18  1997/06/17 04:19:17  curt
+ * More timer related tweaks with respect to view direction changes.
+ *
+ * Revision 1.17  1997/06/16 19:32:52  curt
+ * Starting to add general timer support.
+ *
+ * Revision 1.16  1997/06/02 03:40:07  curt
+ * A tiny bit more view tweaking.
+ *
+ * Revision 1.15  1997/06/02 03:01:38  curt
+ * Working on views (side, front, back, transitions, etc.)
+ *
+ * Revision 1.14  1997/05/31 19:16:26  curt
+ * Elevator trim added.
+ *
+ * Revision 1.13  1997/05/31 04:13:53  curt
+ * WE CAN NOW FLY!!!
+ *
+ * Continuing work on the LaRCsim flight model integration.
+ * Added some MSFS-like keyboard input handling.
+ *
+ * Revision 1.12  1997/05/30 23:26:20  curt
+ * Added elevator/aileron controls.
+ *
+ * Revision 1.11  1997/05/30 19:27:02  curt
+ * The LaRCsim flight model is starting to look like it is working.
+ *
+ * Revision 1.10  1997/05/30 03:54:11  curt
+ * Made a bit more progress towards integrating the LaRCsim flight model.
+ *
+ * Revision 1.9  1997/05/29 22:39:51  curt
+ * Working on incorporating the LaRCsim flight model.
+ *
  * Revision 1.8  1997/05/29 12:31:40  curt
  * Minor tweaks, moving towards general flight model integration.
  *