summaryrefslogtreecommitdiff
path: root/map.h
blob: 58d80937570cf823980fee43d6cddd688928eea3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef map_h
#define map_h

#include "config.h"
#include "render.h"

typedef struct Map {
	int w, h;
} Map;

typedef struct {
	Colour u, d;
	Colour side[4]; /* left, right, north, south */
} Map_Fragment;

typedef struct {
	int x, y, z;
	int brightness;
	Colour c;
} Map_Light;

typedef struct {
	Map_Fragment fragments[map_light_tile_size * map_light_tile_size];
} Map_Light_Tile;

typedef unsigned Map_Tile;

int map_size(int w, int h);
Map_Tile* map_tiles(Map* m);
const Map_Tile* map_tilesc(const Map* m);
Map_Light_Tile* map_light_tiles(Map* m);
const Map_Light_Tile* map_light_tilesc(const Map* m);
void bake_map(Map* m);
const Map_Fragment* sample_map_light(
	const Map* m, 
	int tx,
	int ty,
	int u,
	int v
);

#endif