Allow reading vec3_whatever_t as vec2 directly

It's a union in a struct in a union in a struct. Oh god, what have I done.

git-svn-id: https://svn.eduke32.com/eduke32@7830 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-07-24 01:38:05 +00:00 committed by Christoph Oelckers
parent 52db0e37f7
commit 490b7249a2

View file

@ -837,17 +837,28 @@ typedef struct {
} vec2d_t;
typedef struct MAY_ALIAS {
int32_t x, y, z;
union {
struct { int32_t x, y, z; };
vec2_t vec2;
};
} vec3_t;
typedef struct MAY_ALIAS {
int16_t x, y, z;
union {
struct { int16_t x, y, z; };
vec2_16_t vec2;
};
} vec3_16_t;
typedef struct {
union { float x; float d; };
union { float y; float u; };
union { float z; float v; };
union {
struct {
union { float x, d; };
union { float y, u; };
union { float z, v; };
};
vec2f_t vec2;
};
} vec3f_t;
EDUKE32_STATIC_ASSERT(sizeof(vec3f_t) == sizeof(float) * 3);