add colored lighting back in via the colormap

This commit is contained in:
asrael 2026-02-05 03:27:35 -06:00
parent 01e6059dd1
commit a29a6018b8
16 changed files with 149 additions and 466 deletions

View file

@ -33,16 +33,16 @@ void pxl8_lights_destroy(pxl8_lights* lights) {
pxl8_free(lights);
}
void pxl8_lights_add(pxl8_lights* lights, f32 x, f32 y, f32 z, u8 r, u8 g, u8 b, u8 intensity, f32 radius) {
(void)r; (void)g; (void)b;
void pxl8_lights_add(pxl8_lights* lights, f32 x, f32 y, f32 z, u8 color, u8 intensity, f32 radius) {
if (!lights || lights->count >= lights->capacity) return;
f32 radius_sq = radius * radius;
pxl8_light* l = &lights->data[lights->count++];
l->color = color;
l->intensity = (f32)intensity / 255.0f;
l->inv_radius_sq = radius_sq > 0.0f ? 1.0f / radius_sq : 0.0f;
l->position = (pxl8_vec3){{x, y, z}};
l->radius_sq = radius_sq;
l->inv_radius_sq = radius_sq > 0.0f ? 1.0f / radius_sq : 0.0f;
l->intensity = (f32)intensity / 255.0f;
}
void pxl8_lights_clear(pxl8_lights* lights) {