]> git.mxchange.org Git - flightgear.git/blobdiff - Scenery/tilemgr.c
Prepairing for C++ integration.
[flightgear.git] / Scenery / tilemgr.c
index 96e4de6eeb94869a6e4ec544403aa85f9dbc1b02..a692bd86677eb64b8d03b29edf82209c72ce147a 100644 (file)
@@ -1,4 +1,5 @@
-/**************************************************************************
+/* -*- Mode: C++ -*-
+ *
  * tilemgr.c -- routines to handle dynamic management of scenery tiles
  *
  * Written by Curtis Olson, started January 1998.
@@ -24,7 +25,9 @@
  **************************************************************************/
 
 
-#ifdef WIN32
+#include <config.h>
+
+#ifdef HAVE_WINDOWS_H
 #  include <windows.h>
 #endif
 
 #include <XGL/xgl.h>
 
 #include <Scenery/scenery.h>
-#include <Scenery/bucketutils.h>
 #include <Scenery/obj.h>
 #include <Scenery/tilecache.h>
 
 #include <Aircraft/aircraft.h>
+#include <Bucket/bucketutils.h>
+#include <Debug/fg_debug.h>
 #include <Include/fg_constants.h>
 #include <Include/fg_types.h>
-#include <Main/fg_debug.h>
 
 
-#define FG_LOCAL_X           5   /* should be odd */
-#define FG_LOCAL_Y           5   /* should be odd */
-#define FG_LOCAL_X_Y         25   /* At least FG_LOCAL_X times FG_LOCAL_Y */
+#define FG_LOCAL_X           7   /* should be odd */
+#define FG_LOCAL_Y           7   /* should be odd */
+#define FG_LOCAL_X_Y         49  /* At least FG_LOCAL_X times FG_LOCAL_Y */
 
 
 /* closest (potentially viewable) tiles, centered on current tile.
@@ -180,9 +183,6 @@ int fgTileMgrUpdate( void ) {
 void fgTileMgrRender( void ) {
     fgFLIGHT *f;
     struct fgBUCKET p;
-    static GLfloat terrain_color[4] = { 0.6, 0.8, 0.4, 1.0 };
-    static GLfloat terrain_ambient[4];
-    static GLfloat terrain_diffuse[4];
     struct fgCartesianPoint local_ref;
     GLint display_list;
     int i;
@@ -190,20 +190,14 @@ void fgTileMgrRender( void ) {
 
     f = current_aircraft.flight;
 
-    for ( i = 0; i < 4; i++ ) {
-       terrain_ambient[i] = terrain_color[i] * 0.5;
-       terrain_diffuse[i] = terrain_color[i];
-    }
-
-    xglMaterialfv(GL_FRONT, GL_AMBIENT, terrain_ambient);
-    xglMaterialfv(GL_FRONT, GL_DIFFUSE, terrain_diffuse);
-
     /* Find current translation offset */
     fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p);
     index = fgTileCacheExists(&p);
-    fgTileCacheEntryInfo(index, &display_list, &scenery.center );
+    fgTileCacheEntryInfo(index, &display_list, &scenery.next_center );
 
-    printf("Current bucket = %d %d %d %d\n", p.lon, p.lat, p.x, p.y );
+    printf("Pos = (%.2f, %.2f) Current bucket = %d %d %d %d  Index = %ld\n", 
+          FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
+          p.lon, p.lat, p.x, p.y, fgBucketGenIndex(&p) );
 
     for ( i = 0; i < FG_LOCAL_X_Y; i++ ) {
        index = tiles[i];
@@ -225,10 +219,36 @@ void fgTileMgrRender( void ) {
 
 
 /* $Log$
-/* Revision 1.17  1998/02/16 13:39:46  curt
-/* Miscellaneous weekend tweaks.  Fixed? a cache problem that caused whole
-/* tiles to occasionally be missing.
+/* Revision 1.25  1998/04/18 04:14:07  curt
+/* Moved fg_debug.c to it's own library.
 /*
+ * Revision 1.24  1998/04/14 02:23:18  curt
+ * Code reorganizations.  Added a Lib/ directory for more general libraries.
+ *
+ * Revision 1.23  1998/04/08 23:30:08  curt
+ * Adopted Gnu automake/autoconf system.
+ *
+ * Revision 1.22  1998/04/03 22:11:38  curt
+ * Converting to Gnu autoconf system.
+ *
+ * Revision 1.21  1998/03/23 21:23:05  curt
+ * Debugging output tweaks.
+ *
+ * Revision 1.20  1998/03/14 00:30:51  curt
+ * Beginning initial terrain texturing experiments.
+ *
+ * Revision 1.19  1998/02/20 00:16:25  curt
+ * Thursday's tweaks.
+ *
+ * Revision 1.18  1998/02/19 13:05:54  curt
+ * Incorporated some HUD tweaks from Michelle America.
+ * Tweaked the sky's sunset/rise colors.
+ * Other misc. tweaks.
+ *
+ * Revision 1.17  1998/02/16 13:39:46  curt
+ * Miscellaneous weekend tweaks.  Fixed? a cache problem that caused whole
+ * tiles to occasionally be missing.
+ *
  * Revision 1.16  1998/02/12 21:59:53  curt
  * Incorporated code changes contributed by Charlie Hotchkiss
  * <chotchkiss@namg.us.anritsu.com>