Files
townengine/src/rendering/twn_fog.c

50 lines
966 B
C

#include "twn_draw.h"
#include "twn_draw_c.h"
#include <stb_ds.h>
#include <stdbool.h>
static float start_cache, end_cache, density_cache;
static Color color_cache;
static bool fog_used = false;
void draw_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;
DeferredCommand command = {
.type = DEFERRED_COMMAND_TYPE_APPLY_FOG,
.apply_fog = (DeferredCommandApplyFog){
.start = start_cache,
.end = end_cache,
.density = density_cache,
.color = color_cache
}
};
arrpush(deferred_commands, command);
}
void pop_fog(void) {
if (!fog_used)
return;
DeferredCommand command = {
.type = DEFERRED_COMMAND_TYPE_POP_FOG,
};
arrpush(deferred_commands, command);
}