]> git.mxchange.org Git - flightgear.git/blob - Scenery/tileutils.h
"area" renamed to "tile"
[flightgear.git] / Scenery / tileutils.h
1 /**************************************************************************
2  * tileutils.h -- support routines to handle dynamic management of scenery tiles
3  *
4  * Written by Curtis Olson, started January 1998.
5  *
6  * Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  * $Id$
23  * (Log is kept at end of this file)
24  **************************************************************************/
25
26
27 struct bucket {
28     int lon;  /* longitude (-180 to 179) */
29     int lat;  /* latitude (-90 to 89) */
30     int x;    /* x (0 to 7) */
31     int y;    /* y (0 to 7) */
32 };
33
34
35 /* Generate the unique scenery tile index containing the specified
36    lon/lat parameters.
37
38    The index is constructed as follows:
39
40    9 bits - to represent 360 degrees of longitude (-180 to 179)
41    8 bits - to represent 180 degrees of latitude (-90 to 89)
42
43    Each 1 degree by 1 degree tile is further broken down into an 8x8
44    grid.  So we also need:
45
46    3 bits - to represent x (0 to 7)
47    3 bits - to represent y (0 to 7) */
48 /* static long gen_index(struct bucket *p); */
49
50
51 /* Parse a unique scenery tile index and find the lon, lat, x, and y */
52 /* static void parse_index(long int index, struct bucket *p); */
53
54
55 /* Build a path name from an tile index */
56 void gen_path(long int index, char *path);
57
58
59 /* offset an bucket struct by the specified amounts in the X & Y direction */
60 /* static void offset_bucket(struct bucket *in, struct bucket *out, int x, int y); */
61
62
63 /* Given a lat/lon, find the "bucket" or tile that it falls within */
64 void find_bucket(double lon, double lat, struct bucket *p);
65
66
67 /* Given a lat/lon, fill in the local tile index array */
68 void gen_idx_array(struct bucket *p1, long int *tile, 
69                           int width, int height);
70
71
72 /* $Log$
73 /* Revision 1.1  1998/01/07 23:50:52  curt
74 /* "area" renamed to "tile"
75 /*
76  * Revision 1.1  1998/01/07 23:23:40  curt
77  * Initial revision.
78  *
79  * */
80
81