aligned for vectorization commor primitives, uint32_t cast for color comparison in batch collection

This commit is contained in:
2024-07-28 22:17:53 +03:00
parent c9f4f85fce
commit 8846e788b2
3 changed files with 17 additions and 9 deletions

View File

@@ -70,6 +70,7 @@ bool strends(const char *str, const char *suffix);
/* 32-bit color data */
typedef struct color {
_Alignas(4)
uint8_t r;
uint8_t g;
uint8_t b;
@@ -85,14 +86,19 @@ typedef struct vec2 {
/* a point in some space (floating point) */
typedef struct fvec2 {
float x, y;
_Alignas(8)
float x;
float y;
} t_fvec2;
/* a point in some three dimension space (floating point) */
/* y goes up, x goes to the right */
typedef struct fvec3 {
float x, y, z;
_Alignas(8)
float x;
float y;
float z;
} t_fvec3;
@@ -111,8 +117,11 @@ typedef struct rect {
/* a rectangle with the origin at the upper left (floating point) */
typedef struct frect {
float x, y;
float w, h;
_Alignas(16)
float x;
float y;
float w;
float h;
} t_frect;