#ifndef RT_MATH_H
#define RT_MATH_H

/* Math types and functions */
#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#elif defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4201) /* anonymous struct */
#endif

/* 2d vector */
typedef union {
    struct {
        float x;
        float y;
    };
    float e[2];
} rt_v2;

typedef union {
    struct {
        int x;
        int y;
    };
    int e[2];
} rt_v2i;

/* 3d vector */
typedef union {
    struct {
        float x;
        float y;
        float z;
    };
    float e[3];
} rt_v3;

typedef union {
    struct {
        int x;
        int y;
        int z;
    };
    int e[3];
} rt_v3i;

/* 2d rectangle defined by its upper left corner and its size. */
typedef struct {
    rt_v2 offset;
    rt_v2 size;
} rt_rect2;

typedef struct {
    rt_v2i offset;
    rt_v2i size;
} rt_rect2i;

#if defined(__GNUC__) || defined(__clang__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning(pop)
#endif

#endif
