#pragma once #include "pxl8_palette.h" #include "pxl8_types.h" #ifdef __cplusplus extern "C" { #endif #define PXL8_CUBE_SIZE 32 #define PXL8_CUBE_ENTRIES (PXL8_CUBE_SIZE * PXL8_CUBE_SIZE * PXL8_CUBE_SIZE) #define PXL8_BLEND_TABLE_SIZE (256 * 256) #define PXL8_OVERBRIGHT_LEVELS 16 #define PXL8_OVERBRIGHT_TABLE_SIZE (256 * PXL8_OVERBRIGHT_LEVELS) typedef struct pxl8_additive_table pxl8_additive_table; typedef struct pxl8_overbright_table pxl8_overbright_table; typedef struct pxl8_palette_cube pxl8_palette_cube; pxl8_additive_table* pxl8_additive_table_create(const pxl8_palette* pal); void pxl8_additive_table_destroy(pxl8_additive_table* table); void pxl8_additive_table_rebuild(pxl8_additive_table* table, const pxl8_palette* pal); u8 pxl8_additive_blend(const pxl8_additive_table* table, u8 src, u8 dst); pxl8_overbright_table* pxl8_overbright_table_create(const pxl8_palette* pal); void pxl8_overbright_table_destroy(pxl8_overbright_table* table); void pxl8_overbright_table_rebuild(pxl8_overbright_table* table, const pxl8_palette* pal); u8 pxl8_overbright_lookup(const pxl8_overbright_table* table, u8 pal_idx, f32 emissive); pxl8_palette_cube* pxl8_palette_cube_create(const pxl8_palette* pal); void pxl8_palette_cube_destroy(pxl8_palette_cube* cube); void pxl8_palette_cube_rebuild(pxl8_palette_cube* cube, const pxl8_palette* pal); u8 pxl8_palette_cube_lookup(const pxl8_palette_cube* cube, u8 r, u8 g, u8 b); u8 pxl8_palette_cube_lookup_stable(const pxl8_palette_cube* cube, u8 r, u8 g, u8 b); void pxl8_palette_cube_get_rgb(const pxl8_palette_cube* cube, u8 idx, u8* r, u8* g, u8* b); #ifdef __cplusplus } #endif