summaryrefslogtreecommitdiff
path: root/libs/pwyazh/types.h
blob: 1e16449f1b0270bba2880c24ddd34f4d46549732 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef TYPES_H
#define TYPES_H

/* NOTE(pryazha): Basic types */

#include <stdint.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;

typedef struct {
    F32 x, y;
} V2F;

typedef struct {
    F32 x, y, z;
} V3F;

typedef struct {
    F32 x, y, z, w;
} V4F;

/* NOTE(pryazha): column-major order */
typedef struct {
    V4F m0, m1, m2, m3;
} MAT4;

typedef struct {
    U8 *memory;
    U64 capacity;
    U64 used;
} Arena;

/* NOTE(pryazha): String types */
typedef struct {
    U8 *str;
    U64 size;
} String8;

typedef struct {
    struct String8Node *next;
    String8 string;
} String8Node;

typedef struct {
    String8Node *first;
    String8Node *last;
} String8List;

typedef struct {
    V3F pos;
    V3F normal;
    V2F tex_coords;
} Vertex;

typedef struct {
    U32 vao;
    Vertex *vertices;
    U32 vertex_count;
    U32 *indices;
    U32 index_count;
} Mesh;

static F32 pi_F32 = 3.14159265359f;

#endif /* TYPES_H */