Add array access to Triangle struct

This commit is contained in:
Abdelrahman Said 2024-09-01 02:13:53 +01:00
parent 18e9964d33
commit da495d9e43

View File

@ -2,6 +2,7 @@
#define OBJ_H
#include "aliases.h"
#include "constants.h"
#include "img.h"
#include "mem_arena.h"
#include "typed_list.h"
@ -12,15 +13,30 @@
typedef struct triangle Triangle;
struct triangle {
u64 p0;
u64 p1;
u64 p2;
u64 n0;
u64 n1;
u64 n2;
u64 tx0;
u64 tx1;
u64 tx2;
union {
u64 positions[TRIANGLE_VERTICES];
struct {
u64 p0;
u64 p1;
u64 p2;
};
};
union {
u64 normals[TRIANGLE_VERTICES];
struct {
u64 n0;
u64 n1;
u64 n2;
};
};
union {
u64 coordinates[TRIANGLE_VERTICES];
struct {
u64 tx0;
u64 tx1;
u64 tx2;
};
};
};
MAKE_LIST_TYPE(Triangle);