#pragma once

#include <core_render_types.h>
#include <math/geometry.h>

typedef struct skybox_config {
	/** @brief The name of the cubemap to be used for the skybox. */
	kname cubemap_name;
} skybox_config;

typedef enum skybox_state {
	SKYBOX_STATE_UNDEFINED,
	SKYBOX_STATE_CREATED,
	SKYBOX_STATE_INITIALIZED,
	SKYBOX_STATE_LOADING,
	SKYBOX_STATE_LOADED
} skybox_state;

typedef struct skybox {
	skybox_state state;

	kname cubemap_name;
	ktexture cubemap;

	kgeometry geometry;
	u32 shader_set0_instance_id;
} skybox;

/**
 * @brief Attempts to create a skybox using the specified parameters.
 *
 * @param config The configuration to be used when creating the skybox.
 * @param out_skybox A pointer to hold the newly-created skybox.
 * @return True on success; otherwise false.
 */
KAPI b8 skybox_create (skybox_config config, skybox *out_skybox);

KAPI b8 skybox_initialize (skybox *sb);

KAPI b8 skybox_load (skybox *sb);

KAPI b8 skybox_unload (skybox *sb);

/**
 * @brief Destroys the provided skybox.
 *
 * @param sb A pointer to the skybox to be destroyed.
 */
KAPI void skybox_destroy (skybox *sb);
