36 lines
710 B
C
36 lines
710 B
C
#include "twn_draw.h"
|
|
#include "twn_draw_c.h"
|
|
|
|
#include <SDL2/SDL.h>
|
|
#include <stb_ds.h>
|
|
|
|
static char *paths_in_use;
|
|
|
|
void draw_skybox(const char *paths) {
|
|
if (paths_in_use && SDL_strcmp(paths, paths_in_use) == 0)
|
|
return;
|
|
|
|
if (paths_in_use)
|
|
SDL_free(paths_in_use);
|
|
|
|
paths_in_use = SDL_strdup(paths);
|
|
}
|
|
|
|
|
|
void render_skybox(void) {
|
|
if (!paths_in_use)
|
|
return;
|
|
|
|
/* note: ownership of 'paths_in_use' goes there */
|
|
DeferredCommand command = {
|
|
.type = DEFERRED_COMMAND_TYPE_DRAW_SKYBOX,
|
|
.draw_skybox = (DeferredCommandDrawSkybox){
|
|
.paths = paths_in_use
|
|
}
|
|
};
|
|
|
|
arrpush(deferred_commands, command);
|
|
|
|
paths_in_use = NULL;
|
|
}
|