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 #define OBJ_H
#include "aliases.h" #include "aliases.h"
#include "constants.h"
#include "img.h" #include "img.h"
#include "mem_arena.h" #include "mem_arena.h"
#include "typed_list.h" #include "typed_list.h"
@ -12,16 +13,31 @@
typedef struct triangle Triangle; typedef struct triangle Triangle;
struct triangle { struct triangle {
union {
u64 positions[TRIANGLE_VERTICES];
struct {
u64 p0; u64 p0;
u64 p1; u64 p1;
u64 p2; u64 p2;
};
};
union {
u64 normals[TRIANGLE_VERTICES];
struct {
u64 n0; u64 n0;
u64 n1; u64 n1;
u64 n2; u64 n2;
};
};
union {
u64 coordinates[TRIANGLE_VERTICES];
struct {
u64 tx0; u64 tx0;
u64 tx1; u64 tx1;
u64 tx2; u64 tx2;
}; };
};
};
MAKE_LIST_TYPE(Triangle); MAKE_LIST_TYPE(Triangle);