]> git.mxchange.org Git - flightgear.git/blob - Scenery/tileutils.h
Changed #ifdef FILE_H to #ifdef _FILE_H
[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 #ifndef _TILEUTILS_H
28 #define _TILEUTILS_H
29
30
31 struct bucket {
32     int lon;  /* longitude (-180 to 179) */
33     int lat;  /* latitude (-90 to 89) */
34     int x;    /* x (0 to 7) */
35     int y;    /* y (0 to 7) */
36 };
37
38
39 /* Generate the unique scenery tile index containing the specified
40    lon/lat parameters.
41
42    The index is constructed as follows:
43
44    9 bits - to represent 360 degrees of longitude (-180 to 179)
45    8 bits - to represent 180 degrees of latitude (-90 to 89)
46
47    Each 1 degree by 1 degree tile is further broken down into an 8x8
48    grid.  So we also need:
49
50    3 bits - to represent x (0 to 7)
51    3 bits - to represent y (0 to 7) */
52 long int gen_index(struct bucket *p);
53
54
55 /* Parse a unique scenery tile index and find the lon, lat, x, and y */
56 void parse_index(long int index, struct bucket *p);
57
58
59 /* Build a path name from an tile index */
60 void gen_base_path(struct bucket *p, char *path);
61
62
63 /* offset an bucket struct by the specified amounts in the X & Y direction */
64 void offset_bucket(struct bucket *in, struct bucket *out, int x, int y);
65
66
67 /* Given a lat/lon, find the "bucket" or tile that it falls within */
68 void find_bucket(double lon, double lat, struct bucket *p);
69
70
71 /* Given a lat/lon, fill in the local tile index array */
72 void gen_idx_array(struct bucket *p1, struct bucket *tiles,
73                           int width, int height);
74
75
76 #endif /* _TILEUTILS_H */
77
78
79 /* $Log$
80 /* Revision 1.6  1998/01/22 02:59:42  curt
81 /* Changed #ifdef FILE_H to #ifdef _FILE_H
82 /*
83  * Revision 1.5  1998/01/14 02:19:05  curt
84  * Makde offset_bucket visible to outside.
85  *
86  * Revision 1.4  1998/01/13 00:23:12  curt
87  * Initial changes to support loading and management of scenery tiles.  Note,
88  * there's still a fair amount of work left to be done.
89  *
90  * Revision 1.3  1998/01/10 00:01:48  curt
91  * Misc api changes and tweaks.
92  *
93  * Revision 1.2  1998/01/08 02:22:28  curt
94  * Continue working on basic features.
95  *
96  * Revision 1.1  1998/01/07 23:50:52  curt
97  * "area" renamed to "tile"
98  *
99  * Revision 1.1  1998/01/07 23:23:40  curt
100  * Initial revision.
101  *
102  * */
103
104