twn_fog.c: fog added!

This commit is contained in:
2024-10-01 16:10:36 +03:00
parent edc6fb1e5c
commit ad0438849e
7 changed files with 76 additions and 0 deletions

34
src/rendering/twn_fog.c Normal file
View File

@ -0,0 +1,34 @@
#include "twn_rendering.h"
#include "twn_rendering_c.h"
#include "twn_util.h"
#include <stdbool.h>
static float start_cache, end_cache, density_cache;
static Color color_cache;
static bool fog_used = false;
void push_fog(float start, float end, float density, Color color) {
start_cache = start;
end_cache = end;
density_cache = density;
color_cache = color;
fog_used = true;
}
void apply_fog(void) {
if (!fog_used)
return;
finally_apply_fog(start_cache, end_cache, density_cache, color_cache);
}
void pop_fog(void) {
if (!fog_used)
return;
finally_pop_fog();
}