/**
 * @file vulkan_global.h
 * @author Piotr Krygier (everyonecancode@gmail.com)
 * @brief Declaration of a structure holding Vulkan variables needed by different parts of the code
 * @version 0.1
 * @date 2023-03-28
 *
 * @copyright Copyright (c) 2023
 *
 */

#ifndef VULKAN_GLOBAL_H
#define VULKAN_GLOBAL_H

#include <cglm/types.h>
#include <vulkan/vulkan.h>
#include <vma/vk_mem_alloc.h>
#include <cglm/cglm.h>

#include <stdalign.h>

#define SWAP_BUFFER_COUNT 3U

/**
 * @brief Represents single vertex on the screen
 *
 */
struct vertex_t
{
    vec3 pos;
    vec3 color;
    vec2 tex_coords;
};

/**
 * @brief Wrapper for Vulkan buffer. Holds allocation data;
 *
 */
struct vulkan_buffer_t
{
    size_t allocated_size;
    VkBuffer buffer;
    VmaAllocation allocation;
    VmaAllocationInfo allocation_info;
};

struct mvp_data_t
{
    alignas(16) mat4 model;
    alignas(16) mat4 view;
    alignas(16) mat4 proj;
};

struct instance_data_t {
    alignas(16) vec3 pos;
    alignas(16) vec3 rot;
    alignas(4) float scale;
    alignas(4) uint32_t texture_id;
};

void init_time(void);
void update_time(void);
float get_time_diff(void);

#endif /* VULKAN_GLOBAL_H */
