#ifndef PRB_TYPES_H #define PRB_TYPES_H typedef int8_t S8; typedef int16_t S16; typedef int32_t S32; typedef int64_t S64; typedef uint8_t U8; typedef uint16_t U16; typedef uint32_t U32; typedef uint64_t U64; typedef S32 B32; typedef float F32; typedef double F64; /* NOTE(pryazha): The library uses a right-handed coordiante system (for now) */ typedef struct { F32 x, y; } V2; #define V2_ZERO (V2){ 0.0f, 0.0f } #define V2_ONE (V2){ 1.0f, 1.0f } #define V2_RIGHT (V2){ 1.0f, 0.0f } #define V2_UP (V2){ 0.0f, 1.0f } #define V2_LEFT (V2){-1.0f, 0.0f } #define V2_DOWN (V2){ 0.0f, -1.0f } typedef struct { F32 x, y, z; } V3; #define V3_ZERO (V3){ 0.0f, 0.0f, 0.0f } #define V3_ONE (V3){ 1.0f, 1.0f, 1.0f } #define V3_RIGHT (V3){ 1.0f, 0.0f, 0.0f } #define V3_UP (V3){ 0.0f, 1.0f, 0.0f } #define V3_LEFT (V3){-1.0f, 0.0f, 0.0f } #define V3_DOWN (V3){ 0.0f, -1.0f, 0.0f } #define V3_FORWARD (V3){ 0.0f, 0.0f, 1.0f } #define V3_BACKWARD (V3){ 0.0f, 0.0f, -1.0f } typedef struct { F32 x, y, z, w; } V4; #define V4_ZERO (V4){ 0.0f, 0.0f, 0.0f, 0.0f } #define V4_ONE (V4){ 1.0f, 1.0f, 1.0f, 1.0f } typedef struct { V4 m0, m1, m2, m3; } Mat4; #define MAT4_IDENTITY (Mat4) { \ { 1.0f, 0.0f, 0.0f, 0.0f }, \ { 0.0f, 1.0f, 0.0f, 0.0f }, \ { 0.0f, 0.0f, 1.0f, 0.0f }, \ { 0.0f, 0.0f, 0.0f, 1.0f } } typedef struct { U8 *mem; U64 cap; U64 used; } Arena; /* NOTE(pryazha): Strings */ typedef struct { U8 *ptr; U64 length; } Str8; typedef struct Str8Node { Str8 str; struct Str8Node *next; struct Str8Node *prev; } Str8Node; typedef struct { Str8Node *first; Str8Node *last; U64 total_length; U32 node_count; } Str8List; #endif /* PRB_TYPES_H */