orca/src/util/typedefs.h

106 lines
1.4 KiB
C
Raw Normal View History

2023-09-07 12:51:48 +00:00
/*************************************************************************
*
* Orca
* Copyright 2023 Martin Fouilleul and the Orca project contributors
* See LICENSE.txt for licensing information
*
**************************************************************************/
2022-08-14 16:19:40 +00:00
#ifndef __TYPEDEFS_H_
#define __TYPEDEFS_H_
2023-08-19 12:49:23 +00:00
#include <float.h> //FLT_MAX/MIN etc...
#include <stddef.h>
#include <stdint.h>
2022-08-14 16:19:40 +00:00
#ifndef __cplusplus
2023-08-19 12:49:23 +00:00
#include <stdbool.h>
2022-08-14 16:19:40 +00:00
#endif //__cplusplus
2023-08-19 12:49:23 +00:00
typedef uint8_t byte;
typedef uint8_t u8;
2022-08-14 16:19:40 +00:00
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
2023-08-19 12:49:23 +00:00
typedef int8_t i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
2022-08-14 16:19:40 +00:00
2023-08-19 12:49:23 +00:00
typedef float f32;
typedef double f64;
2022-08-14 16:19:40 +00:00
typedef union
{
2023-08-19 12:49:23 +00:00
struct
{
f32 x;
f32 y;
};
f32 c[2];
} oc_vec2;
typedef union
{
2023-08-19 12:49:23 +00:00
struct
{
f32 x;
f32 y;
f32 z;
};
f32 c[3];
} oc_vec3;
2022-08-14 16:19:40 +00:00
typedef union
{
2023-08-19 12:49:23 +00:00
struct
{
i32 x;
i32 y;
};
i32 c[2];
} oc_vec2i;
2022-08-14 16:19:40 +00:00
typedef union
{
2023-08-19 12:49:23 +00:00
struct
{
f32 x;
f32 y;
f32 z;
f32 w;
};
f32 c[4];
} oc_vec4;
2022-08-14 16:19:40 +00:00
typedef struct oc_mat2x3
{
2023-08-19 12:49:23 +00:00
f32 m[6];
} oc_mat2x3;
2022-08-14 16:19:40 +00:00
typedef union
{
2023-08-19 12:49:23 +00:00
struct
{
f32 x;
f32 y;
f32 w;
f32 h;
};
struct
{
oc_vec2 xy;
oc_vec2 wh;
};
f32 c[4];
} oc_rect;
2022-08-14 16:19:40 +00:00
#endif //__TYPEDEFS_H_