sky: grid - fixed grid at low FOV.
[nova.git] / src / sky / tile.h
bloba204470b4e2f648eff30780398a02794baabd946
1 /*
2 * Copyright (C) 2008 Liam Girdwood
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __TILE_H
21 #define __TILE_H
23 #include <glib-2.0/glib.h>
24 #include "astro_object.h"
26 #define ARRAY_X_SIZE 30
27 #define ARRAY_Y_SIZE 30
28 #define TILE_NODES 2048
30 struct tile_node {
31 gint x;
32 gint y;
33 gdouble size;
34 gpointer data;
35 gpointer next;
38 struct tile_array {
39 gpointer tile[ARRAY_X_SIZE][ARRAY_Y_SIZE];
40 struct tile_node node[TILE_NODES];
41 gint x_coeff;
42 gint y_coeff;
43 gint index;
46 struct tile_array* tile_init(void);
48 gpointer tile_get_object_at(struct tile_array *ta, struct render_coord *rc);
50 gpointer tile_get_object_nearest(struct tile_array *ta,
51 struct render_coord *rc, gint radius);
52 gint tile_get_objects_within_radius (struct tile_array *ta,
53 struct render_coord *rc, gint radius,
54 struct tile_node *objects);
56 void tile_reset_array(struct tile_array *ta);
58 void tile_add_object(struct tile_array* ta, struct render_object *r);
60 void tile_set_array_size(struct tile_array* ta, gint width, gint height);
62 #endif