1998-05-07 23:15:20 +00:00
|
|
|
/*
|
|
|
|
* tilemgr.cxx -- routines to handle dynamic management of scenery tiles
|
1998-01-07 23:50:01 +00:00
|
|
|
*
|
|
|
|
* Written by Curtis Olson, started January 1998.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*
|
|
|
|
* $Id$
|
|
|
|
* (Log is kept at end of this file)
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
1998-04-24 00:51:07 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
1998-04-03 22:09:02 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_WINDOWS_H
|
1998-01-07 23:50:01 +00:00
|
|
|
# include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <GL/glut.h>
|
1998-01-19 19:26:51 +00:00
|
|
|
#include <XGL/xgl.h>
|
1998-01-07 23:50:01 +00:00
|
|
|
|
1998-04-30 12:35:26 +00:00
|
|
|
#include <Scenery/obj.hxx>
|
|
|
|
#include <Scenery/scenery.hxx>
|
1998-04-22 13:21:26 +00:00
|
|
|
#include <Scenery/tilecache.hxx>
|
1998-01-07 23:50:01 +00:00
|
|
|
|
1998-01-19 19:26:51 +00:00
|
|
|
#include <Aircraft/aircraft.h>
|
1998-04-14 02:23:04 +00:00
|
|
|
#include <Bucket/bucketutils.h>
|
1998-04-18 04:13:51 +00:00
|
|
|
#include <Debug/fg_debug.h>
|
1998-01-27 00:47:41 +00:00
|
|
|
#include <Include/fg_constants.h>
|
|
|
|
#include <Include/fg_types.h>
|
1998-05-06 03:16:42 +00:00
|
|
|
#include <Main/options.hxx>
|
1998-05-16 13:09:57 +00:00
|
|
|
#include <Main/views.hxx>
|
|
|
|
#include <Math/mat3.h>
|
1998-01-07 23:50:01 +00:00
|
|
|
|
|
|
|
|
1998-05-16 13:09:57 +00:00
|
|
|
#define FG_LOCAL_X_Y 81 /* max(o->tile_diameter) ** 2 */
|
1998-01-24 00:03:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* closest (potentially viewable) tiles, centered on current tile.
|
|
|
|
* This is an array of pointers to cache indexes. */
|
|
|
|
int tiles[FG_LOCAL_X_Y];
|
|
|
|
|
1998-01-07 23:50:01 +00:00
|
|
|
|
|
|
|
/* Initialize the Tile Manager subsystem */
|
1998-02-12 21:58:27 +00:00
|
|
|
int fgTileMgrInit( void ) {
|
1998-01-27 03:26:41 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem.\n");
|
1998-02-12 21:58:27 +00:00
|
|
|
return 1;
|
1998-01-07 23:50:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-01-26 15:55:24 +00:00
|
|
|
/* load a tile */
|
|
|
|
void fgTileMgrLoadTile( struct fgBUCKET *p, int *index) {
|
1998-01-27 03:26:41 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_DEBUG, "Updating for bucket %d %d %d %d\n",
|
1998-01-26 15:55:24 +00:00
|
|
|
p->lon, p->lat, p->x, p->y);
|
|
|
|
|
1998-01-29 00:51:38 +00:00
|
|
|
/* if not in cache, load tile into the next available slot */
|
|
|
|
if ( (*index = fgTileCacheExists(p)) < 0 ) {
|
|
|
|
*index = fgTileCacheNextAvail();
|
|
|
|
fgTileCacheEntryFillIn(*index, p);
|
|
|
|
}
|
|
|
|
|
1998-01-27 03:26:41 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_DEBUG, "Selected cache index of %d\n", *index);
|
1998-01-26 15:55:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-01-07 23:50:01 +00:00
|
|
|
/* given the current lon/lat, fill in the array of local chunks. If
|
|
|
|
* the chunk isn't already in the cache, then read it from disk. */
|
1998-02-12 21:58:27 +00:00
|
|
|
int fgTileMgrUpdate( void ) {
|
1998-02-07 15:29:31 +00:00
|
|
|
fgFLIGHT *f;
|
1998-05-06 03:16:42 +00:00
|
|
|
fgOPTIONS *o;
|
1998-01-24 00:03:27 +00:00
|
|
|
struct fgBUCKET p1, p2;
|
|
|
|
static struct fgBUCKET p_last = {-1000, 0, 0, 0};
|
|
|
|
int i, j, dw, dh;
|
1998-01-07 23:50:01 +00:00
|
|
|
|
1998-02-07 15:29:31 +00:00
|
|
|
f = current_aircraft.flight;
|
1998-05-06 03:16:42 +00:00
|
|
|
o = ¤t_options;
|
1998-01-07 23:50:01 +00:00
|
|
|
|
1998-01-24 00:03:27 +00:00
|
|
|
fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p1);
|
1998-05-16 13:09:57 +00:00
|
|
|
dw = o->tile_diameter / 2;
|
|
|
|
dh = o->tile_diameter / 2;
|
1998-01-08 02:22:26 +00:00
|
|
|
|
1998-02-12 21:58:27 +00:00
|
|
|
if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) &&
|
1998-01-24 00:03:27 +00:00
|
|
|
(p1.x == p_last.x) && (p1.y == p_last.y) ) {
|
1998-01-19 18:40:15 +00:00
|
|
|
/* same bucket as last time */
|
1998-01-27 03:26:41 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_DEBUG, "Same bucket as last time\n");
|
1998-01-26 15:55:24 +00:00
|
|
|
} else if ( p_last.lon == -1000 ) {
|
|
|
|
/* First time through, initialize the system and load all
|
|
|
|
* relavant tiles */
|
1998-01-19 18:40:15 +00:00
|
|
|
|
1998-05-07 23:15:20 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_INFO, " First time through ... ");
|
|
|
|
fgPrintf( FG_TERRAIN, FG_INFO, " Updating Tile list for %d,%d %d,%d\n",
|
1998-02-12 21:58:27 +00:00
|
|
|
p1.lon, p1.lat, p1.x, p1.y);
|
1998-05-07 23:15:20 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
1998-05-16 13:09:57 +00:00
|
|
|
o->tile_diameter * o->tile_diameter);
|
1998-01-13 00:23:08 +00:00
|
|
|
|
1998-01-24 00:03:27 +00:00
|
|
|
/* wipe tile cache */
|
|
|
|
fgTileCacheInit();
|
1998-01-13 00:23:08 +00:00
|
|
|
|
1998-01-24 00:03:27 +00:00
|
|
|
/* build the local area list and update cache */
|
1998-05-16 13:09:57 +00:00
|
|
|
for ( j = 0; j < o->tile_diameter; j++ ) {
|
|
|
|
for ( i = 0; i < o->tile_diameter; i++ ) {
|
1998-01-24 00:03:27 +00:00
|
|
|
fgBucketOffset(&p1, &p2, i - dw, j - dh);
|
1998-05-16 13:09:57 +00:00
|
|
|
fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) + i]);
|
1998-01-24 00:03:27 +00:00
|
|
|
}
|
1998-01-13 00:23:08 +00:00
|
|
|
}
|
1998-01-26 15:55:24 +00:00
|
|
|
} else {
|
|
|
|
/* We've moved to a new bucket, we need to scroll our
|
|
|
|
* structures, and load in the new tiles */
|
|
|
|
|
|
|
|
/* CURRENTLY THIS ASSUMES WE CAN ONLY MOVE TO ADJACENT TILES.
|
|
|
|
AT ULTRA HIGH SPEEDS THIS ASSUMPTION MAY NOT BE VALID IF
|
|
|
|
THE AIRCRAFT CAN SKIP A TILE IN A SINGLE ITERATION. */
|
|
|
|
|
1998-05-07 23:15:20 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_INFO, "Updating Tile list for %d,%d %d,%d\n",
|
|
|
|
p1.lon, p1.lat, p1.x, p1.y);
|
|
|
|
|
1998-02-12 21:58:27 +00:00
|
|
|
if ( (p1.lon > p_last.lon) ||
|
1998-01-27 00:47:41 +00:00
|
|
|
( (p1.lon == p_last.lon) && (p1.x > p_last.x) ) ) {
|
1998-05-07 23:15:20 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
1998-05-16 13:09:57 +00:00
|
|
|
o->tile_diameter);
|
|
|
|
for ( j = 0; j < o->tile_diameter; j++ ) {
|
1998-01-26 15:55:24 +00:00
|
|
|
/* scrolling East */
|
1998-05-16 13:09:57 +00:00
|
|
|
for ( i = 0; i < o->tile_diameter - 1; i++ ) {
|
|
|
|
tiles[(j*o->tile_diameter) + i] = tiles[(j*o->tile_diameter) + i + 1];
|
1998-01-26 15:55:24 +00:00
|
|
|
}
|
|
|
|
/* load in new column */
|
|
|
|
fgBucketOffset(&p_last, &p2, dw + 1, j - dh);
|
1998-05-16 13:09:57 +00:00
|
|
|
fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) + o->tile_diameter - 1]);
|
1998-01-26 15:55:24 +00:00
|
|
|
}
|
1998-02-12 21:58:27 +00:00
|
|
|
} else if ( (p1.lon < p_last.lon) ||
|
1998-01-27 00:47:41 +00:00
|
|
|
( (p1.lon == p_last.lon) && (p1.x < p_last.x) ) ) {
|
1998-05-07 23:15:20 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
1998-05-16 13:09:57 +00:00
|
|
|
o->tile_diameter);
|
|
|
|
for ( j = 0; j < o->tile_diameter; j++ ) {
|
1998-01-26 15:55:24 +00:00
|
|
|
/* scrolling West */
|
1998-05-16 13:09:57 +00:00
|
|
|
for ( i = o->tile_diameter - 1; i > 0; i-- ) {
|
|
|
|
tiles[(j*o->tile_diameter) + i] = tiles[(j*o->tile_diameter) + i - 1];
|
1998-01-26 15:55:24 +00:00
|
|
|
}
|
|
|
|
/* load in new column */
|
|
|
|
fgBucketOffset(&p_last, &p2, -dw - 1, j - dh);
|
1998-05-16 13:09:57 +00:00
|
|
|
fgTileMgrLoadTile(&p2, &tiles[(j*o->tile_diameter) + 0]);
|
1998-01-26 15:55:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-02-12 21:58:27 +00:00
|
|
|
if ( (p1.lat > p_last.lat) ||
|
1998-01-27 00:47:41 +00:00
|
|
|
( (p1.lat == p_last.lat) && (p1.y > p_last.y) ) ) {
|
1998-05-07 23:15:20 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
1998-05-16 13:09:57 +00:00
|
|
|
o->tile_diameter);
|
|
|
|
for ( i = 0; i < o->tile_diameter; i++ ) {
|
1998-01-26 15:55:24 +00:00
|
|
|
/* scrolling North */
|
1998-05-16 13:09:57 +00:00
|
|
|
for ( j = 0; j < o->tile_diameter - 1; j++ ) {
|
|
|
|
tiles[(j * o->tile_diameter) + i] =
|
|
|
|
tiles[((j+1) * o->tile_diameter) + i];
|
1998-01-26 15:55:24 +00:00
|
|
|
}
|
|
|
|
/* load in new column */
|
|
|
|
fgBucketOffset(&p_last, &p2, i - dw, dh + 1);
|
1998-05-16 13:09:57 +00:00
|
|
|
fgTileMgrLoadTile(&p2, &tiles[((o->tile_diameter-1)*o->tile_diameter) + i]);
|
1998-01-26 15:55:24 +00:00
|
|
|
}
|
1998-02-12 21:58:27 +00:00
|
|
|
} else if ( (p1.lat < p_last.lat) ||
|
1998-01-27 00:47:41 +00:00
|
|
|
( (p1.lat == p_last.lat) && (p1.y < p_last.y) ) ) {
|
1998-05-07 23:15:20 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_INFO, " Loading %d tiles\n",
|
1998-05-16 13:09:57 +00:00
|
|
|
o->tile_diameter);
|
|
|
|
for ( i = 0; i < o->tile_diameter; i++ ) {
|
1998-01-26 15:55:24 +00:00
|
|
|
/* scrolling South */
|
1998-05-16 13:09:57 +00:00
|
|
|
for ( j = o->tile_diameter - 1; j > 0; j-- ) {
|
|
|
|
tiles[(j * o->tile_diameter) + i] =
|
|
|
|
tiles[((j-1) * o->tile_diameter) + i];
|
1998-01-26 15:55:24 +00:00
|
|
|
}
|
|
|
|
/* load in new column */
|
|
|
|
fgBucketOffset(&p_last, &p2, i - dw, -dh - 1);
|
|
|
|
fgTileMgrLoadTile(&p2, &tiles[0 + i]);
|
|
|
|
}
|
1998-02-12 21:58:27 +00:00
|
|
|
}
|
1998-01-13 00:23:08 +00:00
|
|
|
}
|
1998-01-26 15:55:24 +00:00
|
|
|
p_last.lon = p1.lon;
|
|
|
|
p_last.lat = p1.lat;
|
|
|
|
p_last.x = p1.x;
|
|
|
|
p_last.y = p1.y;
|
1998-02-12 21:58:27 +00:00
|
|
|
return 1;
|
1998-01-13 00:23:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-05-16 13:09:57 +00:00
|
|
|
// Calculate if point/radius is inside view frustum
|
|
|
|
//
|
|
|
|
static int viewable( fgCartesianPoint3d *cp, double radius ) {
|
|
|
|
fgVIEW *v;
|
|
|
|
MAT3hvec world, eye;
|
|
|
|
int viewable = 1; // start by assuming it's viewable
|
1998-05-17 16:59:34 +00:00
|
|
|
double x0, x1, y1, slope;
|
1998-05-16 13:09:57 +00:00
|
|
|
|
|
|
|
v = ¤t_view;
|
|
|
|
|
|
|
|
MAT3_SET_HVEC(world, cp->x, cp->y, cp->z, 1.0);
|
|
|
|
MAT3mult_vec(eye, world, v->WORLD_TO_EYE);
|
|
|
|
// printf( "\nworld -> eye = %.2f %.2f %.2f radius = %.2f\n",
|
|
|
|
// eye[0], eye[1], eye[2], radius);
|
1998-05-17 16:59:34 +00:00
|
|
|
|
|
|
|
// Check near clip plane
|
1998-05-16 13:09:57 +00:00
|
|
|
if ( eye[2] - radius > 0.0 ) {
|
1998-05-17 16:59:34 +00:00
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// check right clip plane (from eye perspective)
|
|
|
|
// y = m * (x - x0) = equation of a line intercepting X axis at x0
|
|
|
|
x1 = v->cos_fov_x * radius;
|
|
|
|
y1 = v->sin_fov_x * radius;
|
|
|
|
slope = -1.0 / v->slope_x;
|
|
|
|
x0 = x1 - y1 / slope;
|
|
|
|
|
|
|
|
// printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
|
|
|
|
// printf("eye[0] = %.2f eye[2] = %.2f\n", eye[0], eye[2]);
|
|
|
|
// printf("(r) x0 = %.2f slope_x = %.2f radius = %.2f\n",
|
|
|
|
// x0, slope, radius);
|
|
|
|
|
|
|
|
if ( eye[2] > slope * (eye[0] - x0) ) {
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// check left clip plane (from eye perspective)
|
|
|
|
x1 = -x1;
|
|
|
|
slope = -slope;
|
|
|
|
x0 = x1 - y1 / slope;
|
|
|
|
|
|
|
|
// printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
|
|
|
|
// printf("eye[0] = %.2f eye[2] = %.2f\n", eye[0], eye[2]);
|
|
|
|
// printf("(r) x0 = %.2f slope_x = %.2f radius = %.2f\n",
|
|
|
|
// x0, slope, radius);
|
|
|
|
|
|
|
|
if ( eye[2] > slope * (eye[0] - x0) ) {
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// check bottom clip plane (from eye perspective)
|
|
|
|
x1 = -(v->cos_fov_y) * radius;
|
|
|
|
y1 = v->sin_fov_y * radius;
|
|
|
|
slope = 1.0 / v->slope_y;
|
|
|
|
x0 = x1 - y1 / slope;
|
|
|
|
|
|
|
|
// printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
|
|
|
|
// printf("eye[1] = %.2f eye[2] = %.2f\n", eye[1], eye[2]);
|
|
|
|
// printf("(r) x0 = %.2f slope_y = %.2f radius = %.2f\n",
|
|
|
|
// x0, slope, radius);
|
|
|
|
|
|
|
|
if ( eye[2] > slope * (eye[1] - x0) ) {
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// check top clip plane (from eye perspective)
|
|
|
|
x1 = -x1;
|
|
|
|
slope = -slope;
|
|
|
|
x0 = x1 - y1 / slope;
|
|
|
|
|
|
|
|
// printf("(r) x1 = %.2f y1 = %.2f\n", x1, y1);
|
|
|
|
// printf("eye[1] = %.2f eye[2] = %.2f\n", eye[1], eye[2]);
|
|
|
|
// printf("(r) x0 = %.2f slope_y = %.2f radius = %.2f\n",
|
|
|
|
// x0, slope, radius);
|
|
|
|
|
|
|
|
if ( eye[2] > slope * (eye[1] - x0) ) {
|
|
|
|
return(0);
|
1998-05-16 13:09:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return(viewable);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-01-26 15:55:24 +00:00
|
|
|
/* Render the local tiles */
|
1998-01-19 18:40:15 +00:00
|
|
|
void fgTileMgrRender( void ) {
|
1998-02-09 21:30:18 +00:00
|
|
|
fgFLIGHT *f;
|
1998-05-06 03:16:42 +00:00
|
|
|
fgOPTIONS *o;
|
1998-05-17 16:59:34 +00:00
|
|
|
fgVIEW *v;
|
1998-02-09 21:30:18 +00:00
|
|
|
struct fgBUCKET p;
|
1998-05-16 13:09:57 +00:00
|
|
|
fgCartesianPoint3d local_ref, offset;
|
1998-01-24 00:03:27 +00:00
|
|
|
GLint display_list;
|
1998-05-16 13:09:57 +00:00
|
|
|
double radius;
|
1998-01-24 00:03:27 +00:00
|
|
|
int i;
|
|
|
|
int index;
|
1998-05-16 13:09:57 +00:00
|
|
|
int culled = 0;
|
|
|
|
int drawn = 0;
|
1998-01-13 00:23:08 +00:00
|
|
|
|
1998-02-09 21:30:18 +00:00
|
|
|
f = current_aircraft.flight;
|
1998-05-06 03:16:42 +00:00
|
|
|
o = ¤t_options;
|
1998-05-17 16:59:34 +00:00
|
|
|
v = ¤t_view;
|
1998-02-09 21:30:18 +00:00
|
|
|
|
|
|
|
/* Find current translation offset */
|
|
|
|
fgBucketFind(FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG, &p);
|
|
|
|
index = fgTileCacheExists(&p);
|
1998-05-16 13:09:57 +00:00
|
|
|
fgTileCacheEntryInfo(index, &display_list, &scenery.next_center, &radius );
|
1998-02-09 21:30:18 +00:00
|
|
|
|
1998-05-06 03:16:42 +00:00
|
|
|
fgPrintf( FG_TERRAIN, FG_DEBUG,
|
1998-05-07 23:15:20 +00:00
|
|
|
"Pos = (%.2f, %.2f) Current bucket = %d %d %d %d Index = %ld\n",
|
1998-05-06 03:16:42 +00:00
|
|
|
FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
|
|
|
|
p.lon, p.lat, p.x, p.y, fgBucketGenIndex(&p) );
|
1998-02-11 02:50:34 +00:00
|
|
|
|
1998-05-16 13:09:57 +00:00
|
|
|
for ( i = 0; i < (o->tile_diameter * o->tile_diameter); i++ ) {
|
1998-01-24 00:03:27 +00:00
|
|
|
index = tiles[i];
|
1998-01-27 03:26:41 +00:00
|
|
|
/* fgPrintf( FG_TERRAIN, FG_DEBUG, "Index = %d\n", index); */
|
1998-05-16 13:09:57 +00:00
|
|
|
fgTileCacheEntryInfo(index, &display_list, &local_ref, &radius );
|
1998-01-24 00:03:27 +00:00
|
|
|
|
1998-02-01 03:39:53 +00:00
|
|
|
if ( display_list >= 0 ) {
|
1998-05-16 13:09:57 +00:00
|
|
|
|
|
|
|
offset.x = local_ref.x - scenery.center.x;
|
|
|
|
offset.y = local_ref.y - scenery.center.y;
|
|
|
|
offset.z = local_ref.z - scenery.center.z;
|
|
|
|
|
|
|
|
if ( viewable(&offset, radius) ) {
|
|
|
|
drawn++;
|
|
|
|
xglPushMatrix();
|
|
|
|
xglTranslatef(offset.x, offset.y, offset.z);
|
|
|
|
xglCallList(display_list);
|
|
|
|
xglPopMatrix();
|
|
|
|
} else {
|
|
|
|
culled++;
|
|
|
|
}
|
1998-02-01 03:39:53 +00:00
|
|
|
}
|
1998-01-13 00:23:08 +00:00
|
|
|
}
|
1998-05-16 13:09:57 +00:00
|
|
|
|
1998-05-17 16:59:34 +00:00
|
|
|
v->vfc_ratio = (double)culled / (double)(drawn + culled);
|
|
|
|
// printf("drawn = %d culled = %d saved = %.2f\n", drawn, culled,
|
|
|
|
// v->vfc_ratio);
|
1998-01-07 23:50:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* $Log$
|
1998-05-17 16:59:34 +00:00
|
|
|
/* Revision 1.10 1998/05/17 16:59:34 curt
|
|
|
|
/* Frist pass at view frustum culling now operational.
|
1998-01-07 23:50:01 +00:00
|
|
|
/*
|
1998-05-17 16:59:34 +00:00
|
|
|
* Revision 1.9 1998/05/16 13:09:58 curt
|
|
|
|
* Beginning to add support for view frustum culling.
|
|
|
|
* Added some temporary code to calculate bouding radius, until the
|
|
|
|
* scenery generation tools and scenery can be updated.
|
|
|
|
*
|
1998-05-16 13:09:57 +00:00
|
|
|
* Revision 1.8 1998/05/07 23:15:21 curt
|
|
|
|
* Fixed a glTexImage2D() usage bug where width and height were mis-swapped.
|
|
|
|
* Added support for --tile-radius=n option.
|
|
|
|
*
|
1998-05-07 23:15:20 +00:00
|
|
|
* Revision 1.7 1998/05/06 03:16:42 curt
|
|
|
|
* Added an option to control square tile radius.
|
|
|
|
*
|
1998-05-06 03:16:42 +00:00
|
|
|
* Revision 1.6 1998/05/02 01:52:18 curt
|
|
|
|
* Playing around with texture coordinates.
|
|
|
|
*
|
1998-05-02 01:52:14 +00:00
|
|
|
* Revision 1.5 1998/04/30 12:35:32 curt
|
|
|
|
* Added a command line rendering option specify smooth/flat shading.
|
|
|
|
*
|
1998-04-30 12:35:26 +00:00
|
|
|
* Revision 1.4 1998/04/27 03:30:14 curt
|
|
|
|
* Minor transformation adjustments to try to keep scenery tiles closer to
|
|
|
|
* (0, 0, 0) GLfloats run out of precision at the distances we need to model
|
|
|
|
* the earth, but we can do a bunch of pre-transformations using double math
|
|
|
|
* and then cast to GLfloat once everything is close in where we have less
|
|
|
|
* precision problems.
|
|
|
|
*
|
1998-04-27 03:30:13 +00:00
|
|
|
* Revision 1.3 1998/04/25 22:06:32 curt
|
|
|
|
* Edited cvs log messages in source files ... bad bad bad!
|
|
|
|
*
|
1998-04-25 22:06:24 +00:00
|
|
|
* Revision 1.2 1998/04/24 00:51:09 curt
|
|
|
|
* Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
|
|
|
|
* Tweaked the scenery file extentions to be "file.obj" (uncompressed)
|
|
|
|
* or "file.obz" (compressed.)
|
|
|
|
*
|
1998-04-24 00:51:07 +00:00
|
|
|
* Revision 1.1 1998/04/22 13:22:48 curt
|
|
|
|
* C++ - ifing the code a bit.
|
|
|
|
*
|
1998-04-22 13:21:26 +00:00
|
|
|
* Revision 1.25 1998/04/18 04:14:07 curt
|
|
|
|
* Moved fg_debug.c to it's own library.
|
|
|
|
*
|
1998-04-18 04:13:51 +00:00
|
|
|
* Revision 1.24 1998/04/14 02:23:18 curt
|
|
|
|
* Code reorganizations. Added a Lib/ directory for more general libraries.
|
|
|
|
*
|
1998-04-14 02:23:04 +00:00
|
|
|
* Revision 1.23 1998/04/08 23:30:08 curt
|
|
|
|
* Adopted Gnu automake/autoconf system.
|
|
|
|
*
|
1998-04-08 23:30:04 +00:00
|
|
|
* Revision 1.22 1998/04/03 22:11:38 curt
|
|
|
|
* Converting to Gnu autoconf system.
|
|
|
|
*
|
1998-04-03 22:09:02 +00:00
|
|
|
* Revision 1.21 1998/03/23 21:23:05 curt
|
|
|
|
* Debugging output tweaks.
|
|
|
|
*
|
1998-03-23 21:23:05 +00:00
|
|
|
* Revision 1.20 1998/03/14 00:30:51 curt
|
|
|
|
* Beginning initial terrain texturing experiments.
|
|
|
|
*
|
1998-03-14 00:30:50 +00:00
|
|
|
* Revision 1.19 1998/02/20 00:16:25 curt
|
|
|
|
* Thursday's tweaks.
|
|
|
|
*
|
1998-02-20 00:16:14 +00:00
|
|
|
* 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.
|
|
|
|
*
|
1998-02-19 13:05:43 +00:00
|
|
|
* 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.
|
|
|
|
*
|
1998-02-16 13:39:42 +00:00
|
|
|
* Revision 1.16 1998/02/12 21:59:53 curt
|
|
|
|
* Incorporated code changes contributed by Charlie Hotchkiss
|
|
|
|
* <chotchkiss@namg.us.anritsu.com>
|
|
|
|
*
|
1998-02-11 02:50:34 +00:00
|
|
|
* Revision 1.14 1998/02/09 21:30:19 curt
|
|
|
|
* Fixed a nagging problem with terrain tiles not "quite" matching up perfectly.
|
|
|
|
*
|
1998-02-09 21:30:18 +00:00
|
|
|
* Revision 1.13 1998/02/07 15:29:46 curt
|
|
|
|
* Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss
|
|
|
|
* <chotchkiss@namg.us.anritsu.com>
|
|
|
|
*
|
1998-02-07 15:29:31 +00:00
|
|
|
* Revision 1.12 1998/02/01 03:39:55 curt
|
|
|
|
* Minor tweaks.
|
|
|
|
*
|
1998-02-01 03:39:53 +00:00
|
|
|
* Revision 1.11 1998/01/31 00:43:27 curt
|
|
|
|
* Added MetroWorks patches from Carmen Volpe.
|
|
|
|
*
|
1998-01-31 00:42:57 +00:00
|
|
|
* Revision 1.10 1998/01/29 00:51:40 curt
|
|
|
|
* First pass at tile cache, dynamic tile loading and tile unloading now works.
|
|
|
|
*
|
1998-01-29 00:51:38 +00:00
|
|
|
* Revision 1.9 1998/01/27 03:26:44 curt
|
|
|
|
* Playing with new fgPrintf command.
|
|
|
|
*
|
1998-01-27 03:26:41 +00:00
|
|
|
* Revision 1.8 1998/01/27 00:48:04 curt
|
1998-04-25 22:06:24 +00:00
|
|
|
* Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
|
1998-01-27 03:26:41 +00:00
|
|
|
* system and commandline/config file processing code.
|
|
|
|
*
|
1998-01-27 00:47:41 +00:00
|
|
|
* Revision 1.7 1998/01/26 15:55:25 curt
|
|
|
|
* Progressing on building dynamic scenery system.
|
|
|
|
*
|
1998-01-26 15:55:24 +00:00
|
|
|
* Revision 1.6 1998/01/24 00:03:30 curt
|
|
|
|
* Initial revision.
|
|
|
|
*
|
1998-01-24 00:03:27 +00:00
|
|
|
* Revision 1.5 1998/01/19 19:27:18 curt
|
|
|
|
* Merged in make system changes from Bob Kuehne <rpk@sgi.com>
|
|
|
|
* This should simplify things tremendously.
|
|
|
|
*
|
1998-01-19 19:26:51 +00:00
|
|
|
* Revision 1.4 1998/01/19 18:40:38 curt
|
|
|
|
* Tons of little changes to clean up the code and to remove fatal errors
|
|
|
|
* when building with the c++ compiler.
|
|
|
|
*
|
1998-01-19 18:40:15 +00:00
|
|
|
* Revision 1.3 1998/01/13 00:23:11 curt
|
|
|
|
* Initial changes to support loading and management of scenery tiles. Note,
|
|
|
|
* there's still a fair amount of work left to be done.
|
|
|
|
*
|
1998-01-13 00:23:08 +00:00
|
|
|
* Revision 1.2 1998/01/08 02:22:27 curt
|
|
|
|
* Continue working on basic features.
|
|
|
|
*
|
1998-01-08 02:22:26 +00:00
|
|
|
* Revision 1.1 1998/01/07 23:50:51 curt
|
|
|
|
* "area" renamed to "tile"
|
|
|
|
*
|
1998-01-07 23:50:01 +00:00
|
|
|
* Revision 1.2 1998/01/07 03:29:29 curt
|
|
|
|
* Given an arbitrary lat/lon, we can now:
|
|
|
|
* generate a unique index for the chunk containing the lat/lon
|
|
|
|
* generate a path name to the chunk file
|
|
|
|
* build a list of the indexes of all the nearby areas.
|
|
|
|
*
|
|
|
|
* Revision 1.1 1998/01/07 02:05:48 curt
|
|
|
|
* Initial revision.
|
|
|
|
* */
|
|
|
|
|
|
|
|
|