From b0a5f59fe3bea9aab8f52016a90b6cbbcaea4571 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 4 Aug 2024 15:34:05 +1000 Subject: WIP lightmap baking --- map.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'map.h') diff --git a/map.h b/map.h index 9e2a413..566b367 100644 --- a/map.h +++ b/map.h @@ -1,14 +1,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; + 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 -- cgit v1.2.3-54-g00ecf