diff options
author | Trumeet <yuuta@yuuta.moe> | 2021-11-21 20:44:56 -0800 |
---|---|---|
committer | Trumeet <yuuta@yuuta.moe> | 2021-11-21 20:44:56 -0800 |
commit | d8d478e4346d7f9b106d50728d840b1a171106f4 (patch) | |
tree | 3b9dbff28113bab8d1783ad606ab0d3ae39eff1a /common.h | |
parent | 844dc6a239f3b23cc861b38f0c84f9f7fb7036d8 (diff) | |
download | mcal-d8d478e4346d7f9b106d50728d840b1a171106f4.tar mcal-d8d478e4346d7f9b106d50728d840b1a171106f4.tar.gz mcal-d8d478e4346d7f9b106d50728d840b1a171106f4.tar.bz2 mcal-d8d478e4346d7f9b106d50728d840b1a171106f4.zip |
feat(expexc): support input dimensions and dimensions + positions
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -6,7 +6,7 @@ #include <assert.h> #include <math.h> -enum val_type { VEC3D, BOX }; +enum val_type { VEC3D, BOX, ENTITY_DIMEN }; struct val { enum val_type type; @@ -29,6 +29,12 @@ struct box { double max_z; }; +struct entity_dimen { + enum val_type type; + double width; + double height; +}; + static inline double *val_get_index(struct val *val, int index) { switch (val->type) @@ -54,6 +60,14 @@ static inline double *val_get_index(struct val *val, int index) case 5: return &v_box->max_z; default: assert(0); } + case ENTITY_DIMEN: + struct entity_dimen *v_dimen = (struct entity_dimen *)val; + switch (index) + { + case 0: return &v_dimen->width; + case 1: return &v_dimen->height; + default: assert(0); + } default: assert(0); } @@ -72,6 +86,9 @@ static int val_parse(char *in, struct val *o) case BOX: required_vars = 6; break; + case ENTITY_DIMEN: + required_vars = 2; + break; } while (p != NULL) { |