summaryrefslogtreecommitdiff
path: root/include/engine/fov.h
blob: 3af421e79d20085422de20ea63c420d7fcd97302 (plain)
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
#ifndef ENGINE_FOV_H
#define ENGINE_FOV_H

#include <stdbool.h>
#include "types.h"
#include "vector.h"

/* `fov_shadowcast`: */
/*   map:         your 2D enum tile grid
 *   mapsize:     x: width, y: height of the map
 *   visblocking: pointer to a function that returns `true` when receiving a
 *                pointer to a LOS blocking tile
 *   lightmap:    [out] 2D lightmap, this is simply overwritten with the distance to
 *                the source.
 *   range:       visibility range/radius.
 *   src:         2D point to calculate FOV from
 *   */
void fov_shadowcast(
	const void *map,
	const v2_i32 mapsize,
	bool (*visblocking)(const void*),
	i32 *lightmap,
	const i32 range,
	v2_i32 src);

#endif