From f306fe1a1c3db5f01e0a7f8504e262f2e4a96de9 Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Tue, 21 Feb 2023 21:49:21 -0800 Subject: [PATCH] Remove HMM_ prefix, MUCH better factoring of draw --- assets.mdesk | 2 +- assets/testsmalllevel.json | 16 +- main.c | 601 ++++---- thirdparty/HandmadeMath.h | 2707 ++++++++++++++++++------------------ 4 files changed, 1718 insertions(+), 1608 deletions(-) diff --git a/assets.mdesk b/assets.mdesk index 30ece97..e9820de 100644 --- a/assets.mdesk +++ b/assets.mdesk @@ -29,5 +29,5 @@ } @level level0: { - filepath: "testsmalllevel.json", + filepath: "level0.json", } diff --git a/assets/testsmalllevel.json b/assets/testsmalllevel.json index 1b64a05..1033133 100644 --- a/assets/testsmalllevel.json +++ b/assets/testsmalllevel.json @@ -4,13 +4,13 @@ "layers":[ { "data":[53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 263, 263, 263, 53, 53, 53, - 53, 53, 263, 263, 263, 53, 53, 53, - 53, 53, 263, 263, 263, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53], + 53, 209, 159, 159, 159, 160, 209, 160, + 53, 261, 263, 263, 263, 265, 261, 265, + 53, 261, 263, 263, 263, 265, 261, 265, + 53, 261, 263, 263, 263, 212, 210, 265, + 53, 366, 367, 367, 314, 263, 316, 368, + 53, 53, 53, 53, 366, 367, 368, 53, + 53, 53, 53, 53, 53, 53, 53, 53], "height":8, "id":1, "name":"Tile Layer 1", @@ -62,4 +62,4 @@ "type":"map", "version":"1.9", "width":8 -} \ No newline at end of file +} diff --git a/main.c b/main.c index 802d8a8..693b053 100644 --- a/main.c +++ b/main.c @@ -18,10 +18,25 @@ typedef struct AABB { - HMM_Vec2 upper_left; - HMM_Vec2 lower_right; + Vec2 upper_left; + Vec2 lower_right; } AABB; +typedef struct Quad +{ + union + { + struct + { + Vec2 ul; // upper left + Vec2 ur; // upper right + Vec2 lr; // lower right + Vec2 ll; // lower left + }; + Vec2 points[4]; + }; +} Quad; + typedef struct TileInstance { uint16_t kind; @@ -45,9 +60,9 @@ typedef struct AnimatedSprite sg_image *img; double time_per_frame; int num_frames; - HMM_Vec2 start; + Vec2 start; float horizontal_diff_btwn_frames; - HMM_Vec2 region_size; + Vec2 region_size; } AnimatedSprite; @@ -56,7 +71,7 @@ typedef struct AnimatedSprite typedef struct Level { TileInstance tiles[LEVEL_TILES][LEVEL_TILES]; - HMM_Vec2 spawnpoint; + Vec2 spawnpoint; } Level; typedef struct TileCoord @@ -65,12 +80,63 @@ typedef struct TileCoord int y; } TileCoord; -HMM_Vec2 tilecoord_to_world(TileCoord t) +// no alignment etc because lazy +typedef struct Arena +{ + char *data; + size_t data_size; + size_t cur; +} Arena; + +Arena make(size_t max_size) +{ + return (Arena) + { + .data = calloc(1, max_size), + .data_size = max_size, + .cur = 0, + }; +} + +void reset(Arena *a) +{ + memset(a->data, 0, a->data_size); + a->cur = 0; +} + +char *get(Arena *a, size_t of_size) +{ + assert(a->data != NULL); + char *to_return = a->data + a->cur; + a->cur += of_size; + assert(a->cur < a->data_size); + return to_return; +} + +Arena scratch = {0}; + +char *tprint(const char *format, ...) +{ + va_list argptr; + va_start(argptr, format); + + int size = vsnprintf(NULL, 0, format, argptr) + 1; // for null terminator + + char *to_return = get(&scratch, size); + + vsnprintf(to_return, size, format, argptr); + + va_end(argptr); + + return to_return; +} + +Vec2 tilecoord_to_world(TileCoord t) { - return HMM_V2( (float)t.x * (float)TILE_SIZE * 1.0f, -(float)t.y * (float)TILE_SIZE * 1.0f ); + return V2( (float)t.x * (float)TILE_SIZE * 1.0f, -(float)t.y * (float)TILE_SIZE * 1.0f ); } -TileCoord world_to_tilecoord(HMM_Vec2 w) +TileCoord world_to_tilecoord(Vec2 w) { // world = V2(tilecoord.x * tile_size, -tilecoord.y * tile_size) // world.x = tilecoord.x * tile_size @@ -80,43 +146,49 @@ TileCoord world_to_tilecoord(HMM_Vec2 w) return (TileCoord){ (int)floorf(w.X / TILE_SIZE), (int)floorf(-w.Y / TILE_SIZE) }; } + AABB tile_aabb(TileCoord t) { return (AABB) { .upper_left = tilecoord_to_world(t), - .lower_right = HMM_AddV2(tilecoord_to_world(t), HMM_V2(TILE_SIZE, -TILE_SIZE)), + .lower_right = AddV2(tilecoord_to_world(t), V2(TILE_SIZE, -TILE_SIZE)), }; } -HMM_Vec2 aabb_center(AABB aabb) +Vec2 rotate_counter_clockwise(Vec2 v) +{ + return V2(-v.Y, v.X); +} + +Vec2 aabb_center(AABB aabb) { - return HMM_MulV2F(HMM_AddV2(aabb.upper_left, aabb.lower_right), 0.5f); + return MulV2F(AddV2(aabb.upper_left, aabb.lower_right), 0.5f); } -AABB centered_aabb(HMM_Vec2 at, HMM_Vec2 size) +AABB centered_aabb(Vec2 at, Vec2 size) { return (AABB){ - .upper_left = HMM_AddV2(at, HMM_V2(-size.X/2.0f, size.Y/2.0f)), - .lower_right = HMM_AddV2(at, HMM_V2( size.X/2.0f, -size.Y/2.0f)), + .upper_left = AddV2(at, V2(-size.X/2.0f, size.Y/2.0f)), + .lower_right = AddV2(at, V2( size.X/2.0f, -size.Y/2.0f)), }; } -uint16_t get_tile(Level *l, TileCoord t) +TileInstance get_tile(Level *l, TileCoord t) { bool out_of_bounds = false; out_of_bounds |= t.x < 0; out_of_bounds |= t.x >= LEVEL_TILES; out_of_bounds |= t.y < 0; out_of_bounds |= t.y >= LEVEL_TILES; - if(out_of_bounds) return 0; - return l->tiles[t.x][t.y].kind; + //assert(!out_of_bounds); + if(out_of_bounds) return (TileInstance){0}; + return l->tiles[t.y][t.x]; } sg_image load_image(const char *path) { - sg_image to_return = - {0}; + sg_image to_return = {0}; int png_width, png_height, num_channels; const int desired_channels = 4; @@ -175,8 +247,7 @@ const float font_size = 32.0; stbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs // so can be grep'd and removed -#define dbgprint(...) -{ printf("Debug | %s:%d | ", __FILE__, __LINE__); printf(__VA_ARGS__); } +#define dbgprint(...) { printf("Debug | %s:%d | ", __FILE__, __LINE__); printf(__VA_ARGS__); } static struct { @@ -185,24 +256,24 @@ static struct sg_bindings bind; } state; -HMM_Vec2 character_pos = +Vec2 character_pos = {0}; // world space point void init(void) { + scratch = make(1024 * 10); stm_setup(); - sg_setup(&(sg_desc){ - .context = sapp_sgcontext() - }); + sg_setup(& (sg_desc){ + .context = sapp_sgcontext() + }); load_assets(); // player spawnpoint - HMM_Vec2 spawnpoint_tilecoord = HMM_MulV2F(level_level0.spawnpoint, 1.0/TILE_SIZE); + Vec2 spawnpoint_tilecoord = MulV2F(level_level0.spawnpoint, 1.0/TILE_SIZE); character_pos = tilecoord_to_world((TileCoord){(int)spawnpoint_tilecoord.X, (int)spawnpoint_tilecoord.Y}); // load font - { FILE* fontFile = fopen("assets/orange kid.ttf", "rb"); fseek(fontFile, 0, SEEK_END); @@ -287,17 +358,15 @@ void init(void) state.pass_action = (sg_pass_action) { - //.colors[0] = - { .action=SG_ACTION_CLEAR, .value={12.5f/255.0f, 12.5f/255.0f, 12.5f/255.0f, 1.0f } } - //.colors[0] = - { .action=SG_ACTION_CLEAR, .value={255.5f/255.0f, 255.5f/255.0f, 255.5f/255.0f, 1.0f } } + //.colors[0] = { .action=SG_ACTION_CLEAR, .value={12.5f/255.0f, 12.5f/255.0f, 12.5f/255.0f, 1.0f } } + //.colors[0] = { .action=SG_ACTION_CLEAR, .value={255.5f/255.0f, 255.5f/255.0f, 255.5f/255.0f, 1.0f } } // 0x898989 is the color in tiled .colors[0] = { .action=SG_ACTION_CLEAR, .value={137.0f/255.0f, 137.0f/255.0f, 137.0f/255.0f, 1.0f } } }; } -typedef HMM_Vec4 Color; +typedef Vec4 Color; #define WHITE (Color){1.0f, 1.0f, 1.0f, 1.0f} @@ -305,14 +374,14 @@ typedef HMM_Vec4 Color; #define RED (Color){1.0f, 0.0f, 0.0f, 1.0f} -HMM_Vec2 screen_size() +Vec2 screen_size() { - return HMM_V2((float)sapp_width(), (float)sapp_height()); + return V2((float)sapp_width(), (float)sapp_height()); } typedef struct Camera { - HMM_Vec2 pos; + Vec2 pos; float scale; } Camera; @@ -323,16 +392,16 @@ const float pixels_per_meter = 43.0f; Camera cam = {.scale = 2.0f }; -HMM_Vec2 cam_offset() +Vec2 cam_offset() { - return HMM_AddV2(cam.pos, HMM_MulV2F(screen_size(), 0.5f)); + return AddV2(cam.pos, MulV2F(screen_size(), 0.5f)); } // in pixels -HMM_Vec2 img_size(sg_image img) +Vec2 img_size(sg_image img) { sg_image_info info = sg_query_image_info(img); - return HMM_V2((float)info.width, (float)info.height); + return V2((float)info.width, (float)info.height); } // full region in pixels @@ -340,52 +409,75 @@ AABB full_region(sg_image img) { return (AABB) { - .upper_left = HMM_V2(0.0f, 0.0f), + .upper_left = V2(0.0f, 0.0f), .lower_right = img_size(img), }; } // screen coords are in pixels counting from bottom left as (0,0), Y+ is up -HMM_Vec2 world_to_screen(HMM_Vec2 world) +Vec2 world_to_screen(Vec2 world) { - HMM_Vec2 to_return = world; - to_return = HMM_MulV2F(to_return, cam.scale); - to_return = HMM_AddV2(to_return, cam_offset()); + Vec2 to_return = world; + to_return = MulV2F(to_return, cam.scale); + to_return = AddV2(to_return, cam_offset()); return to_return; } -HMM_Vec2 screen_to_world(HMM_Vec2 screen) +Vec2 screen_to_world(Vec2 screen) { - HMM_Vec2 to_return = screen; - to_return = HMM_SubV2(to_return, cam_offset()); - to_return = HMM_MulV2F(to_return, 1.0f/cam.scale); + Vec2 to_return = screen; + to_return = SubV2(to_return, cam_offset()); + to_return = MulV2F(to_return, 1.0f/cam.scale); return to_return; } -// out must be of at least length 4 -void quad_points_corner_size(HMM_Vec2 *out, HMM_Vec2 at, HMM_Vec2 size) + +Quad quad_at(Vec2 at, Vec2 size) { - out[0] = HMM_V2(0.0, 0.0); - out[1] = HMM_V2(size.X, 0.0); - out[2] = HMM_V2(size.X, -size.Y); - out[3] = HMM_V2(0.0, -size.Y); + Quad to_return; + + to_return.points[0] = V2(0.0, 0.0); + to_return.points[1] = V2(size.X, 0.0); + to_return.points[2] = V2(size.X, -size.Y); + to_return.points[3] = V2(0.0, -size.Y); for(int i = 0; i < 4; i++) { - out[i] = HMM_AddV2(out[i], at); + to_return.points[i] = AddV2(to_return.points[i], at); } + return to_return; +} + +Quad tile_quad(TileCoord coord) +{ + return quad_at(tilecoord_to_world(coord), V2(TILE_SIZE, TILE_SIZE)); } // out must be of at least length 4 -void quad_points_centered_size(HMM_Vec2 *out, HMM_Vec2 at, HMM_Vec2 size) +Quad quad_centered(Vec2 at, Vec2 size) { - quad_points_corner_size(out, at, size); + Quad to_return = quad_at(at, size); for(int i = 0; i < 4; i++) { - out[i] = HMM_AddV2(out[i], HMM_V2(-size.X*0.5f, size.Y*0.5f)); + to_return.points[i] = AddV2(to_return.points[i], V2(-size.X*0.5f, size.Y*0.5f)); } + return to_return; } +Quad quad_aabb(AABB aabb) +{ + Vec2 size_vec = SubV2(aabb.lower_right, aabb.upper_left); // negative in vertical direction + assert(size_vec.Y <= 0.0f); + assert(size_vec.X >= 0.0f); + return (Quad) { + .ul = aabb.upper_left, + .ur = AddV2(aabb.upper_left, V2(size_vec.X, 0.0f)), + .lr = AddV2(aabb.upper_left, size_vec), + .ll = AddV2(aabb.upper_left, V2(0.0f, size_vec.Y)), + }; +} + + // both segment_a and segment_b must be arrays of length 2 bool segments_overlapping(float *a_segment, float *b_segment) { @@ -440,11 +532,9 @@ bool overlapping(AABB a, AABB b) // points must be of length 4, and be in the order: upper left, upper right, lower right, lower left // the points are in pixels in screen space. The image region is in pixel space of the image -void draw_quad(bool world_space, HMM_Vec2 *points_in, sg_image image, AABB image_region, Color tint) +void draw_quad(bool world_space, Quad quad, sg_image image, AABB image_region, Color tint) { - HMM_Vec2 points[4] = - {0}; - memcpy(points, points_in, sizeof(points)); + Vec2 *points = quad.points; if(world_space) { @@ -454,9 +544,9 @@ void draw_quad(bool world_space, HMM_Vec2 *points_in, sg_image image, AABB image } } AABB cam_aabb = - { .upper_left = HMM_V2(0.0, screen_size().Y), .lower_right = HMM_V2(screen_size().X, 0.0) }; + { .upper_left = V2(0.0, screen_size().Y), .lower_right = V2(screen_size().X, 0.0) }; AABB points_bounding_box = - { .upper_left = HMM_V2(INFINITY, -INFINITY), .lower_right = HMM_V2(-INFINITY, INFINITY) }; + { .upper_left = V2(INFINITY, -INFINITY), .lower_right = V2(-INFINITY, INFINITY) }; for(int i = 0; i < 4; i++) { @@ -472,26 +562,26 @@ void draw_quad(bool world_space, HMM_Vec2 *points_in, sg_image image, AABB image } float new_vertices[ (2 + 2)*4 ]; - HMM_Vec2 region_size = HMM_SubV2(image_region.lower_right, image_region.upper_left); + Vec2 region_size = SubV2(image_region.lower_right, image_region.upper_left); assert(region_size.X > 0.0); assert(region_size.Y > 0.0); - HMM_Vec2 tex_coords[4] = + Vec2 tex_coords[4] = { - HMM_AddV2(image_region.upper_left, HMM_V2(0.0, 0.0)), - HMM_AddV2(image_region.upper_left, HMM_V2(region_size.X, 0.0)), - HMM_AddV2(image_region.upper_left, HMM_V2(region_size.X, region_size.Y)), - HMM_AddV2(image_region.upper_left, HMM_V2(0.0, region_size.Y)), + AddV2(image_region.upper_left, V2(0.0, 0.0)), + AddV2(image_region.upper_left, V2(region_size.X, 0.0)), + AddV2(image_region.upper_left, V2(region_size.X, region_size.Y)), + AddV2(image_region.upper_left, V2(0.0, region_size.Y)), }; // convert to uv space sg_image_info info = sg_query_image_info(image); for(int i = 0; i < 4; i++) { - tex_coords[i] = HMM_DivV2(tex_coords[i], HMM_V2((float)info.width, (float)info.height)); + tex_coords[i] = DivV2(tex_coords[i], V2((float)info.width, (float)info.height)); } for(int i = 0; i < 4; i++) { - HMM_Vec2 zero_to_one = HMM_DivV2(points[i], screen_size()); - HMM_Vec2 in_clip_space = HMM_SubV2(HMM_MulV2F(zero_to_one, 2.0), HMM_V2(1.0, 1.0)); + Vec2 zero_to_one = DivV2(points[i], screen_size()); + Vec2 in_clip_space = SubV2(MulV2F(zero_to_one, 2.0), V2(1.0, 1.0)); new_vertices[i*4] = in_clip_space.X; new_vertices[i*4 + 1] = in_clip_space.Y; new_vertices[i*4 + 2] = tex_coords[i].X; @@ -515,64 +605,47 @@ void draw_quad(bool world_space, HMM_Vec2 *points_in, sg_image image, AABB image sg_draw(0, 6, 1); } -void swap(HMM_Vec2 *p1, HMM_Vec2 *p2) +void swap(Vec2 *p1, Vec2 *p2) { - HMM_Vec2 tmp = *p1; + Vec2 tmp = *p1; *p1 = *p2; *p2 = tmp; } -void draw_animated_sprite(AnimatedSprite *s, double time, bool flipped, HMM_Vec2 pos, Color tint) +void draw_animated_sprite(AnimatedSprite *s, double time, bool flipped, Vec2 pos, Color tint) { sg_image spritesheet_img = *s->img; int index = (int)floor(time/s->time_per_frame) % s->num_frames; - HMM_Vec2 points[4] = - {0}; - quad_points_centered_size(points, pos, s->region_size); + Quad q = quad_centered(pos, s->region_size); if(flipped) { - swap(&points[0], &points[1]); - swap(&points[3], &points[2]); + swap(&q.points[0], &q.points[1]); + swap(&q.points[3], &q.points[2]); } AABB region; - region.upper_left = HMM_AddV2(s->start, HMM_V2(index * s->horizontal_diff_btwn_frames, 0.0f)); - region.lower_right = HMM_V2(region.upper_left.X + (float)s->region_size.X, (float)s->region_size.Y); + region.upper_left = AddV2(s->start, V2(index * s->horizontal_diff_btwn_frames, 0.0f)); + region.lower_right = V2(region.upper_left.X + (float)s->region_size.X, (float)s->region_size.Y); - draw_quad(true, points, spritesheet_img, region, tint); + draw_quad(true, q, spritesheet_img, region, tint); } -void colorbox(bool world_space, HMM_Vec2 upper_left, HMM_Vec2 lower_right, Color color) -{ - HMM_Vec2 size = HMM_SubV2(lower_right, upper_left); - size.Y *= -1.0; - assert(size.Y >= 0.0); - HMM_Vec2 points[4] = - { - HMM_AddV2(upper_left, HMM_V2(0.0f, 0.0f)), - HMM_AddV2(upper_left, HMM_V2(size.X, 0.0f)), - HMM_AddV2(upper_left, HMM_V2(size.X, -size.Y)), - HMM_AddV2(upper_left, HMM_V2(0.0f, -size.Y)), - }; - draw_quad(world_space, points, image_white_square, full_region(image_white_square), color); -} -HMM_Vec2 tile_id_to_coord(sg_image tileset_image, HMM_Vec2 tile_size, uint16_t tile_id) +Vec2 tile_id_to_coord(sg_image tileset_image, Vec2 tile_size, uint16_t tile_id) { int tiles_per_row = (int)(img_size(tileset_image).X / tile_size.X); int tile_index = tile_id - 1; int tile_image_row = tile_index / tiles_per_row; int tile_image_col = tile_index - tile_image_row*tiles_per_row; - HMM_Vec2 tile_image_coord = HMM_V2((float)tile_image_col * tile_size.X, (float)tile_image_row*tile_size.Y); + Vec2 tile_image_coord = V2((float)tile_image_col * tile_size.X, (float)tile_image_row*tile_size.Y); return tile_image_coord; } // returns bounds. To measure text you can set dry run to true and get the bounds - -AABB draw_text(bool world_space, bool dry_run, const char *text, size_t length, HMM_Vec2 pos, Color color) +AABB draw_text(bool world_space, bool dry_run, const char *text, Vec2 pos, Color color) { size_t text_len = strlen(text); AABB bounds = @@ -587,7 +660,7 @@ AABB draw_text(bool world_space, bool dry_run, const char *text, size_t length, float difference = y - old_y; y = old_y + difference; - HMM_Vec2 size = HMM_V2(q.x1 - q.x0, q.y1 - q.y0); + Vec2 size = V2(q.x1 - q.x0, q.y1 - q.y0); if(text[i] == '\n') { #ifdef DEVTOOLS @@ -599,18 +672,19 @@ AABB draw_text(bool world_space, bool dry_run, const char *text, size_t length, } if(size.Y > 0.0 && size.X > 0.0) { // spaces (and maybe other characters) produce quads of size 0 - HMM_Vec2 points[4] = - { - HMM_AddV2(HMM_V2(q.x0, -q.y0), HMM_V2(0.0f, 0.0f)), - HMM_AddV2(HMM_V2(q.x0, -q.y0), HMM_V2(size.X, 0.0f)), - HMM_AddV2(HMM_V2(q.x0, -q.y0), HMM_V2(size.X, -size.Y)), - HMM_AddV2(HMM_V2(q.x0, -q.y0), HMM_V2(0.0f, -size.Y)), + Quad to_draw = { + .points = { + AddV2(V2(q.x0, -q.y0), V2(0.0f, 0.0f)), + AddV2(V2(q.x0, -q.y0), V2(size.X, 0.0f)), + AddV2(V2(q.x0, -q.y0), V2(size.X, -size.Y)), + AddV2(V2(q.x0, -q.y0), V2(0.0f, -size.Y)), + }, }; AABB font_atlas_region = (AABB) { - .upper_left = HMM_V2(q.s0, q.t0), - .lower_right = HMM_V2(q.s1, q.t1), + .upper_left = V2(q.s0, q.t0), + .lower_right = V2(q.s1, q.t1), }; font_atlas_region.upper_left.X *= img_size(image_font).X; font_atlas_region.lower_right.X *= img_size(image_font).X; @@ -619,41 +693,76 @@ AABB draw_text(bool world_space, bool dry_run, const char *text, size_t length, for(int i = 0; i < 4; i++) { - bounds.upper_left.X = min(bounds.upper_left.X, points[i].X); - bounds.upper_left.Y = max(bounds.upper_left.Y, points[i].Y); - bounds.lower_right.X = max(bounds.lower_right.X, points[i].X); - bounds.lower_right.Y = min(bounds.lower_right.Y, points[i].Y); + bounds.upper_left.X = min(bounds.upper_left.X, to_draw.points[i].X); + bounds.upper_left.Y = max(bounds.upper_left.Y, to_draw.points[i].Y); + bounds.lower_right.X = max(bounds.lower_right.X, to_draw.points[i].X); + bounds.lower_right.Y = min(bounds.lower_right.Y, to_draw.points[i].Y); } for(int i = 0; i < 4; i++) { - points[i] = HMM_AddV2(points[i], pos); + to_draw.points[i] = AddV2(to_draw.points[i], pos); } if(!dry_run) { - draw_quad(world_space, points, image_font, font_atlas_region, color); + draw_quad(world_space, to_draw, image_font, font_atlas_region, color); } } } - bounds.upper_left = HMM_AddV2(bounds.upper_left, pos); - bounds.lower_right = HMM_AddV2(bounds.lower_right, pos); + bounds.upper_left = AddV2(bounds.upper_left, pos); + bounds.lower_right = AddV2(bounds.lower_right, pos); return bounds; } -void redsquare(HMM_Vec2 at) +void colorquad(bool world_space, Quad q, Color col) { - HMM_Vec2 points[4] = - {0}; - quad_points_centered_size(points, at, HMM_V2(10.0, 10.0)); - draw_quad(true, points, image_white_square,full_region(image_font), RED); + draw_quad(world_space, q, image_white_square, full_region(image_white_square), col); +} + +void dbgsquare(Vec2 at) +{ + colorquad(true, quad_centered(at, V2(10.0, 10.0)), RED); +} + +// in world coordinates +void line(Vec2 from, Vec2 to, float line_width, Color color) +{ + Vec2 normal = rotate_counter_clockwise(NormV2(SubV2(to, from))); + Quad line_quad = { + .points = { + AddV2(from, MulV2F(normal, line_width)), // upper left + AddV2(to, MulV2F(normal, line_width)), // upper right + AddV2(to, MulV2F(normal, -line_width)), // lower right + AddV2(from, MulV2F(normal, -line_width)), // lower left + } + }; + colorquad(true, line_quad, color); +} + +void dbgline(Vec2 from, Vec2 to) +{ + line(from, to, 2.0f, RED); +} + +// in world space +void dbgrect(AABB rect) +{ + const float line_width = 0.5; + const Color col = RED; + Quad q = quad_aabb(rect); + line(q.ul, q.ur, line_width, col); + line(q.ur, q.lr, line_width, col); + line(q.lr, q.ll, line_width, col); + line(q.ll, q.ul, line_width, col); } + double time = 0.0; double last_frame_processing_time = 0.0; uint64_t last_frame_time; -HMM_Vec2 mouse_pos = +Vec2 mouse_pos = {0}; // in screen space bool character_facing_left = false; bool keydown[SAPP_KEYCODE_MENU] = @@ -675,13 +784,13 @@ void frame(void) } float dt = (float)dt_double; - HMM_Vec2 movement = HMM_V2( - (float)keydown[SAPP_KEYCODE_D] - (float)keydown[SAPP_KEYCODE_A], - (float)keydown[SAPP_KEYCODE_W] - (float)keydown[SAPP_KEYCODE_S] - ); - if(HMM_LenV2(movement) > 1.0) + Vec2 movement = V2( + (float)keydown[SAPP_KEYCODE_D] - (float)keydown[SAPP_KEYCODE_A], + (float)keydown[SAPP_KEYCODE_W] - (float)keydown[SAPP_KEYCODE_S] + ); + if(LenV2(movement) > 1.0) { - movement = HMM_NormV2(movement); + movement = NormV2(movement); } sg_begin_default_pass(&state.pass_action, sapp_width(), sapp_height()); sg_apply_pipeline(state.pip); @@ -694,20 +803,16 @@ void frame(void) for(int col = 0; col < LEVEL_TILES; col++) { - TileInstance cur = cur_level->tiles[row][col]; - TileCoord cur_coord = - { col, row }; + TileCoord cur_coord = { col, row }; + TileInstance cur = get_tile(cur_level, cur_coord); TileSet tileset = tileset_ruins_animated; if(cur.kind != 0) { - HMM_Vec2 points[4] = - {0}; - HMM_Vec2 tile_size = HMM_V2(TILE_SIZE, TILE_SIZE); - quad_points_corner_size(points, tilecoord_to_world(cur_coord), tile_size); + Vec2 tile_size = V2(TILE_SIZE, TILE_SIZE); sg_image tileset_image = *tileset.img; - HMM_Vec2 tile_image_coord = tile_id_to_coord(tileset_image, tile_size, cur.kind); + Vec2 tile_image_coord = tile_id_to_coord(tileset_image, tile_size, cur.kind); AnimatedTile *anim = NULL; for(int i = 0; i < sizeof(tileset.animated)/sizeof(*tileset.animated); i++) @@ -726,9 +831,9 @@ void frame(void) AABB region; region.upper_left = tile_image_coord; - region.lower_right = HMM_AddV2(region.upper_left, tile_size); + region.lower_right = AddV2(region.upper_left, tile_size); - draw_quad(true, points, tileset_image, region, WHITE); + draw_quad(true, tile_quad(cur_coord), tileset_image, region, WHITE); } } } @@ -736,103 +841,105 @@ void frame(void) - HMM_Vec2 new_pos = HMM_AddV2(character_pos, HMM_MulV2F(movement, dt * pixels_per_meter * 4.0f)); - HMM_Vec2 character_aabb_size = - { TILE_SIZE, TILE_SIZE }; + Vec2 new_pos = AddV2(character_pos, MulV2F(movement, dt * pixels_per_meter * 4.0f)); + Vec2 character_aabb_size = { TILE_SIZE, TILE_SIZE }; AABB at_new = centered_aabb(new_pos, character_aabb_size); - HMM_Vec2 at_new_size_vector = HMM_SubV2(at_new.lower_right, at_new.upper_left); - HMM_Vec2 points_to_check[] = + Vec2 at_new_size_vector = SubV2(at_new.lower_right, at_new.upper_left); + Vec2 points_to_check[] = { - HMM_AddV2(at_new.upper_left, HMM_V2(0.0, 0.0)), - HMM_AddV2(at_new.upper_left, HMM_V2(at_new_size_vector.X, 0.0)), - HMM_AddV2(at_new.upper_left, HMM_V2(at_new_size_vector.X, at_new_size_vector.Y)), - HMM_AddV2(at_new.upper_left, HMM_V2(0.0, at_new_size_vector.Y)), + AddV2(at_new.upper_left, V2(0.0, 0.0)), + AddV2(at_new.upper_left, V2(at_new_size_vector.X, 0.0)), + AddV2(at_new.upper_left, V2(at_new_size_vector.X, at_new_size_vector.Y)), + AddV2(at_new.upper_left, V2(0.0, at_new_size_vector.Y)), }; - //redsquare(character_pos); - //redsquare(at_new.upper_left); - //redsquare(at_new.lower_right); + //dbgsquare(character_pos); + //dbgsquare(at_new.upper_left); + //dbgsquare(at_new.lower_right); for(int i = 0; i < sizeof(points_to_check)/sizeof(*points_to_check); i++) { - HMM_Vec2 *it = &points_to_check[i]; + Vec2 *it = &points_to_check[i]; TileCoord to_check = world_to_tilecoord(*it); - char num[10] = - {0}; - snprintf(num, 10, "%d", get_tile(&level_level0, to_check)); - draw_text(false, false, num, strlen(num), world_to_screen(tilecoord_to_world(to_check)), BLACK); - if(get_tile(&level_level0, to_check) == 53) + uint16_t tile_id = get_tile(&level_level0, to_check).kind; + if(tile_id == 53 || tile_id == 0 || tile_id == 367 || tile_id == 317 || tile_id == 313 || tile_id == 366) { - redsquare(tilecoord_to_world(to_check)); + dbgsquare(tilecoord_to_world(to_check)); AABB to_depenetrate_from = tile_aabb(to_check); while(overlapping(to_depenetrate_from, at_new)) { //while(false) { - //redsquare(to_depenetrate_from.upper_left); - //redsquare(to_depenetrate_from.lower_right); + //dbgsquare(to_depenetrate_from.upper_left); + //dbgsquare(to_depenetrate_from.lower_right); const float move_dist = 0.05f; - HMM_Vec2 move_dir = HMM_NormV2(HMM_SubV2(aabb_center(at_new), aabb_center(to_depenetrate_from))); - HMM_Vec2 move = HMM_MulV2F(move_dir, move_dist); - at_new.upper_left = HMM_AddV2(at_new.upper_left,move); - at_new.lower_right = HMM_AddV2(at_new.lower_right,move); + + Vec2 to_player = NormV2(SubV2(aabb_center(at_new), aabb_center(to_depenetrate_from))); + Vec2 compass_dirs[4] = { + V2( 1.0, 0.0), + V2(-1.0, 0.0), + V2(0.0, 1.0), + V2(0.0, -1.0), + }; + int closest_index = -1; + float closest_dot = -99999999.0f; + for(int i = 0; i < 4; i++) + { + float dot = DotV2(compass_dirs[i], to_player); + if(dot > closest_dot) + { + closest_index = i; + closest_dot = dot; + } + } + Vec2 move_dir = compass_dirs[closest_index]; + Vec2 move = MulV2F(move_dir, move_dist); + at_new.upper_left = AddV2(at_new.upper_left,move); + at_new.lower_right = AddV2(at_new.lower_right,move); } } } + } character_pos = aabb_center(at_new); - cam.pos = HMM_LerpV2(cam.pos, dt*8.0f, HMM_MulV2F(character_pos, -1.0f * cam.scale)); + cam.pos = LerpV2(cam.pos, dt*8.0f, MulV2F(character_pos, -1.0f * cam.scale)); #ifdef DEVTOOLS - // mouse pos - + dbgsquare(screen_to_world(mouse_pos)); + + // tile coord { - redsquare(screen_to_world(mouse_pos)); - /* - HMM_Vec2 points[4] = - {0}; - quad_points_centered_size(points, screen_to_world(mouse_pos), HMM_V2(10.0, 10.0)); - draw_quad(true, points, image_white_square,full_region(image_font), RED); - */ + TileCoord hovering = world_to_tilecoord(screen_to_world(mouse_pos)); + Vec2 points[4] ={0}; + AABB q = tile_aabb(hovering); + dbgrect(q); + draw_text(false, false, tprint("%d", get_tile(&level_level0, hovering).kind), world_to_screen(tilecoord_to_world(hovering)), BLACK); } - // tile coord + // line test { - TileCoord hovering = world_to_tilecoord(screen_to_world(mouse_pos)); - HMM_Vec2 points[4] = - {0}; - quad_points_centered_size(points, tilecoord_to_world(hovering), HMM_V2(10.0, 10.0)); - draw_quad(true, points, image_white_square,full_region(image_font), RED); + dbgline(character_pos, screen_to_world(mouse_pos)); } // debug draw font image - { - HMM_Vec2 points[4] = - {0}; - quad_points_centered_size(points, HMM_V2(0.0, 0.0), HMM_V2(250.0, 250.0)); - draw_quad(true, points, image_font,full_region(image_font), WHITE); + draw_quad(true, quad_centered(V2(0.0, 0.0), V2(250.0, 250.0)), image_font,full_region(image_font), WHITE); } // statistics - { - char statistics[1024] = - {0}; - snprintf(statistics, sizeof(statistics), "Frametime: %.1f ms\nProcessing: %.1f ms", dt*1000.0, last_frame_processing_time*1000.0); - HMM_Vec2 pos = HMM_V2(0.0, screen_size().Y); - AABB bounds = draw_text(false, true, statistics, strlen(statistics), pos, BLACK); + Vec2 pos = V2(0.0, screen_size().Y); + char *stats = tprint("Frametime: %.1f ms\nProcessing: %.1f ms", dt*1000.0, last_frame_processing_time*1000.0); + AABB bounds = draw_text(false, true, stats, pos, BLACK); pos.Y -= bounds.upper_left.Y - screen_size().Y; - bounds = draw_text(false, true, statistics, strlen(statistics), pos, BLACK); + bounds = draw_text(false, true, stats, pos, BLACK); // background panel - colorbox(false, bounds.upper_left, bounds.lower_right, (Color){1.0, 1.0, 1.0, 0.3f}); - //colorbox(false, HMM_V2(50,screen_size().Y), HMM_V2(100,0), RED); - //colorbox(false, bounds.upper_left, bounds.lower_right, RED); - draw_text(false, false, statistics, strlen(statistics), pos, BLACK); + colorquad(false, quad_aabb(bounds), (Color){1.0, 1.0, 1.0, 0.3f}); + draw_text(false, false, stats, pos, BLACK); } // text test render #if 0 const char *text = "great idea\nother idea"; // measure text - HMM_Vec2 pos = character_pos; + Vec2 pos = character_pos; { AABB bounds = draw_text(true, true, text, strlen(text), pos, WHITE); @@ -848,8 +955,8 @@ void frame(void) #endif // devtools if(fabsf(movement.X) > 0.01f) character_facing_left = movement.X < 0.0f; - HMM_Vec2 character_sprite_pos = HMM_AddV2(character_pos, HMM_V2(0.0, 20.0f)); - if(HMM_LenV2(movement) > 0.01) + Vec2 character_sprite_pos = AddV2(character_pos, V2(0.0, 20.0f)); + if(LenV2(movement) > 0.01) { draw_animated_sprite(&knight_running, time, character_facing_left, character_sprite_pos, WHITE); } else @@ -857,63 +964,65 @@ void frame(void) draw_animated_sprite(&knight_idle, time, character_facing_left, character_sprite_pos, WHITE); } + sg_end_pass(); sg_commit(); last_frame_processing_time = stm_sec(stm_diff(stm_now(),time_start_frame)); - } - void cleanup(void) - { - sg_shutdown(); - } + reset(&scratch); +} +void cleanup(void) +{ + sg_shutdown(); +} - void event(const sapp_event *e) +void event(const sapp_event *e) +{ + if(e->type == SAPP_EVENTTYPE_KEY_DOWN) { - if(e->type == SAPP_EVENTTYPE_KEY_DOWN) + assert(e->key_code < sizeof(keydown)/sizeof(*keydown)); + keydown[e->key_code] = true; + if(e->key_code == SAPP_KEYCODE_ESCAPE) { - assert(e->key_code < sizeof(keydown)/sizeof(*keydown)); - keydown[e->key_code] = true; - if(e->key_code == SAPP_KEYCODE_ESCAPE) - { - sapp_quit(); - } -#ifdef DEVTOOLS - if(e->key_code == SAPP_KEYCODE_T) - { - mouse_frozen = !mouse_frozen; - } -#endif + sapp_quit(); } - if(e->type == SAPP_EVENTTYPE_KEY_UP) +#ifdef DEVTOOLS + if(e->key_code == SAPP_KEYCODE_T) { - keydown[e->key_code] = false; + mouse_frozen = !mouse_frozen; } - if(e->type == SAPP_EVENTTYPE_MOUSE_MOVE) - { - bool ignore_movement = false; -#ifdef DEVTOOLS - if(mouse_frozen) ignore_movement = true; #endif - if(!ignore_movement) mouse_pos = HMM_V2(e->mouse_x, (float)sapp_height() - e->mouse_y); - } } - - sapp_desc sokol_main(int argc, char* argv[]) + if(e->type == SAPP_EVENTTYPE_KEY_UP) { - (void)argc; (void)argv; - return (sapp_desc){ - .init_cb = init, - .frame_cb = frame, - .cleanup_cb = cleanup, - .event_cb = event, - .width = 800, - .height = 600, - //.gl_force_gles2 = true, not sure why this was here in example, look into - .window_title = "RPGPT", - - .win32_console_attach = true, - - .icon.sokol_default = true, - }; + keydown[e->key_code] = false; + } + if(e->type == SAPP_EVENTTYPE_MOUSE_MOVE) + { + bool ignore_movement = false; +#ifdef DEVTOOLS + if(mouse_frozen) ignore_movement = true; +#endif + if(!ignore_movement) mouse_pos = V2(e->mouse_x, (float)sapp_height() - e->mouse_y); } +} + +sapp_desc sokol_main(int argc, char* argv[]) +{ + (void)argc; (void)argv; + return (sapp_desc){ + .init_cb = init, + .frame_cb = frame, + .cleanup_cb = cleanup, + .event_cb = event, + .width = 800, + .height = 600, + //.gl_force_gles2 = true, not sure why this was here in example, look into + .window_title = "RPGPT", + + .win32_console_attach = true, + + .icon.sokol_default = true, + }; +} diff --git a/thirdparty/HandmadeMath.h b/thirdparty/HandmadeMath.h index b452a5c..6cc8669 100644 --- a/thirdparty/HandmadeMath.h +++ b/thirdparty/HandmadeMath.h @@ -20,9 +20,9 @@ Regardless of the default angle, you can use the following functions to specify an angle in a particular unit: - HMM_AngleRad(radians) - HMM_AngleDeg(degrees) - HMM_AngleTurn(turns) + AngleRad(radians) + AngleDeg(degrees) + AngleTurn(turns) ----------------------------------------------------------------------------- @@ -40,24 +40,24 @@ the runtime library implementation of these functions. Define HANDMADE_MATH_PROVIDE_MATH_FUNCTIONS and provide your own - implementations of HMM_SINF, HMM_COSF, HMM_TANF, HMM_ACOSF, and HMM_SQRTF + implementations of SINF, COSF, TANF, ACOSF, and SQRTF before including HandmadeMath.h, like so: #define HANDMADE_MATH_PROVIDE_MATH_FUNCTIONS - #define HMM_SINF MySinF - #define HMM_COSF MyCosF - #define HMM_TANF MyTanF - #define HMM_ACOSF MyACosF - #define HMM_SQRTF MySqrtF + #define SINF MySinF + #define COSF MyCosF + #define TANF MyTanF + #define ACOSF MyACosF + #define SQRTF MySqrtF #include "HandmadeMath.h" By default, it is assumed that your math functions take radians. To use - different units, you must define HMM_ANGLE_USER_TO_INTERNAL and - HMM_ANGLE_INTERNAL_TO_USER. For example, if you want to use degrees in your + different units, you must define ANGLE_USER_TO_INTERNAL and + ANGLE_INTERNAL_TO_USER. For example, if you want to use degrees in your code but your math functions use turns: - #define HMM_ANGLE_USER_TO_INTERNAL(a) ((a)*HMM_DegToTurn) - #define HMM_ANGLE_INTERNAL_TO_USER(a) ((a)*HMM_TurnToDeg) + #define ANGLE_USER_TO_INTERNAL(a) ((a)*DegToTurn) + #define ANGLE_INTERNAL_TO_USER(a) ((a)*TurnToDeg) ============================================================================= @@ -143,11 +143,11 @@ #endif #if defined(__GNUC__) || defined(__clang__) -# define HMM_DEPRECATED(msg) __attribute__((deprecated(msg))) +# define DEPRECATED(msg) __attribute__((deprecated(msg))) #elif defined(_MSC_VER) -# define HMM_DEPRECATED(msg) __declspec(deprecated(msg)) +# define DEPRECATED(msg) __declspec(deprecated(msg)) #else -# define HMM_DEPRECATED(msg) +# define DEPRECATED(msg) #endif #ifdef __cplusplus @@ -161,63 +161,63 @@ extern "C" # define HANDMADE_MATH_USE_RADIANS #endif -#define HMM_PI 3.14159265358979323846 -#define HMM_PI32 3.14159265359f -#define HMM_DEG180 180.0 -#define HMM_DEG18032 180.0f -#define HMM_TURNHALF 0.5 -#define HMM_TURNHALF32 0.5f -#define HMM_RadToDeg ((float)(HMM_DEG180/HMM_PI)) -#define HMM_RadToTurn ((float)(HMM_TURNHALF/HMM_PI)) -#define HMM_DegToRad ((float)(HMM_PI/HMM_DEG180)) -#define HMM_DegToTurn ((float)(HMM_TURNHALF/HMM_DEG180)) -#define HMM_TurnToRad ((float)(HMM_PI/HMM_TURNHALF)) -#define HMM_TurnToDeg ((float)(HMM_DEG180/HMM_TURNHALF)) +#define PI 3.14159265358979323846 +#define PI32 3.14159265359f +#define DEG180 180.0 +#define DEG18032 180.0f +#define TURNHALF 0.5 +#define TURNHALF32 0.5f +#define RadToDeg ((float)(DEG180/PI)) +#define RadToTurn ((float)(TURNHALF/PI)) +#define DegToRad ((float)(PI/DEG180)) +#define DegToTurn ((float)(TURNHALF/DEG180)) +#define TurnToRad ((float)(PI/TURNHALF)) +#define TurnToDeg ((float)(DEG180/TURNHALF)) #if defined(HANDMADE_MATH_USE_RADIANS) -# define HMM_AngleRad(a) (a) -# define HMM_AngleDeg(a) ((a)*HMM_DegToRad) -# define HMM_AngleTurn(a) ((a)*HMM_TurnToRad) +# define AngleRad(a) (a) +# define AngleDeg(a) ((a)*DegToRad) +# define AngleTurn(a) ((a)*TurnToRad) #elif defined(HANDMADE_MATH_USE_DEGREES) -# define HMM_AngleRad(a) ((a)*HMM_RadToDeg) -# define HMM_AngleDeg(a) (a) -# define HMM_AngleTurn(a) ((a)*HMM_TurnToDeg) +# define AngleRad(a) ((a)*RadToDeg) +# define AngleDeg(a) (a) +# define AngleTurn(a) ((a)*TurnToDeg) #elif defined(HANDMADE_MATH_USE_TURNS) -# define HMM_AngleRad(a) ((a)*HMM_RadToTurn) -# define HMM_AngleDeg(a) ((a)*HMM_DegToTurn) -# define HMM_AngleTurn(a) (a) +# define AngleRad(a) ((a)*RadToTurn) +# define AngleDeg(a) ((a)*DegToTurn) +# define AngleTurn(a) (a) #endif #if !defined(HANDMADE_MATH_PROVIDE_MATH_FUNCTIONS) # include -# define HMM_SINF sinf -# define HMM_COSF cosf -# define HMM_TANF tanf -# define HMM_SQRTF sqrtf -# define HMM_ACOSF acosf +# define SINF sinf +# define COSF cosf +# define TANF tanf +# define SQRTF sqrtf +# define ACOSF acosf #endif -#if !defined(HMM_ANGLE_USER_TO_INTERNAL) -# define HMM_ANGLE_USER_TO_INTERNAL(a) (HMM_ToRad(a)) +#if !defined(ANGLE_USER_TO_INTERNAL) +# define ANGLE_USER_TO_INTERNAL(a) (ToRad(a)) #endif -#if !defined(HMM_ANGLE_INTERNAL_TO_USER) +#if !defined(ANGLE_INTERNAL_TO_USER) # if defined(HANDMADE_MATH_USE_RADIANS) -# define HMM_ANGLE_INTERNAL_TO_USER(a) (a) +# define ANGLE_INTERNAL_TO_USER(a) (a) # elif defined(HANDMADE_MATH_USE_DEGREES) -# define HMM_ANGLE_INTERNAL_TO_USER(a) ((a)*HMM_RadToDeg) +# define ANGLE_INTERNAL_TO_USER(a) ((a)*RadToDeg) # elif defined(HANDMADE_MATH_USE_TURNS) -# define HMM_ANGLE_INTERNAL_TO_USER(a) ((a)*HMM_RadToTurn) +# define ANGLE_INTERNAL_TO_USER(a) ((a)*RadToTurn) # endif #endif -#define HMM_MIN(a, b) ((a) > (b) ? (b) : (a)) -#define HMM_MAX(a, b) ((a) < (b) ? (b) : (a)) -#define HMM_ABS(a) ((a) > 0 ? (a) : -(a)) -#define HMM_MOD(a, m) (((a) % (m)) >= 0 ? ((a) % (m)) : (((a) % (m)) + (m))) -#define HMM_SQUARE(x) ((x) * (x)) +#define MIN(a, b) ((a) > (b) ? (b) : (a)) +#define MAX(a, b) ((a) < (b) ? (b) : (a)) +#define ABS(a) ((a) > 0 ? (a) : -(a)) +#define MOD(a, m) (((a) % (m)) >= 0 ? ((a) % (m)) : (((a) % (m)) + (m))) +#define SQUARE(x) ((x) * (x)) -typedef union HMM_Vec2 +typedef union Vec2 { struct { @@ -247,9 +247,9 @@ typedef union HMM_Vec2 return Elements[Index]; } #endif -} HMM_Vec2; +} Vec2; -typedef union HMM_Vec3 +typedef union Vec3 { struct { @@ -268,26 +268,26 @@ typedef union HMM_Vec3 struct { - HMM_Vec2 XY; + Vec2 XY; float _Ignored0; }; struct { float _Ignored1; - HMM_Vec2 YZ; + Vec2 YZ; }; struct { - HMM_Vec2 UV; + Vec2 UV; float _Ignored2; }; struct { float _Ignored3; - HMM_Vec2 VW; + Vec2 VW; }; float Elements[3]; @@ -298,15 +298,15 @@ typedef union HMM_Vec3 return Elements[Index]; } #endif -} HMM_Vec3; +} Vec3; -typedef union HMM_Vec4 +typedef union Vec4 { struct { union { - HMM_Vec3 XYZ; + Vec3 XYZ; struct { float X, Y, Z; @@ -319,7 +319,7 @@ typedef union HMM_Vec4 { union { - HMM_Vec3 RGB; + Vec3 RGB; struct { float R, G, B; @@ -331,7 +331,7 @@ typedef union HMM_Vec4 struct { - HMM_Vec2 XY; + Vec2 XY; float _Ignored0; float _Ignored1; }; @@ -339,7 +339,7 @@ typedef union HMM_Vec4 struct { float _Ignored2; - HMM_Vec2 YZ; + Vec2 YZ; float _Ignored3; }; @@ -347,7 +347,7 @@ typedef union HMM_Vec4 { float _Ignored4; float _Ignored5; - HMM_Vec2 ZW; + Vec2 ZW; }; float Elements[4]; @@ -362,54 +362,54 @@ typedef union HMM_Vec4 return Elements[Index]; } #endif -} HMM_Vec4; +} Vec4; -typedef union HMM_Mat2 +typedef union Mat2 { float Elements[2][2]; - HMM_Vec2 Columns[2]; + Vec2 Columns[2]; #ifdef __cplusplus - inline HMM_Vec2 &operator[](const int &Index) + inline Vec2 &operator[](const int &Index) { return Columns[Index]; } #endif -} HMM_Mat2; +} Mat2; -typedef union HMM_Mat3 +typedef union Mat3 { float Elements[3][3]; - HMM_Vec3 Columns[3]; + Vec3 Columns[3]; #ifdef __cplusplus - inline HMM_Vec3 &operator[](const int &Index) + inline Vec3 &operator[](const int &Index) { return Columns[Index]; } #endif -} HMM_Mat3; +} Mat3; -typedef union HMM_Mat4 +typedef union Mat4 { float Elements[4][4]; - HMM_Vec4 Columns[4]; + Vec4 Columns[4]; #ifdef __cplusplus - inline HMM_Vec4 &operator[](const int &Index) + inline Vec4 &operator[](const int &Index) { return Columns[Index]; } #endif -} HMM_Mat4; +} Mat4; -typedef union HMM_Quat +typedef union Quat { struct { union { - HMM_Vec3 XYZ; + Vec3 XYZ; struct { float X, Y, Z; @@ -424,45 +424,45 @@ typedef union HMM_Quat #ifdef HANDMADE_MATH__USE_SSE __m128 SSE; #endif -} HMM_Quat; +} Quat; -typedef signed int HMM_Bool; +typedef signed int Bool; /* * Angle unit conversion functions */ -static inline float HMM_ToRad(float Angle) +static inline float ToRad(float Angle) { #if defined(HANDMADE_MATH_USE_RADIANS) float Result = Angle; #elif defined(HANDMADE_MATH_USE_DEGREES) - float Result = Angle * HMM_DegToRad; + float Result = Angle * DegToRad; #elif defined(HANDMADE_MATH_USE_TURNS) - float Result = Angle * HMM_TurnToRad; + float Result = Angle * TurnToRad; #endif return Result; } -static inline float HMM_ToDeg(float Angle) +static inline float ToDeg(float Angle) { #if defined(HANDMADE_MATH_USE_RADIANS) - float Result = Angle * HMM_RadToDeg; + float Result = Angle * RadToDeg; #elif defined(HANDMADE_MATH_USE_DEGREES) float Result = Angle; #elif defined(HANDMADE_MATH_USE_TURNS) - float Result = Angle * HMM_TurnToDeg; + float Result = Angle * TurnToDeg; #endif return Result; } -static inline float HMM_ToTurn(float Angle) +static inline float ToTurn(float Angle) { #if defined(HANDMADE_MATH_USE_RADIANS) - float Result = Angle * HMM_RadToTurn; + float Result = Angle * RadToTurn; #elif defined(HANDMADE_MATH_USE_DEGREES) - float Result = Angle * HMM_DegToTurn; + float Result = Angle * DegToTurn; #elif defined(HANDMADE_MATH_USE_TURNS) float Result = Angle; #endif @@ -474,38 +474,38 @@ static inline float HMM_ToTurn(float Angle) * Floating-point math functions */ -COVERAGE(HMM_SinF, 1) -static inline float HMM_SinF(float Angle) +COVERAGE(SinF, 1) +static inline float SinF(float Angle) { - ASSERT_COVERED(HMM_SinF); - return HMM_SINF(HMM_ANGLE_USER_TO_INTERNAL(Angle)); + ASSERT_COVERED(SinF); + return SINF(ANGLE_USER_TO_INTERNAL(Angle)); } -COVERAGE(HMM_CosF, 1) -static inline float HMM_CosF(float Angle) +COVERAGE(CosF, 1) +static inline float CosF(float Angle) { - ASSERT_COVERED(HMM_CosF); - return HMM_COSF(HMM_ANGLE_USER_TO_INTERNAL(Angle)); + ASSERT_COVERED(CosF); + return COSF(ANGLE_USER_TO_INTERNAL(Angle)); } -COVERAGE(HMM_TanF, 1) -static inline float HMM_TanF(float Angle) +COVERAGE(TanF, 1) +static inline float TanF(float Angle) { - ASSERT_COVERED(HMM_TanF); - return HMM_TANF(HMM_ANGLE_USER_TO_INTERNAL(Angle)); + ASSERT_COVERED(TanF); + return TANF(ANGLE_USER_TO_INTERNAL(Angle)); } -COVERAGE(HMM_ACosF, 1) -static inline float HMM_ACosF(float Arg) +COVERAGE(ACosF, 1) +static inline float ACosF(float Arg) { - ASSERT_COVERED(HMM_ACosF); - return HMM_ANGLE_INTERNAL_TO_USER(HMM_ACOSF(Arg)); + ASSERT_COVERED(ACosF); + return ANGLE_INTERNAL_TO_USER(ACOSF(Arg)); } -COVERAGE(HMM_SqrtF, 1) -static inline float HMM_SqrtF(float Float) +COVERAGE(SqrtF, 1) +static inline float SqrtF(float Float) { - ASSERT_COVERED(HMM_SqrtF); + ASSERT_COVERED(SqrtF); float Result; @@ -514,20 +514,20 @@ static inline float HMM_SqrtF(float Float) __m128 Out = _mm_sqrt_ss(In); Result = _mm_cvtss_f32(Out); #else - Result = HMM_SQRTF(Float); + Result = SQRTF(Float); #endif return Result; } -COVERAGE(HMM_InvSqrtF, 1) -static inline float HMM_InvSqrtF(float Float) +COVERAGE(InvSqrtF, 1) +static inline float InvSqrtF(float Float) { - ASSERT_COVERED(HMM_InvSqrtF); + ASSERT_COVERED(InvSqrtF); float Result; - Result = 1.0f/HMM_SqrtF(Float); + Result = 1.0f/SqrtF(Float); return Result; } @@ -537,17 +537,17 @@ static inline float HMM_InvSqrtF(float Float) * Utility functions */ -COVERAGE(HMM_Lerp, 1) -static inline float HMM_Lerp(float A, float Time, float B) +COVERAGE(Lerp, 1) +static inline float Lerp(float A, float Time, float B) { - ASSERT_COVERED(HMM_Lerp); + ASSERT_COVERED(Lerp); return (1.0f - Time) * A + Time * B; } -COVERAGE(HMM_Clamp, 1) -static inline float HMM_Clamp(float Min, float Value, float Max) +COVERAGE(Clamp, 1) +static inline float Clamp(float Min, float Value, float Max) { - ASSERT_COVERED(HMM_Clamp); + ASSERT_COVERED(Clamp); float Result = Value; @@ -569,24 +569,24 @@ static inline float HMM_Clamp(float Min, float Value, float Max) * Vector initialization */ -COVERAGE(HMM_V2, 1) -static inline HMM_Vec2 HMM_V2(float X, float Y) +COVERAGE(V2, 1) +static inline Vec2 V2(float X, float Y) { - ASSERT_COVERED(HMM_V2); + ASSERT_COVERED(V2); - HMM_Vec2 Result; + Vec2 Result; Result.X = X; Result.Y = Y; return Result; } -COVERAGE(HMM_V3, 1) -static inline HMM_Vec3 HMM_V3(float X, float Y, float Z) +COVERAGE(V3, 1) +static inline Vec3 V3(float X, float Y, float Z) { - ASSERT_COVERED(HMM_V3); + ASSERT_COVERED(V3); - HMM_Vec3 Result; + Vec3 Result; Result.X = X; Result.Y = Y; Result.Z = Z; @@ -594,12 +594,12 @@ static inline HMM_Vec3 HMM_V3(float X, float Y, float Z) return Result; } -COVERAGE(HMM_V4, 1) -static inline HMM_Vec4 HMM_V4(float X, float Y, float Z, float W) +COVERAGE(V4, 1) +static inline Vec4 V4(float X, float Y, float Z, float W) { - ASSERT_COVERED(HMM_V4); + ASSERT_COVERED(V4); - HMM_Vec4 Result; + Vec4 Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = _mm_setr_ps(X, Y, Z, W); @@ -613,12 +613,12 @@ static inline HMM_Vec4 HMM_V4(float X, float Y, float Z, float W) return Result; } -COVERAGE(HMM_V4V, 1) -static inline HMM_Vec4 HMM_V4V(HMM_Vec3 Vector, float W) +COVERAGE(V4V, 1) +static inline Vec4 V4V(Vec3 Vector, float W) { - ASSERT_COVERED(HMM_V4V); + ASSERT_COVERED(V4V); - HMM_Vec4 Result; + Vec4 Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = _mm_setr_ps(Vector.X, Vector.Y, Vector.Z, W); @@ -635,24 +635,24 @@ static inline HMM_Vec4 HMM_V4V(HMM_Vec3 Vector, float W) * Binary vector operations */ -COVERAGE(HMM_AddV2, 1) -static inline HMM_Vec2 HMM_AddV2(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(AddV2, 1) +static inline Vec2 AddV2(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_AddV2); + ASSERT_COVERED(AddV2); - HMM_Vec2 Result; + Vec2 Result; Result.X = Left.X + Right.X; Result.Y = Left.Y + Right.Y; return Result; } -COVERAGE(HMM_AddV3, 1) -static inline HMM_Vec3 HMM_AddV3(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(AddV3, 1) +static inline Vec3 AddV3(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_AddV3); + ASSERT_COVERED(AddV3); - HMM_Vec3 Result; + Vec3 Result; Result.X = Left.X + Right.X; Result.Y = Left.Y + Right.Y; Result.Z = Left.Z + Right.Z; @@ -660,12 +660,12 @@ static inline HMM_Vec3 HMM_AddV3(HMM_Vec3 Left, HMM_Vec3 Right) return Result; } -COVERAGE(HMM_AddV4, 1) -static inline HMM_Vec4 HMM_AddV4(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(AddV4, 1) +static inline Vec4 AddV4(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_AddV4); + ASSERT_COVERED(AddV4); - HMM_Vec4 Result; + Vec4 Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = _mm_add_ps(Left.SSE, Right.SSE); @@ -679,24 +679,24 @@ static inline HMM_Vec4 HMM_AddV4(HMM_Vec4 Left, HMM_Vec4 Right) return Result; } -COVERAGE(HMM_SubV2, 1) -static inline HMM_Vec2 HMM_SubV2(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(SubV2, 1) +static inline Vec2 SubV2(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_SubV2); + ASSERT_COVERED(SubV2); - HMM_Vec2 Result; + Vec2 Result; Result.X = Left.X - Right.X; Result.Y = Left.Y - Right.Y; return Result; } -COVERAGE(HMM_SubV3, 1) -static inline HMM_Vec3 HMM_SubV3(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(SubV3, 1) +static inline Vec3 SubV3(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_SubV3); + ASSERT_COVERED(SubV3); - HMM_Vec3 Result; + Vec3 Result; Result.X = Left.X - Right.X; Result.Y = Left.Y - Right.Y; Result.Z = Left.Z - Right.Z; @@ -704,12 +704,12 @@ static inline HMM_Vec3 HMM_SubV3(HMM_Vec3 Left, HMM_Vec3 Right) return Result; } -COVERAGE(HMM_SubV4, 1) -static inline HMM_Vec4 HMM_SubV4(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(SubV4, 1) +static inline Vec4 SubV4(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_SubV4); + ASSERT_COVERED(SubV4); - HMM_Vec4 Result; + Vec4 Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = _mm_sub_ps(Left.SSE, Right.SSE); @@ -723,36 +723,36 @@ static inline HMM_Vec4 HMM_SubV4(HMM_Vec4 Left, HMM_Vec4 Right) return Result; } -COVERAGE(HMM_MulV2, 1) -static inline HMM_Vec2 HMM_MulV2(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(MulV2, 1) +static inline Vec2 MulV2(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_MulV2); + ASSERT_COVERED(MulV2); - HMM_Vec2 Result; + Vec2 Result; Result.X = Left.X * Right.X; Result.Y = Left.Y * Right.Y; return Result; } -COVERAGE(HMM_MulV2F, 1) -static inline HMM_Vec2 HMM_MulV2F(HMM_Vec2 Left, float Right) +COVERAGE(MulV2F, 1) +static inline Vec2 MulV2F(Vec2 Left, float Right) { - ASSERT_COVERED(HMM_MulV2F); + ASSERT_COVERED(MulV2F); - HMM_Vec2 Result; + Vec2 Result; Result.X = Left.X * Right; Result.Y = Left.Y * Right; return Result; } -COVERAGE(HMM_MulV3, 1) -static inline HMM_Vec3 HMM_MulV3(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(MulV3, 1) +static inline Vec3 MulV3(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_MulV3); + ASSERT_COVERED(MulV3); - HMM_Vec3 Result; + Vec3 Result; Result.X = Left.X * Right.X; Result.Y = Left.Y * Right.Y; Result.Z = Left.Z * Right.Z; @@ -760,12 +760,12 @@ static inline HMM_Vec3 HMM_MulV3(HMM_Vec3 Left, HMM_Vec3 Right) return Result; } -COVERAGE(HMM_MulV3F, 1) -static inline HMM_Vec3 HMM_MulV3F(HMM_Vec3 Left, float Right) +COVERAGE(MulV3F, 1) +static inline Vec3 MulV3F(Vec3 Left, float Right) { - ASSERT_COVERED(HMM_MulV3F); + ASSERT_COVERED(MulV3F); - HMM_Vec3 Result; + Vec3 Result; Result.X = Left.X * Right; Result.Y = Left.Y * Right; Result.Z = Left.Z * Right; @@ -773,12 +773,12 @@ static inline HMM_Vec3 HMM_MulV3F(HMM_Vec3 Left, float Right) return Result; } -COVERAGE(HMM_MulV4, 1) -static inline HMM_Vec4 HMM_MulV4(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(MulV4, 1) +static inline Vec4 MulV4(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_MulV4); + ASSERT_COVERED(MulV4); - HMM_Vec4 Result; + Vec4 Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = _mm_mul_ps(Left.SSE, Right.SSE); @@ -792,12 +792,12 @@ static inline HMM_Vec4 HMM_MulV4(HMM_Vec4 Left, HMM_Vec4 Right) return Result; } -COVERAGE(HMM_MulV4F, 1) -static inline HMM_Vec4 HMM_MulV4F(HMM_Vec4 Left, float Right) +COVERAGE(MulV4F, 1) +static inline Vec4 MulV4F(Vec4 Left, float Right) { - ASSERT_COVERED(HMM_MulV4F); + ASSERT_COVERED(MulV4F); - HMM_Vec4 Result; + Vec4 Result; #ifdef HANDMADE_MATH__USE_SSE __m128 Scalar = _mm_set1_ps(Right); @@ -812,36 +812,36 @@ static inline HMM_Vec4 HMM_MulV4F(HMM_Vec4 Left, float Right) return Result; } -COVERAGE(HMM_DivV2, 1) -static inline HMM_Vec2 HMM_DivV2(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(DivV2, 1) +static inline Vec2 DivV2(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_DivV2); + ASSERT_COVERED(DivV2); - HMM_Vec2 Result; + Vec2 Result; Result.X = Left.X / Right.X; Result.Y = Left.Y / Right.Y; return Result; } -COVERAGE(HMM_DivV2F, 1) -static inline HMM_Vec2 HMM_DivV2F(HMM_Vec2 Left, float Right) +COVERAGE(DivV2F, 1) +static inline Vec2 DivV2F(Vec2 Left, float Right) { - ASSERT_COVERED(HMM_DivV2F); + ASSERT_COVERED(DivV2F); - HMM_Vec2 Result; + Vec2 Result; Result.X = Left.X / Right; Result.Y = Left.Y / Right; return Result; } -COVERAGE(HMM_DivV3, 1) -static inline HMM_Vec3 HMM_DivV3(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(DivV3, 1) +static inline Vec3 DivV3(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_DivV3); + ASSERT_COVERED(DivV3); - HMM_Vec3 Result; + Vec3 Result; Result.X = Left.X / Right.X; Result.Y = Left.Y / Right.Y; Result.Z = Left.Z / Right.Z; @@ -849,12 +849,12 @@ static inline HMM_Vec3 HMM_DivV3(HMM_Vec3 Left, HMM_Vec3 Right) return Result; } -COVERAGE(HMM_DivV3F, 1) -static inline HMM_Vec3 HMM_DivV3F(HMM_Vec3 Left, float Right) +COVERAGE(DivV3F, 1) +static inline Vec3 DivV3F(Vec3 Left, float Right) { - ASSERT_COVERED(HMM_DivV3F); + ASSERT_COVERED(DivV3F); - HMM_Vec3 Result; + Vec3 Result; Result.X = Left.X / Right; Result.Y = Left.Y / Right; Result.Z = Left.Z / Right; @@ -862,12 +862,12 @@ static inline HMM_Vec3 HMM_DivV3F(HMM_Vec3 Left, float Right) return Result; } -COVERAGE(HMM_DivV4, 1) -static inline HMM_Vec4 HMM_DivV4(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(DivV4, 1) +static inline Vec4 DivV4(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_DivV4); + ASSERT_COVERED(DivV4); - HMM_Vec4 Result; + Vec4 Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = _mm_div_ps(Left.SSE, Right.SSE); @@ -881,12 +881,12 @@ static inline HMM_Vec4 HMM_DivV4(HMM_Vec4 Left, HMM_Vec4 Right) return Result; } -COVERAGE(HMM_DivV4F, 1) -static inline HMM_Vec4 HMM_DivV4F(HMM_Vec4 Left, float Right) +COVERAGE(DivV4F, 1) +static inline Vec4 DivV4F(Vec4 Left, float Right) { - ASSERT_COVERED(HMM_DivV4F); + ASSERT_COVERED(DivV4F); - HMM_Vec4 Result; + Vec4 Result; #ifdef HANDMADE_MATH__USE_SSE __m128 Scalar = _mm_set1_ps(Right); @@ -901,45 +901,45 @@ static inline HMM_Vec4 HMM_DivV4F(HMM_Vec4 Left, float Right) return Result; } -COVERAGE(HMM_EqV2, 1) -static inline HMM_Bool HMM_EqV2(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(EqV2, 1) +static inline Bool EqV2(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_EqV2); + ASSERT_COVERED(EqV2); return Left.X == Right.X && Left.Y == Right.Y; } -COVERAGE(HMM_EqV3, 1) -static inline HMM_Bool HMM_EqV3(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(EqV3, 1) +static inline Bool EqV3(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_EqV3); + ASSERT_COVERED(EqV3); return Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z; } -COVERAGE(HMM_EqV4, 1) -static inline HMM_Bool HMM_EqV4(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(EqV4, 1) +static inline Bool EqV4(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_EqV4); + ASSERT_COVERED(EqV4); return Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z && Left.W == Right.W; } -COVERAGE(HMM_DotV2, 1) -static inline float HMM_DotV2(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(DotV2, 1) +static inline float DotV2(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_DotV2); + ASSERT_COVERED(DotV2); return (Left.X * Right.X) + (Left.Y * Right.Y); } -COVERAGE(HMM_DotV3, 1) -static inline float HMM_DotV3(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(DotV3, 1) +static inline float DotV3(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_DotV3); + ASSERT_COVERED(DotV3); return (Left.X * Right.X) + (Left.Y * Right.Y) + (Left.Z * Right.Z); } -COVERAGE(HMM_DotV4, 1) -static inline float HMM_DotV4(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(DotV4, 1) +static inline float DotV4(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_DotV4); + ASSERT_COVERED(DotV4); float Result; @@ -960,12 +960,12 @@ static inline float HMM_DotV4(HMM_Vec4 Left, HMM_Vec4 Right) return Result; } -COVERAGE(HMM_Cross, 1) -static inline HMM_Vec3 HMM_Cross(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(Cross, 1) +static inline Vec3 Cross(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_Cross); + ASSERT_COVERED(Cross); - HMM_Vec3 Result; + Vec3 Result; Result.X = (Left.Y * Right.Z) - (Left.Z * Right.Y); Result.Y = (Left.Z * Right.X) - (Left.X * Right.Z); Result.Z = (Left.X * Right.Y) - (Left.Y * Right.X); @@ -978,104 +978,104 @@ static inline HMM_Vec3 HMM_Cross(HMM_Vec3 Left, HMM_Vec3 Right) * Unary vector operations */ -COVERAGE(HMM_LenSqrV2, 1) -static inline float HMM_LenSqrV2(HMM_Vec2 A) +COVERAGE(LenSqrV2, 1) +static inline float LenSqrV2(Vec2 A) { - ASSERT_COVERED(HMM_LenSqrV2); - return HMM_DotV2(A, A); + ASSERT_COVERED(LenSqrV2); + return DotV2(A, A); } -COVERAGE(HMM_LenSqrV3, 1) -static inline float HMM_LenSqrV3(HMM_Vec3 A) +COVERAGE(LenSqrV3, 1) +static inline float LenSqrV3(Vec3 A) { - ASSERT_COVERED(HMM_LenSqrV3); - return HMM_DotV3(A, A); + ASSERT_COVERED(LenSqrV3); + return DotV3(A, A); } -COVERAGE(HMM_LenSqrV4, 1) -static inline float HMM_LenSqrV4(HMM_Vec4 A) +COVERAGE(LenSqrV4, 1) +static inline float LenSqrV4(Vec4 A) { - ASSERT_COVERED(HMM_LenSqrV4); - return HMM_DotV4(A, A); + ASSERT_COVERED(LenSqrV4); + return DotV4(A, A); } -COVERAGE(HMM_LenV2, 1) -static inline float HMM_LenV2(HMM_Vec2 A) +COVERAGE(LenV2, 1) +static inline float LenV2(Vec2 A) { - ASSERT_COVERED(HMM_LenV2); - return HMM_SqrtF(HMM_LenSqrV2(A)); + ASSERT_COVERED(LenV2); + return SqrtF(LenSqrV2(A)); } -COVERAGE(HMM_LenV3, 1) -static inline float HMM_LenV3(HMM_Vec3 A) +COVERAGE(LenV3, 1) +static inline float LenV3(Vec3 A) { - ASSERT_COVERED(HMM_LenV3); - return HMM_SqrtF(HMM_LenSqrV3(A)); + ASSERT_COVERED(LenV3); + return SqrtF(LenSqrV3(A)); } -COVERAGE(HMM_LenV4, 1) -static inline float HMM_LenV4(HMM_Vec4 A) +COVERAGE(LenV4, 1) +static inline float LenV4(Vec4 A) { - ASSERT_COVERED(HMM_LenV4); - return HMM_SqrtF(HMM_LenSqrV4(A)); + ASSERT_COVERED(LenV4); + return SqrtF(LenSqrV4(A)); } -COVERAGE(HMM_NormV2, 1) -static inline HMM_Vec2 HMM_NormV2(HMM_Vec2 A) +COVERAGE(NormV2, 1) +static inline Vec2 NormV2(Vec2 A) { - ASSERT_COVERED(HMM_NormV2); - return HMM_MulV2F(A, HMM_InvSqrtF(HMM_DotV2(A, A))); + ASSERT_COVERED(NormV2); + return MulV2F(A, InvSqrtF(DotV2(A, A))); } -COVERAGE(HMM_NormV3, 1) -static inline HMM_Vec3 HMM_NormV3(HMM_Vec3 A) +COVERAGE(NormV3, 1) +static inline Vec3 NormV3(Vec3 A) { - ASSERT_COVERED(HMM_NormV3); - return HMM_MulV3F(A, HMM_InvSqrtF(HMM_DotV3(A, A))); + ASSERT_COVERED(NormV3); + return MulV3F(A, InvSqrtF(DotV3(A, A))); } -COVERAGE(HMM_NormV4, 1) -static inline HMM_Vec4 HMM_NormV4(HMM_Vec4 A) +COVERAGE(NormV4, 1) +static inline Vec4 NormV4(Vec4 A) { - ASSERT_COVERED(HMM_NormV4); - return HMM_MulV4F(A, HMM_InvSqrtF(HMM_DotV4(A, A))); + ASSERT_COVERED(NormV4); + return MulV4F(A, InvSqrtF(DotV4(A, A))); } /* * Utility vector functions */ -COVERAGE(HMM_LerpV2, 1) -static inline HMM_Vec2 HMM_LerpV2(HMM_Vec2 A, float Time, HMM_Vec2 B) +COVERAGE(LerpV2, 1) +static inline Vec2 LerpV2(Vec2 A, float Time, Vec2 B) { - ASSERT_COVERED(HMM_LerpV2); - return HMM_AddV2(HMM_MulV2F(A, 1.0f - Time), HMM_MulV2F(B, Time)); + ASSERT_COVERED(LerpV2); + return AddV2(MulV2F(A, 1.0f - Time), MulV2F(B, Time)); } -COVERAGE(HMM_LerpV3, 1) -static inline HMM_Vec3 HMM_LerpV3(HMM_Vec3 A, float Time, HMM_Vec3 B) +COVERAGE(LerpV3, 1) +static inline Vec3 LerpV3(Vec3 A, float Time, Vec3 B) { - ASSERT_COVERED(HMM_LerpV3); - return HMM_AddV3(HMM_MulV3F(A, 1.0f - Time), HMM_MulV3F(B, Time)); + ASSERT_COVERED(LerpV3); + return AddV3(MulV3F(A, 1.0f - Time), MulV3F(B, Time)); } -COVERAGE(HMM_LerpV4, 1) -static inline HMM_Vec4 HMM_LerpV4(HMM_Vec4 A, float Time, HMM_Vec4 B) +COVERAGE(LerpV4, 1) +static inline Vec4 LerpV4(Vec4 A, float Time, Vec4 B) { - ASSERT_COVERED(HMM_LerpV4); - return HMM_AddV4(HMM_MulV4F(A, 1.0f - Time), HMM_MulV4F(B, Time)); + ASSERT_COVERED(LerpV4); + return AddV4(MulV4F(A, 1.0f - Time), MulV4F(B, Time)); } /* * SSE stuff */ -COVERAGE(HMM_LinearCombineV4M4, 1) -static inline HMM_Vec4 HMM_LinearCombineV4M4(HMM_Vec4 Left, HMM_Mat4 Right) +COVERAGE(LinearCombineV4M4, 1) +static inline Vec4 LinearCombineV4M4(Vec4 Left, Mat4 Right) { - ASSERT_COVERED(HMM_LinearCombineV4M4); + ASSERT_COVERED(LinearCombineV4M4); - HMM_Vec4 Result; + Vec4 Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = _mm_mul_ps(_mm_shuffle_ps(Left.SSE, Left.SSE, 0x00), Right.Columns[0].SSE); Result.SSE = _mm_add_ps(Result.SSE, _mm_mul_ps(_mm_shuffle_ps(Left.SSE, Left.SSE, 0x55), Right.Columns[1].SSE)); @@ -1110,32 +1110,32 @@ static inline HMM_Vec4 HMM_LinearCombineV4M4(HMM_Vec4 Left, HMM_Mat4 Right) * 2x2 Matrices */ -COVERAGE(HMM_M2, 1) -static inline HMM_Mat2 HMM_M2(void) +COVERAGE(M2, 1) +static inline Mat2 M2(void) { - ASSERT_COVERED(HMM_M2); - HMM_Mat2 Result = {0}; + ASSERT_COVERED(M2); + Mat2 Result = {0}; return Result; } -COVERAGE(HMM_M2D, 1) -static inline HMM_Mat2 HMM_M2D(float Diagonal) +COVERAGE(M2D, 1) +static inline Mat2 M2D(float Diagonal) { - ASSERT_COVERED(HMM_M2D); + ASSERT_COVERED(M2D); - HMM_Mat2 Result = {0}; + Mat2 Result = {0}; Result.Elements[0][0] = Diagonal; Result.Elements[1][1] = Diagonal; return Result; } -COVERAGE(HMM_TransposeM2, 1) -static inline HMM_Mat2 HMM_TransposeM2(HMM_Mat2 Matrix) +COVERAGE(TransposeM2, 1) +static inline Mat2 TransposeM2(Mat2 Matrix) { - ASSERT_COVERED(HMM_TransposeM2); + ASSERT_COVERED(TransposeM2); - HMM_Mat2 Result = Matrix; + Mat2 Result = Matrix; Result.Elements[0][1] = Matrix.Elements[1][0]; Result.Elements[1][0] = Matrix.Elements[0][1]; @@ -1143,12 +1143,12 @@ static inline HMM_Mat2 HMM_TransposeM2(HMM_Mat2 Matrix) return Result; } -COVERAGE(HMM_AddM2, 1) -static inline HMM_Mat2 HMM_AddM2(HMM_Mat2 Left, HMM_Mat2 Right) +COVERAGE(AddM2, 1) +static inline Mat2 AddM2(Mat2 Left, Mat2 Right) { - ASSERT_COVERED(HMM_AddM2); + ASSERT_COVERED(AddM2); - HMM_Mat2 Result; + Mat2 Result; Result.Elements[0][0] = Left.Elements[0][0] + Right.Elements[0][0]; Result.Elements[0][1] = Left.Elements[0][1] + Right.Elements[0][1]; @@ -1158,12 +1158,12 @@ static inline HMM_Mat2 HMM_AddM2(HMM_Mat2 Left, HMM_Mat2 Right) return Result; } -COVERAGE(HMM_SubM2, 1) -static inline HMM_Mat2 HMM_SubM2(HMM_Mat2 Left, HMM_Mat2 Right) +COVERAGE(SubM2, 1) +static inline Mat2 SubM2(Mat2 Left, Mat2 Right) { - ASSERT_COVERED(HMM_SubM2); + ASSERT_COVERED(SubM2); - HMM_Mat2 Result; + Mat2 Result; Result.Elements[0][0] = Left.Elements[0][0] - Right.Elements[0][0]; Result.Elements[0][1] = Left.Elements[0][1] - Right.Elements[0][1]; @@ -1173,12 +1173,12 @@ static inline HMM_Mat2 HMM_SubM2(HMM_Mat2 Left, HMM_Mat2 Right) return Result; } -COVERAGE(HMM_MulM2V2, 1) -static inline HMM_Vec2 HMM_MulM2V2(HMM_Mat2 Matrix, HMM_Vec2 Vector) +COVERAGE(MulM2V2, 1) +static inline Vec2 MulM2V2(Mat2 Matrix, Vec2 Vector) { - ASSERT_COVERED(HMM_MulM2V2); + ASSERT_COVERED(MulM2V2); - HMM_Vec2 Result; + Vec2 Result; Result.X = Vector.Elements[0] * Matrix.Columns[0].X; Result.Y = Vector.Elements[0] * Matrix.Columns[0].Y; @@ -1189,24 +1189,24 @@ static inline HMM_Vec2 HMM_MulM2V2(HMM_Mat2 Matrix, HMM_Vec2 Vector) return Result; } -COVERAGE(HMM_MulM2, 1) -static inline HMM_Mat2 HMM_MulM2(HMM_Mat2 Left, HMM_Mat2 Right) +COVERAGE(MulM2, 1) +static inline Mat2 MulM2(Mat2 Left, Mat2 Right) { - ASSERT_COVERED(HMM_MulM2); + ASSERT_COVERED(MulM2); - HMM_Mat2 Result; - Result.Columns[0] = HMM_MulM2V2(Left, Right.Columns[0]); - Result.Columns[1] = HMM_MulM2V2(Left, Right.Columns[1]); + Mat2 Result; + Result.Columns[0] = MulM2V2(Left, Right.Columns[0]); + Result.Columns[1] = MulM2V2(Left, Right.Columns[1]); return Result; } -COVERAGE(HMM_MulM2F, 1) -static inline HMM_Mat2 HMM_MulM2F(HMM_Mat2 Matrix, float Scalar) +COVERAGE(MulM2F, 1) +static inline Mat2 MulM2F(Mat2 Matrix, float Scalar) { - ASSERT_COVERED(HMM_MulM2F); + ASSERT_COVERED(MulM2F); - HMM_Mat2 Result; + Mat2 Result; Result.Elements[0][0] = Matrix.Elements[0][0] * Scalar; Result.Elements[0][1] = Matrix.Elements[0][1] * Scalar; @@ -1216,12 +1216,12 @@ static inline HMM_Mat2 HMM_MulM2F(HMM_Mat2 Matrix, float Scalar) return Result; } -COVERAGE(HMM_DivM2F, 1) -static inline HMM_Mat2 HMM_DivM2F(HMM_Mat2 Matrix, float Scalar) +COVERAGE(DivM2F, 1) +static inline Mat2 DivM2F(Mat2 Matrix, float Scalar) { - ASSERT_COVERED(HMM_DivM2F); + ASSERT_COVERED(DivM2F); - HMM_Mat2 Result; + Mat2 Result; Result.Elements[0][0] = Matrix.Elements[0][0] / Scalar; Result.Elements[0][1] = Matrix.Elements[0][1] / Scalar; @@ -1231,21 +1231,21 @@ static inline HMM_Mat2 HMM_DivM2F(HMM_Mat2 Matrix, float Scalar) return Result; } -COVERAGE(HMM_DeterminantM2, 1) -static inline float HMM_DeterminantM2(HMM_Mat2 Matrix) +COVERAGE(DeterminantM2, 1) +static inline float DeterminantM2(Mat2 Matrix) { - ASSERT_COVERED(HMM_DeterminantM2); + ASSERT_COVERED(DeterminantM2); return Matrix.Elements[0][0]*Matrix.Elements[1][1] - Matrix.Elements[0][1]*Matrix.Elements[1][0]; } -COVERAGE(HMM_InvGeneralM2, 1) -static inline HMM_Mat2 HMM_InvGeneralM2(HMM_Mat2 Matrix) +COVERAGE(InvGeneralM2, 1) +static inline Mat2 InvGeneralM2(Mat2 Matrix) { - ASSERT_COVERED(HMM_InvGeneralM2); + ASSERT_COVERED(InvGeneralM2); - HMM_Mat2 Result; - float InvDeterminant = 1.0f / HMM_DeterminantM2(Matrix); + Mat2 Result; + float InvDeterminant = 1.0f / DeterminantM2(Matrix); Result.Elements[0][0] = InvDeterminant * +Matrix.Elements[1][1]; Result.Elements[1][1] = InvDeterminant * +Matrix.Elements[0][0]; Result.Elements[0][1] = InvDeterminant * -Matrix.Elements[0][1]; @@ -1258,20 +1258,20 @@ static inline HMM_Mat2 HMM_InvGeneralM2(HMM_Mat2 Matrix) * 3x3 Matrices */ -COVERAGE(HMM_M3, 1) -static inline HMM_Mat3 HMM_M3(void) +COVERAGE(M3, 1) +static inline Mat3 M3(void) { - ASSERT_COVERED(HMM_M3); - HMM_Mat3 Result = {0}; + ASSERT_COVERED(M3); + Mat3 Result = {0}; return Result; } -COVERAGE(HMM_M3D, 1) -static inline HMM_Mat3 HMM_M3D(float Diagonal) +COVERAGE(M3D, 1) +static inline Mat3 M3D(float Diagonal) { - ASSERT_COVERED(HMM_M3D); + ASSERT_COVERED(M3D); - HMM_Mat3 Result = {0}; + Mat3 Result = {0}; Result.Elements[0][0] = Diagonal; Result.Elements[1][1] = Diagonal; Result.Elements[2][2] = Diagonal; @@ -1279,12 +1279,12 @@ static inline HMM_Mat3 HMM_M3D(float Diagonal) return Result; } -COVERAGE(HMM_TransposeM3, 1) -static inline HMM_Mat3 HMM_TransposeM3(HMM_Mat3 Matrix) +COVERAGE(TransposeM3, 1) +static inline Mat3 TransposeM3(Mat3 Matrix) { - ASSERT_COVERED(HMM_TransposeM3); + ASSERT_COVERED(TransposeM3); - HMM_Mat3 Result = Matrix; + Mat3 Result = Matrix; Result.Elements[0][1] = Matrix.Elements[1][0]; Result.Elements[0][2] = Matrix.Elements[2][0]; @@ -1296,12 +1296,12 @@ static inline HMM_Mat3 HMM_TransposeM3(HMM_Mat3 Matrix) return Result; } -COVERAGE(HMM_AddM3, 1) -static inline HMM_Mat3 HMM_AddM3(HMM_Mat3 Left, HMM_Mat3 Right) +COVERAGE(AddM3, 1) +static inline Mat3 AddM3(Mat3 Left, Mat3 Right) { - ASSERT_COVERED(HMM_AddM3); + ASSERT_COVERED(AddM3); - HMM_Mat3 Result; + Mat3 Result; Result.Elements[0][0] = Left.Elements[0][0] + Right.Elements[0][0]; Result.Elements[0][1] = Left.Elements[0][1] + Right.Elements[0][1]; @@ -1316,12 +1316,12 @@ static inline HMM_Mat3 HMM_AddM3(HMM_Mat3 Left, HMM_Mat3 Right) return Result; } -COVERAGE(HMM_SubM3, 1) -static inline HMM_Mat3 HMM_SubM3(HMM_Mat3 Left, HMM_Mat3 Right) +COVERAGE(SubM3, 1) +static inline Mat3 SubM3(Mat3 Left, Mat3 Right) { - ASSERT_COVERED(HMM_SubM3); + ASSERT_COVERED(SubM3); - HMM_Mat3 Result; + Mat3 Result; Result.Elements[0][0] = Left.Elements[0][0] - Right.Elements[0][0]; Result.Elements[0][1] = Left.Elements[0][1] - Right.Elements[0][1]; @@ -1336,12 +1336,12 @@ static inline HMM_Mat3 HMM_SubM3(HMM_Mat3 Left, HMM_Mat3 Right) return Result; } -COVERAGE(HMM_MulM3V3, 1) -static inline HMM_Vec3 HMM_MulM3V3(HMM_Mat3 Matrix, HMM_Vec3 Vector) +COVERAGE(MulM3V3, 1) +static inline Vec3 MulM3V3(Mat3 Matrix, Vec3 Vector) { - ASSERT_COVERED(HMM_MulM3V3); + ASSERT_COVERED(MulM3V3); - HMM_Vec3 Result; + Vec3 Result; Result.X = Vector.Elements[0] * Matrix.Columns[0].X; Result.Y = Vector.Elements[0] * Matrix.Columns[0].Y; @@ -1358,25 +1358,25 @@ static inline HMM_Vec3 HMM_MulM3V3(HMM_Mat3 Matrix, HMM_Vec3 Vector) return Result; } -COVERAGE(HMM_MulM3, 1) -static inline HMM_Mat3 HMM_MulM3(HMM_Mat3 Left, HMM_Mat3 Right) +COVERAGE(MulM3, 1) +static inline Mat3 MulM3(Mat3 Left, Mat3 Right) { - ASSERT_COVERED(HMM_MulM3); + ASSERT_COVERED(MulM3); - HMM_Mat3 Result; - Result.Columns[0] = HMM_MulM3V3(Left, Right.Columns[0]); - Result.Columns[1] = HMM_MulM3V3(Left, Right.Columns[1]); - Result.Columns[2] = HMM_MulM3V3(Left, Right.Columns[2]); + Mat3 Result; + Result.Columns[0] = MulM3V3(Left, Right.Columns[0]); + Result.Columns[1] = MulM3V3(Left, Right.Columns[1]); + Result.Columns[2] = MulM3V3(Left, Right.Columns[2]); return Result; } -COVERAGE(HMM_MulM3F, 1) -static inline HMM_Mat3 HMM_MulM3F(HMM_Mat3 Matrix, float Scalar) +COVERAGE(MulM3F, 1) +static inline Mat3 MulM3F(Mat3 Matrix, float Scalar) { - ASSERT_COVERED(HMM_MulM3F); + ASSERT_COVERED(MulM3F); - HMM_Mat3 Result; + Mat3 Result; Result.Elements[0][0] = Matrix.Elements[0][0] * Scalar; Result.Elements[0][1] = Matrix.Elements[0][1] * Scalar; @@ -1391,12 +1391,12 @@ static inline HMM_Mat3 HMM_MulM3F(HMM_Mat3 Matrix, float Scalar) return Result; } -COVERAGE(HMM_DivM3, 1) -static inline HMM_Mat3 HMM_DivM3F(HMM_Mat3 Matrix, float Scalar) +COVERAGE(DivM3, 1) +static inline Mat3 DivM3F(Mat3 Matrix, float Scalar) { - ASSERT_COVERED(HMM_DivM3); + ASSERT_COVERED(DivM3); - HMM_Mat3 Result; + Mat3 Result; Result.Elements[0][0] = Matrix.Elements[0][0] / Scalar; Result.Elements[0][1] = Matrix.Elements[0][1] / Scalar; @@ -1411,57 +1411,57 @@ static inline HMM_Mat3 HMM_DivM3F(HMM_Mat3 Matrix, float Scalar) return Result; } -COVERAGE(HMM_DeterminantM3, 1) -static inline float HMM_DeterminantM3(HMM_Mat3 Matrix) +COVERAGE(DeterminantM3, 1) +static inline float DeterminantM3(Mat3 Matrix) { - ASSERT_COVERED(HMM_DeterminantM3); + ASSERT_COVERED(DeterminantM3); - HMM_Mat3 Cross; - Cross.Columns[0] = HMM_Cross(Matrix.Columns[1], Matrix.Columns[2]); - Cross.Columns[1] = HMM_Cross(Matrix.Columns[2], Matrix.Columns[0]); - Cross.Columns[2] = HMM_Cross(Matrix.Columns[0], Matrix.Columns[1]); + Mat3 cross_result; + cross_result.Columns[0] = Cross(Matrix.Columns[1], Matrix.Columns[2]); + cross_result.Columns[1] = Cross(Matrix.Columns[2], Matrix.Columns[0]); + cross_result.Columns[2] = Cross(Matrix.Columns[0], Matrix.Columns[1]); - return HMM_DotV3(Cross.Columns[2], Matrix.Columns[2]); + return DotV3(cross_result.Columns[2], Matrix.Columns[2]); } -COVERAGE(HMM_InvGeneralM3, 1) -static inline HMM_Mat3 HMM_InvGeneralM3(HMM_Mat3 Matrix) +COVERAGE(InvGeneralM3, 1) +static inline Mat3 InvGeneralM3(Mat3 Matrix) { - ASSERT_COVERED(HMM_InvGeneralM3); + ASSERT_COVERED(InvGeneralM3); - HMM_Mat3 Cross; - Cross.Columns[0] = HMM_Cross(Matrix.Columns[1], Matrix.Columns[2]); - Cross.Columns[1] = HMM_Cross(Matrix.Columns[2], Matrix.Columns[0]); - Cross.Columns[2] = HMM_Cross(Matrix.Columns[0], Matrix.Columns[1]); + Mat3 cross_result; + cross_result.Columns[0] = Cross(Matrix.Columns[1], Matrix.Columns[2]); + cross_result.Columns[1] = Cross(Matrix.Columns[2], Matrix.Columns[0]); + cross_result.Columns[2] = Cross(Matrix.Columns[0], Matrix.Columns[1]); - float InvDeterminant = 1.0f / HMM_DotV3(Cross.Columns[2], Matrix.Columns[2]); + float InvDeterminant = 1.0f / DotV3(cross_result.Columns[2], Matrix.Columns[2]); - HMM_Mat3 Result; - Result.Columns[0] = HMM_MulV3F(Cross.Columns[0], InvDeterminant); - Result.Columns[1] = HMM_MulV3F(Cross.Columns[1], InvDeterminant); - Result.Columns[2] = HMM_MulV3F(Cross.Columns[2], InvDeterminant); + Mat3 Result; + Result.Columns[0] = MulV3F(cross_result.Columns[0], InvDeterminant); + Result.Columns[1] = MulV3F(cross_result.Columns[1], InvDeterminant); + Result.Columns[2] = MulV3F(cross_result.Columns[2], InvDeterminant); - return HMM_TransposeM3(Result); + return TransposeM3(Result); } /* * 4x4 Matrices */ -COVERAGE(HMM_M4, 1) -static inline HMM_Mat4 HMM_M4(void) +COVERAGE(M4, 1) +static inline Mat4 M4(void) { - ASSERT_COVERED(HMM_M4); - HMM_Mat4 Result = {0}; + ASSERT_COVERED(M4); + Mat4 Result = {0}; return Result; } -COVERAGE(HMM_M4D, 1) -static inline HMM_Mat4 HMM_M4D(float Diagonal) +COVERAGE(M4D, 1) +static inline Mat4 M4D(float Diagonal) { - ASSERT_COVERED(HMM_M4D); + ASSERT_COVERED(M4D); - HMM_Mat4 Result = {0}; + Mat4 Result = {0}; Result.Elements[0][0] = Diagonal; Result.Elements[1][1] = Diagonal; Result.Elements[2][2] = Diagonal; @@ -1470,12 +1470,12 @@ static inline HMM_Mat4 HMM_M4D(float Diagonal) return Result; } -COVERAGE(HMM_TransposeM4, 1) -static inline HMM_Mat4 HMM_TransposeM4(HMM_Mat4 Matrix) +COVERAGE(TransposeM4, 1) +static inline Mat4 TransposeM4(Mat4 Matrix) { - ASSERT_COVERED(HMM_TransposeM4); + ASSERT_COVERED(TransposeM4); - HMM_Mat4 Result = Matrix; + Mat4 Result = Matrix; #ifdef HANDMADE_MATH__USE_SSE _MM_TRANSPOSE4_PS(Result.Columns[0].SSE, Result.Columns[1].SSE, Result.Columns[2].SSE, Result.Columns[3].SSE); #else @@ -1496,12 +1496,12 @@ static inline HMM_Mat4 HMM_TransposeM4(HMM_Mat4 Matrix) return Result; } -COVERAGE(HMM_AddM4, 1) -static inline HMM_Mat4 HMM_AddM4(HMM_Mat4 Left, HMM_Mat4 Right) +COVERAGE(AddM4, 1) +static inline Mat4 AddM4(Mat4 Left, Mat4 Right) { - ASSERT_COVERED(HMM_AddM4); + ASSERT_COVERED(AddM4); - HMM_Mat4 Result; + Mat4 Result; #ifdef HANDMADE_MATH__USE_SSE Result.Columns[0].SSE = _mm_add_ps(Left.Columns[0].SSE, Right.Columns[0].SSE); @@ -1530,12 +1530,12 @@ static inline HMM_Mat4 HMM_AddM4(HMM_Mat4 Left, HMM_Mat4 Right) return Result; } -COVERAGE(HMM_SubM4, 1) -static inline HMM_Mat4 HMM_SubM4(HMM_Mat4 Left, HMM_Mat4 Right) +COVERAGE(SubM4, 1) +static inline Mat4 SubM4(Mat4 Left, Mat4 Right) { - ASSERT_COVERED(HMM_SubM4); + ASSERT_COVERED(SubM4); - HMM_Mat4 Result; + Mat4 Result; #ifdef HANDMADE_MATH__USE_SSE Result.Columns[0].SSE = _mm_sub_ps(Left.Columns[0].SSE, Right.Columns[0].SSE); @@ -1564,26 +1564,26 @@ static inline HMM_Mat4 HMM_SubM4(HMM_Mat4 Left, HMM_Mat4 Right) return Result; } -COVERAGE(HMM_MulM4, 1) -static inline HMM_Mat4 HMM_MulM4(HMM_Mat4 Left, HMM_Mat4 Right) +COVERAGE(MulM4, 1) +static inline Mat4 MulM4(Mat4 Left, Mat4 Right) { - ASSERT_COVERED(HMM_MulM4); + ASSERT_COVERED(MulM4); - HMM_Mat4 Result; - Result.Columns[0] = HMM_LinearCombineV4M4(Right.Columns[0], Left); - Result.Columns[1] = HMM_LinearCombineV4M4(Right.Columns[1], Left); - Result.Columns[2] = HMM_LinearCombineV4M4(Right.Columns[2], Left); - Result.Columns[3] = HMM_LinearCombineV4M4(Right.Columns[3], Left); + Mat4 Result; + Result.Columns[0] = LinearCombineV4M4(Right.Columns[0], Left); + Result.Columns[1] = LinearCombineV4M4(Right.Columns[1], Left); + Result.Columns[2] = LinearCombineV4M4(Right.Columns[2], Left); + Result.Columns[3] = LinearCombineV4M4(Right.Columns[3], Left); return Result; } -COVERAGE(HMM_MulM4F, 1) -static inline HMM_Mat4 HMM_MulM4F(HMM_Mat4 Matrix, float Scalar) +COVERAGE(MulM4F, 1) +static inline Mat4 MulM4F(Mat4 Matrix, float Scalar) { - ASSERT_COVERED(HMM_MulM4F); + ASSERT_COVERED(MulM4F); - HMM_Mat4 Result; + Mat4 Result; #ifdef HANDMADE_MATH__USE_SSE __m128 SSEScalar = _mm_set1_ps(Scalar); @@ -1613,19 +1613,19 @@ static inline HMM_Mat4 HMM_MulM4F(HMM_Mat4 Matrix, float Scalar) return Result; } -COVERAGE(HMM_MulM4V4, 1) -static inline HMM_Vec4 HMM_MulM4V4(HMM_Mat4 Matrix, HMM_Vec4 Vector) +COVERAGE(MulM4V4, 1) +static inline Vec4 MulM4V4(Mat4 Matrix, Vec4 Vector) { - ASSERT_COVERED(HMM_MulM4V4); - return HMM_LinearCombineV4M4(Vector, Matrix); + ASSERT_COVERED(MulM4V4); + return LinearCombineV4M4(Vector, Matrix); } -COVERAGE(HMM_DivM4F, 1) -static inline HMM_Mat4 HMM_DivM4F(HMM_Mat4 Matrix, float Scalar) +COVERAGE(DivM4F, 1) +static inline Mat4 DivM4F(Mat4 Matrix, float Scalar) { - ASSERT_COVERED(HMM_DivM4F); + ASSERT_COVERED(DivM4F); - HMM_Mat4 Result; + Mat4 Result; #ifdef HANDMADE_MATH__USE_SSE __m128 SSEScalar = _mm_set1_ps(Scalar); @@ -1655,54 +1655,54 @@ static inline HMM_Mat4 HMM_DivM4F(HMM_Mat4 Matrix, float Scalar) return Result; } -COVERAGE(HMM_DeterminantM4, 1) -static inline float HMM_DeterminantM4(HMM_Mat4 Matrix) +COVERAGE(DeterminantM4, 1) +static inline float DeterminantM4(Mat4 Matrix) { - ASSERT_COVERED(HMM_DeterminantM4); + ASSERT_COVERED(DeterminantM4); - HMM_Vec3 C01 = HMM_Cross(Matrix.Columns[0].XYZ, Matrix.Columns[1].XYZ); - HMM_Vec3 C23 = HMM_Cross(Matrix.Columns[2].XYZ, Matrix.Columns[3].XYZ); - HMM_Vec3 B10 = HMM_SubV3(HMM_MulV3F(Matrix.Columns[0].XYZ, Matrix.Columns[1].W), HMM_MulV3F(Matrix.Columns[1].XYZ, Matrix.Columns[0].W)); - HMM_Vec3 B32 = HMM_SubV3(HMM_MulV3F(Matrix.Columns[2].XYZ, Matrix.Columns[3].W), HMM_MulV3F(Matrix.Columns[3].XYZ, Matrix.Columns[2].W)); + Vec3 C01 = Cross(Matrix.Columns[0].XYZ, Matrix.Columns[1].XYZ); + Vec3 C23 = Cross(Matrix.Columns[2].XYZ, Matrix.Columns[3].XYZ); + Vec3 B10 = SubV3(MulV3F(Matrix.Columns[0].XYZ, Matrix.Columns[1].W), MulV3F(Matrix.Columns[1].XYZ, Matrix.Columns[0].W)); + Vec3 B32 = SubV3(MulV3F(Matrix.Columns[2].XYZ, Matrix.Columns[3].W), MulV3F(Matrix.Columns[3].XYZ, Matrix.Columns[2].W)); - return HMM_DotV3(C01, B32) + HMM_DotV3(C23, B10); + return DotV3(C01, B32) + DotV3(C23, B10); } -COVERAGE(HMM_InvGeneralM4, 1) -static inline HMM_Mat4 HMM_InvGeneralM4(HMM_Mat4 Matrix) +COVERAGE(InvGeneralM4, 1) +static inline Mat4 InvGeneralM4(Mat4 Matrix) { - ASSERT_COVERED(HMM_InvGeneralM4); + ASSERT_COVERED(InvGeneralM4); - HMM_Vec3 C01 = HMM_Cross(Matrix.Columns[0].XYZ, Matrix.Columns[1].XYZ); - HMM_Vec3 C23 = HMM_Cross(Matrix.Columns[2].XYZ, Matrix.Columns[3].XYZ); - HMM_Vec3 B10 = HMM_SubV3(HMM_MulV3F(Matrix.Columns[0].XYZ, Matrix.Columns[1].W), HMM_MulV3F(Matrix.Columns[1].XYZ, Matrix.Columns[0].W)); - HMM_Vec3 B32 = HMM_SubV3(HMM_MulV3F(Matrix.Columns[2].XYZ, Matrix.Columns[3].W), HMM_MulV3F(Matrix.Columns[3].XYZ, Matrix.Columns[2].W)); + Vec3 C01 = Cross(Matrix.Columns[0].XYZ, Matrix.Columns[1].XYZ); + Vec3 C23 = Cross(Matrix.Columns[2].XYZ, Matrix.Columns[3].XYZ); + Vec3 B10 = SubV3(MulV3F(Matrix.Columns[0].XYZ, Matrix.Columns[1].W), MulV3F(Matrix.Columns[1].XYZ, Matrix.Columns[0].W)); + Vec3 B32 = SubV3(MulV3F(Matrix.Columns[2].XYZ, Matrix.Columns[3].W), MulV3F(Matrix.Columns[3].XYZ, Matrix.Columns[2].W)); - float InvDeterminant = 1.0f / (HMM_DotV3(C01, B32) + HMM_DotV3(C23, B10)); - C01 = HMM_MulV3F(C01, InvDeterminant); - C23 = HMM_MulV3F(C23, InvDeterminant); - B10 = HMM_MulV3F(B10, InvDeterminant); - B32 = HMM_MulV3F(B32, InvDeterminant); - - HMM_Mat4 Result; - Result.Columns[0] = HMM_V4V(HMM_AddV3(HMM_Cross(Matrix.Columns[1].XYZ, B32), HMM_MulV3F(C23, Matrix.Columns[1].W)), -HMM_DotV3(Matrix.Columns[1].XYZ, C23)); - Result.Columns[1] = HMM_V4V(HMM_SubV3(HMM_Cross(B32, Matrix.Columns[0].XYZ), HMM_MulV3F(C23, Matrix.Columns[0].W)), +HMM_DotV3(Matrix.Columns[0].XYZ, C23)); - Result.Columns[2] = HMM_V4V(HMM_AddV3(HMM_Cross(Matrix.Columns[3].XYZ, B10), HMM_MulV3F(C01, Matrix.Columns[3].W)), -HMM_DotV3(Matrix.Columns[3].XYZ, C01)); - Result.Columns[3] = HMM_V4V(HMM_SubV3(HMM_Cross(B10, Matrix.Columns[2].XYZ), HMM_MulV3F(C01, Matrix.Columns[2].W)), +HMM_DotV3(Matrix.Columns[2].XYZ, C01)); + float InvDeterminant = 1.0f / (DotV3(C01, B32) + DotV3(C23, B10)); + C01 = MulV3F(C01, InvDeterminant); + C23 = MulV3F(C23, InvDeterminant); + B10 = MulV3F(B10, InvDeterminant); + B32 = MulV3F(B32, InvDeterminant); + + Mat4 Result; + Result.Columns[0] = V4V(AddV3(Cross(Matrix.Columns[1].XYZ, B32), MulV3F(C23, Matrix.Columns[1].W)), -DotV3(Matrix.Columns[1].XYZ, C23)); + Result.Columns[1] = V4V(SubV3(Cross(B32, Matrix.Columns[0].XYZ), MulV3F(C23, Matrix.Columns[0].W)), +DotV3(Matrix.Columns[0].XYZ, C23)); + Result.Columns[2] = V4V(AddV3(Cross(Matrix.Columns[3].XYZ, B10), MulV3F(C01, Matrix.Columns[3].W)), -DotV3(Matrix.Columns[3].XYZ, C01)); + Result.Columns[3] = V4V(SubV3(Cross(B10, Matrix.Columns[2].XYZ), MulV3F(C01, Matrix.Columns[2].W)), +DotV3(Matrix.Columns[2].XYZ, C01)); - return HMM_TransposeM4(Result); + return TransposeM4(Result); } /* * Common graphics transformations */ -COVERAGE(HMM_Orthographic_RH_NO, 1) -static inline HMM_Mat4 HMM_Orthographic_RH_NO(float Left, float Right, float Bottom, float Top, float Near, float Far) +COVERAGE(Orthographic_RH_NO, 1) +static inline Mat4 Orthographic_RH_NO(float Left, float Right, float Bottom, float Top, float Near, float Far) { - ASSERT_COVERED(HMM_Orthographic_RH_NO); + ASSERT_COVERED(Orthographic_RH_NO); - HMM_Mat4 Result = {0}; + Mat4 Result = {0}; Result.Elements[0][0] = 2.0f / (Right - Left); Result.Elements[1][1] = 2.0f / (Top - Bottom); @@ -1717,12 +1717,12 @@ static inline HMM_Mat4 HMM_Orthographic_RH_NO(float Left, float Right, float Bot return Result; } -COVERAGE(HMM_Orthographic_RH_ZO, 1) -static inline HMM_Mat4 HMM_Orthographic_RH_ZO(float Left, float Right, float Bottom, float Top, float Near, float Far) +COVERAGE(Orthographic_RH_ZO, 1) +static inline Mat4 Orthographic_RH_ZO(float Left, float Right, float Bottom, float Top, float Near, float Far) { - ASSERT_COVERED(HMM_Orthographic_RH_ZO); + ASSERT_COVERED(Orthographic_RH_ZO); - HMM_Mat4 Result = {0}; + Mat4 Result = {0}; Result.Elements[0][0] = 2.0f / (Right - Left); Result.Elements[1][1] = 2.0f / (Top - Bottom); @@ -1737,34 +1737,34 @@ static inline HMM_Mat4 HMM_Orthographic_RH_ZO(float Left, float Right, float Bot return Result; } -COVERAGE(HMM_Orthographic_LH_NO, 1) -static inline HMM_Mat4 HMM_Orthographic_LH_NO(float Left, float Right, float Bottom, float Top, float Near, float Far) +COVERAGE(Orthographic_LH_NO, 1) +static inline Mat4 Orthographic_LH_NO(float Left, float Right, float Bottom, float Top, float Near, float Far) { - ASSERT_COVERED(HMM_Orthographic_LH_NO); + ASSERT_COVERED(Orthographic_LH_NO); - HMM_Mat4 Result = HMM_Orthographic_RH_NO(Left, Right, Bottom, Top, Near, Far); + Mat4 Result = Orthographic_RH_NO(Left, Right, Bottom, Top, Near, Far); Result.Elements[2][2] = -Result.Elements[2][2]; return Result; } -COVERAGE(HMM_Orthographic_LH_ZO, 1) -static inline HMM_Mat4 HMM_Orthographic_LH_ZO(float Left, float Right, float Bottom, float Top, float Near, float Far) +COVERAGE(Orthographic_LH_ZO, 1) +static inline Mat4 Orthographic_LH_ZO(float Left, float Right, float Bottom, float Top, float Near, float Far) { - ASSERT_COVERED(HMM_Orthographic_LH_ZO); + ASSERT_COVERED(Orthographic_LH_ZO); - HMM_Mat4 Result = HMM_Orthographic_RH_ZO(Left, Right, Bottom, Top, Near, Far); + Mat4 Result = Orthographic_RH_ZO(Left, Right, Bottom, Top, Near, Far); Result.Elements[2][2] = -Result.Elements[2][2]; return Result; } -COVERAGE(HMM_InvOrthographic, 1) -static inline HMM_Mat4 HMM_InvOrthographic(HMM_Mat4 OrthoMatrix) +COVERAGE(InvOrthographic, 1) +static inline Mat4 InvOrthographic(Mat4 OrthoMatrix) { - ASSERT_COVERED(HMM_InvOrthographic); + ASSERT_COVERED(InvOrthographic); - HMM_Mat4 Result = {0}; + Mat4 Result = {0}; Result.Elements[0][0] = 1.0f / OrthoMatrix.Elements[0][0]; Result.Elements[1][1] = 1.0f / OrthoMatrix.Elements[1][1]; Result.Elements[2][2] = 1.0f / OrthoMatrix.Elements[2][2]; @@ -1777,16 +1777,16 @@ static inline HMM_Mat4 HMM_InvOrthographic(HMM_Mat4 OrthoMatrix) return Result; } -COVERAGE(HMM_Perspective_RH_NO, 1) -static inline HMM_Mat4 HMM_Perspective_RH_NO(float FOV, float AspectRatio, float Near, float Far) +COVERAGE(Perspective_RH_NO, 1) +static inline Mat4 Perspective_RH_NO(float FOV, float AspectRatio, float Near, float Far) { - ASSERT_COVERED(HMM_Perspective_RH_NO); + ASSERT_COVERED(Perspective_RH_NO); - HMM_Mat4 Result = {0}; + Mat4 Result = {0}; // See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml - float Cotangent = 1.0f / HMM_TanF(FOV / 2.0f); + float Cotangent = 1.0f / TanF(FOV / 2.0f); Result.Elements[0][0] = Cotangent / AspectRatio; Result.Elements[1][1] = Cotangent; Result.Elements[2][3] = -1.0f; @@ -1797,16 +1797,16 @@ static inline HMM_Mat4 HMM_Perspective_RH_NO(float FOV, float AspectRatio, float return Result; } -COVERAGE(HMM_Perspective_RH_ZO, 1) -static inline HMM_Mat4 HMM_Perspective_RH_ZO(float FOV, float AspectRatio, float Near, float Far) +COVERAGE(Perspective_RH_ZO, 1) +static inline Mat4 Perspective_RH_ZO(float FOV, float AspectRatio, float Near, float Far) { - ASSERT_COVERED(HMM_Perspective_RH_ZO); + ASSERT_COVERED(Perspective_RH_ZO); - HMM_Mat4 Result = {0}; + Mat4 Result = {0}; // See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml - float Cotangent = 1.0f / HMM_TanF(FOV / 2.0f); + float Cotangent = 1.0f / TanF(FOV / 2.0f); Result.Elements[0][0] = Cotangent / AspectRatio; Result.Elements[1][1] = Cotangent; Result.Elements[2][3] = -1.0f; @@ -1817,36 +1817,36 @@ static inline HMM_Mat4 HMM_Perspective_RH_ZO(float FOV, float AspectRatio, float return Result; } -COVERAGE(HMM_Perspective_LH_NO, 1) -static inline HMM_Mat4 HMM_Perspective_LH_NO(float FOV, float AspectRatio, float Near, float Far) +COVERAGE(Perspective_LH_NO, 1) +static inline Mat4 Perspective_LH_NO(float FOV, float AspectRatio, float Near, float Far) { - ASSERT_COVERED(HMM_Perspective_LH_NO); + ASSERT_COVERED(Perspective_LH_NO); - HMM_Mat4 Result = HMM_Perspective_RH_NO(FOV, AspectRatio, Near, Far); + Mat4 Result = Perspective_RH_NO(FOV, AspectRatio, Near, Far); Result.Elements[2][2] = -Result.Elements[2][2]; Result.Elements[2][3] = -Result.Elements[2][3]; return Result; } -COVERAGE(HMM_Perspective_LH_ZO, 1) -static inline HMM_Mat4 HMM_Perspective_LH_ZO(float FOV, float AspectRatio, float Near, float Far) +COVERAGE(Perspective_LH_ZO, 1) +static inline Mat4 Perspective_LH_ZO(float FOV, float AspectRatio, float Near, float Far) { - ASSERT_COVERED(HMM_Perspective_LH_ZO); + ASSERT_COVERED(Perspective_LH_ZO); - HMM_Mat4 Result = HMM_Perspective_RH_ZO(FOV, AspectRatio, Near, Far); + Mat4 Result = Perspective_RH_ZO(FOV, AspectRatio, Near, Far); Result.Elements[2][2] = -Result.Elements[2][2]; Result.Elements[2][3] = -Result.Elements[2][3]; return Result; } -COVERAGE(HMM_InvPerspective, 1) -static inline HMM_Mat4 HMM_InvPerspective(HMM_Mat4 PerspectiveMatrix) +COVERAGE(InvPerspective, 1) +static inline Mat4 InvPerspective(Mat4 PerspectiveMatrix) { - ASSERT_COVERED(HMM_InvPerspective); + ASSERT_COVERED(InvPerspective); - HMM_Mat4 Result = {0}; + Mat4 Result = {0}; Result.Elements[0][0] = 1.0f / PerspectiveMatrix.Elements[0][0]; Result.Elements[1][1] = 1.0f / PerspectiveMatrix.Elements[1][1]; Result.Elements[2][2] = 0.0f; @@ -1858,12 +1858,12 @@ static inline HMM_Mat4 HMM_InvPerspective(HMM_Mat4 PerspectiveMatrix) return Result; } -COVERAGE(HMM_Translate, 1) -static inline HMM_Mat4 HMM_Translate(HMM_Vec3 Translation) +COVERAGE(Translate, 1) +static inline Mat4 Translate(Vec3 Translation) { - ASSERT_COVERED(HMM_Translate); + ASSERT_COVERED(Translate); - HMM_Mat4 Result = HMM_M4D(1.0f); + Mat4 Result = M4D(1.0f); Result.Elements[3][0] = Translation.X; Result.Elements[3][1] = Translation.Y; Result.Elements[3][2] = Translation.Z; @@ -1871,12 +1871,12 @@ static inline HMM_Mat4 HMM_Translate(HMM_Vec3 Translation) return Result; } -COVERAGE(HMM_InvTranslate, 1) -static inline HMM_Mat4 HMM_InvTranslate(HMM_Mat4 TranslationMatrix) +COVERAGE(InvTranslate, 1) +static inline Mat4 InvTranslate(Mat4 TranslationMatrix) { - ASSERT_COVERED(HMM_InvTranslate); + ASSERT_COVERED(InvTranslate); - HMM_Mat4 Result = TranslationMatrix; + Mat4 Result = TranslationMatrix; Result.Elements[3][0] = -Result.Elements[3][0]; Result.Elements[3][1] = -Result.Elements[3][1]; Result.Elements[3][2] = -Result.Elements[3][2]; @@ -1884,17 +1884,17 @@ static inline HMM_Mat4 HMM_InvTranslate(HMM_Mat4 TranslationMatrix) return Result; } -COVERAGE(HMM_Rotate_RH, 1) -static inline HMM_Mat4 HMM_Rotate_RH(float Angle, HMM_Vec3 Axis) +COVERAGE(Rotate_RH, 1) +static inline Mat4 Rotate_RH(float Angle, Vec3 Axis) { - ASSERT_COVERED(HMM_Rotate_RH); + ASSERT_COVERED(Rotate_RH); - HMM_Mat4 Result = HMM_M4D(1.0f); + Mat4 Result = M4D(1.0f); - Axis = HMM_NormV3(Axis); + Axis = NormV3(Axis); - float SinTheta = HMM_SinF(Angle); - float CosTheta = HMM_CosF(Angle); + float SinTheta = SinF(Angle); + float CosTheta = CosF(Angle); float CosValue = 1.0f - CosTheta; Result.Elements[0][0] = (Axis.X * Axis.X * CosValue) + CosTheta; @@ -1912,27 +1912,27 @@ static inline HMM_Mat4 HMM_Rotate_RH(float Angle, HMM_Vec3 Axis) return Result; } -COVERAGE(HMM_Rotate_LH, 1) -static inline HMM_Mat4 HMM_Rotate_LH(float Angle, HMM_Vec3 Axis) +COVERAGE(Rotate_LH, 1) +static inline Mat4 Rotate_LH(float Angle, Vec3 Axis) { - ASSERT_COVERED(HMM_Rotate_LH); + ASSERT_COVERED(Rotate_LH); /* NOTE(lcf): Matrix will be inverse/transpose of RH. */ - return HMM_Rotate_RH(-Angle, Axis); + return Rotate_RH(-Angle, Axis); } -COVERAGE(HMM_InvRotate, 1) -static inline HMM_Mat4 HMM_InvRotate(HMM_Mat4 RotationMatrix) +COVERAGE(InvRotate, 1) +static inline Mat4 InvRotate(Mat4 RotationMatrix) { - ASSERT_COVERED(HMM_InvRotate); - return HMM_TransposeM4(RotationMatrix); + ASSERT_COVERED(InvRotate); + return TransposeM4(RotationMatrix); } -COVERAGE(HMM_Scale, 1) -static inline HMM_Mat4 HMM_Scale(HMM_Vec3 Scale) +COVERAGE(Scale, 1) +static inline Mat4 Scale(Vec3 Scale) { - ASSERT_COVERED(HMM_Scale); + ASSERT_COVERED(Scale); - HMM_Mat4 Result = HMM_M4D(1.0f); + Mat4 Result = M4D(1.0f); Result.Elements[0][0] = Scale.X; Result.Elements[1][1] = Scale.Y; Result.Elements[2][2] = Scale.Z; @@ -1940,12 +1940,12 @@ static inline HMM_Mat4 HMM_Scale(HMM_Vec3 Scale) return Result; } -COVERAGE(HMM_InvScale, 1) -static inline HMM_Mat4 HMM_InvScale(HMM_Mat4 ScaleMatrix) +COVERAGE(InvScale, 1) +static inline Mat4 InvScale(Mat4 ScaleMatrix) { - ASSERT_COVERED(HMM_InvScale); + ASSERT_COVERED(InvScale); - HMM_Mat4 Result = ScaleMatrix; + Mat4 Result = ScaleMatrix; Result.Elements[0][0] = 1.0f / Result.Elements[0][0]; Result.Elements[1][1] = 1.0f / Result.Elements[1][1]; Result.Elements[2][2] = 1.0f / Result.Elements[2][2]; @@ -1953,9 +1953,9 @@ static inline HMM_Mat4 HMM_InvScale(HMM_Mat4 ScaleMatrix) return Result; } -static inline HMM_Mat4 _HMM_LookAt(HMM_Vec3 F, HMM_Vec3 S, HMM_Vec3 U, HMM_Vec3 Eye) +static inline Mat4 _LookAt(Vec3 F, Vec3 S, Vec3 U, Vec3 Eye) { - HMM_Mat4 Result; + Mat4 Result; Result.Elements[0][0] = S.X; Result.Elements[0][1] = U.X; @@ -1972,54 +1972,54 @@ static inline HMM_Mat4 _HMM_LookAt(HMM_Vec3 F, HMM_Vec3 S, HMM_Vec3 U, HMM_Vec Result.Elements[2][2] = -F.Z; Result.Elements[2][3] = 0.0f; - Result.Elements[3][0] = -HMM_DotV3(S, Eye); - Result.Elements[3][1] = -HMM_DotV3(U, Eye); - Result.Elements[3][2] = HMM_DotV3(F, Eye); + Result.Elements[3][0] = -DotV3(S, Eye); + Result.Elements[3][1] = -DotV3(U, Eye); + Result.Elements[3][2] = DotV3(F, Eye); Result.Elements[3][3] = 1.0f; return Result; } -COVERAGE(HMM_LookAt_RH, 1) -static inline HMM_Mat4 HMM_LookAt_RH(HMM_Vec3 Eye, HMM_Vec3 Center, HMM_Vec3 Up) +COVERAGE(LookAt_RH, 1) +static inline Mat4 LookAt_RH(Vec3 Eye, Vec3 Center, Vec3 Up) { - ASSERT_COVERED(HMM_LookAt_RH); + ASSERT_COVERED(LookAt_RH); - HMM_Vec3 F = HMM_NormV3(HMM_SubV3(Center, Eye)); - HMM_Vec3 S = HMM_NormV3(HMM_Cross(F, Up)); - HMM_Vec3 U = HMM_Cross(S, F); + Vec3 F = NormV3(SubV3(Center, Eye)); + Vec3 S = NormV3(Cross(F, Up)); + Vec3 U = Cross(S, F); - return _HMM_LookAt(F, S, U, Eye); + return _LookAt(F, S, U, Eye); } -COVERAGE(HMM_LookAt_LH, 1) -static inline HMM_Mat4 HMM_LookAt_LH(HMM_Vec3 Eye, HMM_Vec3 Center, HMM_Vec3 Up) +COVERAGE(LookAt_LH, 1) +static inline Mat4 LookAt_LH(Vec3 Eye, Vec3 Center, Vec3 Up) { - ASSERT_COVERED(HMM_LookAt_LH); + ASSERT_COVERED(LookAt_LH); - HMM_Vec3 F = HMM_NormV3(HMM_SubV3(Eye, Center)); - HMM_Vec3 S = HMM_NormV3(HMM_Cross(F, Up)); - HMM_Vec3 U = HMM_Cross(S, F); + Vec3 F = NormV3(SubV3(Eye, Center)); + Vec3 S = NormV3(Cross(F, Up)); + Vec3 U = Cross(S, F); - return _HMM_LookAt(F, S, U, Eye); + return _LookAt(F, S, U, Eye); } -COVERAGE(HMM_InvLookAt, 1) -static inline HMM_Mat4 HMM_InvLookAt(HMM_Mat4 Matrix) +COVERAGE(InvLookAt, 1) +static inline Mat4 InvLookAt(Mat4 Matrix) { - ASSERT_COVERED(HMM_InvLookAt); - HMM_Mat4 Result; + ASSERT_COVERED(InvLookAt); + Mat4 Result; - HMM_Mat3 Rotation = {0}; + Mat3 Rotation = {0}; Rotation.Columns[0] = Matrix.Columns[0].XYZ; Rotation.Columns[1] = Matrix.Columns[1].XYZ; Rotation.Columns[2] = Matrix.Columns[2].XYZ; - Rotation = HMM_TransposeM3(Rotation); + Rotation = TransposeM3(Rotation); - Result.Columns[0] = HMM_V4V(Rotation.Columns[0], 0.0f); - Result.Columns[1] = HMM_V4V(Rotation.Columns[1], 0.0f); - Result.Columns[2] = HMM_V4V(Rotation.Columns[2], 0.0f); - Result.Columns[3] = HMM_MulV4F(Matrix.Columns[3], -1.0f); + Result.Columns[0] = V4V(Rotation.Columns[0], 0.0f); + Result.Columns[1] = V4V(Rotation.Columns[1], 0.0f); + Result.Columns[2] = V4V(Rotation.Columns[2], 0.0f); + Result.Columns[3] = MulV4F(Matrix.Columns[3], -1.0f); Result.Elements[3][0] = -1.0f * Matrix.Elements[3][0] / (Rotation.Elements[0][0] + Rotation.Elements[0][1] + Rotation.Elements[0][2]); Result.Elements[3][1] = -1.0f * Matrix.Elements[3][1] / @@ -2035,12 +2035,12 @@ static inline HMM_Mat4 HMM_InvLookAt(HMM_Mat4 Matrix) * Quaternion operations */ -COVERAGE(HMM_Q, 1) -static inline HMM_Quat HMM_Q(float X, float Y, float Z, float W) +COVERAGE(Q, 1) +static inline Quat Make_Q(float X, float Y, float Z, float W) { - ASSERT_COVERED(HMM_Q); + ASSERT_COVERED(Q); - HMM_Quat Result; + Quat Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = _mm_setr_ps(X, Y, Z, W); @@ -2054,12 +2054,12 @@ static inline HMM_Quat HMM_Q(float X, float Y, float Z, float W) return Result; } -COVERAGE(HMM_QV4, 1) -static inline HMM_Quat HMM_QV4(HMM_Vec4 Vector) +COVERAGE(QV4, 1) +static inline Quat QV4(Vec4 Vector) { - ASSERT_COVERED(HMM_QV4); + ASSERT_COVERED(QV4); - HMM_Quat Result; + Quat Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = Vector.SSE; @@ -2073,12 +2073,12 @@ static inline HMM_Quat HMM_QV4(HMM_Vec4 Vector) return Result; } -COVERAGE(HMM_AddQ, 1) -static inline HMM_Quat HMM_AddQ(HMM_Quat Left, HMM_Quat Right) +COVERAGE(AddQ, 1) +static inline Quat AddQ(Quat Left, Quat Right) { - ASSERT_COVERED(HMM_AddQ); + ASSERT_COVERED(AddQ); - HMM_Quat Result; + Quat Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = _mm_add_ps(Left.SSE, Right.SSE); @@ -2093,12 +2093,12 @@ static inline HMM_Quat HMM_AddQ(HMM_Quat Left, HMM_Quat Right) return Result; } -COVERAGE(HMM_SubQ, 1) -static inline HMM_Quat HMM_SubQ(HMM_Quat Left, HMM_Quat Right) +COVERAGE(SubQ, 1) +static inline Quat SubQ(Quat Left, Quat Right) { - ASSERT_COVERED(HMM_SubQ); + ASSERT_COVERED(SubQ); - HMM_Quat Result; + Quat Result; #ifdef HANDMADE_MATH__USE_SSE Result.SSE = _mm_sub_ps(Left.SSE, Right.SSE); @@ -2112,12 +2112,12 @@ static inline HMM_Quat HMM_SubQ(HMM_Quat Left, HMM_Quat Right) return Result; } -COVERAGE(HMM_MulQ, 1) -static inline HMM_Quat HMM_MulQ(HMM_Quat Left, HMM_Quat Right) +COVERAGE(MulQ, 1) +static inline Quat MulQ(Quat Left, Quat Right) { - ASSERT_COVERED(HMM_MulQ); + ASSERT_COVERED(MulQ); - HMM_Quat Result; + Quat Result; #ifdef HANDMADE_MATH__USE_SSE __m128 SSEResultOne = _mm_xor_ps(_mm_shuffle_ps(Left.SSE, Left.SSE, _MM_SHUFFLE(0, 0, 0, 0)), _mm_setr_ps(0.f, -0.f, 0.f, -0.f)); @@ -2160,12 +2160,12 @@ static inline HMM_Quat HMM_MulQ(HMM_Quat Left, HMM_Quat Right) return Result; } -COVERAGE(HMM_MulQF, 1) -static inline HMM_Quat HMM_MulQF(HMM_Quat Left, float Multiplicative) +COVERAGE(MulQF, 1) +static inline Quat MulQF(Quat Left, float Multiplicative) { - ASSERT_COVERED(HMM_MulQF); + ASSERT_COVERED(MulQF); - HMM_Quat Result; + Quat Result; #ifdef HANDMADE_MATH__USE_SSE __m128 Scalar = _mm_set1_ps(Multiplicative); @@ -2180,12 +2180,12 @@ static inline HMM_Quat HMM_MulQF(HMM_Quat Left, float Multiplicative) return Result; } -COVERAGE(HMM_DivQF, 1) -static inline HMM_Quat HMM_DivQF(HMM_Quat Left, float Divnd) +COVERAGE(DivQF, 1) +static inline Quat DivQF(Quat Left, float Divnd) { - ASSERT_COVERED(HMM_DivQF); + ASSERT_COVERED(DivQF); - HMM_Quat Result; + Quat Result; #ifdef HANDMADE_MATH__USE_SSE __m128 Scalar = _mm_set1_ps(Divnd); @@ -2200,10 +2200,10 @@ static inline HMM_Quat HMM_DivQF(HMM_Quat Left, float Divnd) return Result; } -COVERAGE(HMM_DotQ, 1) -static inline float HMM_DotQ(HMM_Quat Left, HMM_Quat Right) +COVERAGE(DotQ, 1) +static inline float DotQ(Quat Left, Quat Right) { - ASSERT_COVERED(HMM_DotQ); + ASSERT_COVERED(DotQ); float Result; @@ -2221,35 +2221,36 @@ static inline float HMM_DotQ(HMM_Quat Left, HMM_Quat Right) return Result; } -COVERAGE(HMM_InvQ, 1) -static inline HMM_Quat HMM_InvQ(HMM_Quat Left) +COVERAGE(InvQ, 1) +static inline Quat InvQ(Quat Left) { - ASSERT_COVERED(HMM_InvQ); + ASSERT_COVERED(InvQ); - HMM_Quat Result; + Quat Result; Result.X = -Left.X; Result.Y = -Left.Y; Result.Z = -Left.Z; Result.W = Left.W; - return HMM_DivQF(Result, (HMM_DotQ(Left, Left))); + return DivQF(Result, (DotQ(Left, Left))); } -COVERAGE(HMM_NormQ, 1) -static inline HMM_Quat HMM_NormQ(HMM_Quat Quat) +COVERAGE(NormQ, 1) +static inline Quat NormQ(Quat q) { - ASSERT_COVERED(HMM_NormQ); + ASSERT_COVERED(NormQ); - /* NOTE(lcf): Take advantage of SSE implementation in HMM_NormV4 */ - HMM_Vec4 Vec = {Quat.X, Quat.Y, Quat.Z, Quat.W}; - Vec = HMM_NormV4(Vec); - HMM_Quat Result = {Vec.X, Vec.Y, Vec.Z, Vec.W}; + /* NOTE(lcf): Take advantage of SSE implementation in NormV4 */ + Vec4 v = {q.X, q.Y, q.Z, q.W}; + v = NormV4(v); + + Quat Result = {v.X, v.Y, v.Z, v.W}; return Result; } -static inline HMM_Quat _HMM_MixQ(HMM_Quat Left, float MixLeft, HMM_Quat Right, float MixRight) { - HMM_Quat Result; +static inline Quat _MixQ(Quat Left, float MixLeft, Quat Right, float MixRight) { + Quat Result; #ifdef HANDMADE_MATH__USE_SSE __m128 ScalarLeft = _mm_set1_ps(MixLeft); @@ -2267,54 +2268,54 @@ static inline HMM_Quat _HMM_MixQ(HMM_Quat Left, float MixLeft, HMM_Quat Right, f return Result; } -COVERAGE(HMM_NLerp, 1) -static inline HMM_Quat HMM_NLerp(HMM_Quat Left, float Time, HMM_Quat Right) +COVERAGE(NLerp, 1) +static inline Quat NLerp(Quat Left, float Time, Quat Right) { - ASSERT_COVERED(HMM_NLerp); + ASSERT_COVERED(NLerp); - HMM_Quat Result = _HMM_MixQ(Left, 1.0f-Time, Right, Time); - Result = HMM_NormQ(Result); + Quat Result = _MixQ(Left, 1.0f-Time, Right, Time); + Result = NormQ(Result); return Result; } -COVERAGE(HMM_SLerp, 1) -static inline HMM_Quat HMM_SLerp(HMM_Quat Left, float Time, HMM_Quat Right) +COVERAGE(SLerp, 1) +static inline Quat SLerp(Quat Left, float Time, Quat Right) { - ASSERT_COVERED(HMM_SLerp); + ASSERT_COVERED(SLerp); - HMM_Quat Result; + Quat Result; - float Cos_Theta = HMM_DotQ(Left, Right); + float Cos_Theta = DotQ(Left, Right); if (Cos_Theta < 0.0f) { /* NOTE(lcf): Take shortest path on Hyper-sphere */ Cos_Theta = -Cos_Theta; - Right = HMM_Q(-Right.X, -Right.Y, -Right.Z, -Right.W); + Right = Make_Q(-Right.X, -Right.Y, -Right.Z, -Right.W); } /* NOTE(lcf): Use Normalized Linear interpolation when vectors are roughly not L.I. */ if (Cos_Theta > 0.9995f) { - Result = HMM_NLerp(Left, Time, Right); + Result = NLerp(Left, Time, Right); } else { - float Angle = HMM_ACosF(Cos_Theta); - float MixLeft = HMM_SinF((1.0f - Time) * Angle); - float MixRight = HMM_SinF(Time * Angle); + float Angle = ACosF(Cos_Theta); + float MixLeft = SinF((1.0f - Time) * Angle); + float MixRight = SinF(Time * Angle); - Result = _HMM_MixQ(Left, MixLeft, Right, MixRight); - Result = HMM_NormQ(Result); + Result = _MixQ(Left, MixLeft, Right, MixRight); + Result = NormQ(Result); } return Result; } -COVERAGE(HMM_QToM4, 1) -static inline HMM_Mat4 HMM_QToM4(HMM_Quat Left) +COVERAGE(QToM4, 1) +static inline Mat4 QToM4(Quat Left) { - ASSERT_COVERED(HMM_QToM4); + ASSERT_COVERED(QToM4); - HMM_Mat4 Result; + Mat4 Result; - HMM_Quat NormalizedQ = HMM_NormQ(Left); + Quat NormalizedQ = NormQ(Left); float XX, YY, ZZ, XY, XZ, YZ, @@ -2367,28 +2368,28 @@ static inline HMM_Mat4 HMM_QToM4(HMM_Quat Left) // // Don't be confused! Or if you must be confused, at least trust this // comment. :) -COVERAGE(HMM_M4ToQ_RH, 4) -static inline HMM_Quat HMM_M4ToQ_RH(HMM_Mat4 M) +COVERAGE(M4ToQ_RH, 4) +static inline Quat M4ToQ_RH(Mat4 M) { float T; - HMM_Quat Q; + Quat Q; if (M.Elements[2][2] < 0.0f) { if (M.Elements[0][0] > M.Elements[1][1]) { - ASSERT_COVERED(HMM_M4ToQ_RH); + ASSERT_COVERED(M4ToQ_RH); T = 1 + M.Elements[0][0] - M.Elements[1][1] - M.Elements[2][2]; - Q = HMM_Q( + Q = Make_Q( T, M.Elements[0][1] + M.Elements[1][0], M.Elements[2][0] + M.Elements[0][2], M.Elements[1][2] - M.Elements[2][1] ); } else { - ASSERT_COVERED(HMM_M4ToQ_RH); + ASSERT_COVERED(M4ToQ_RH); T = 1 - M.Elements[0][0] + M.Elements[1][1] - M.Elements[2][2]; - Q = HMM_Q( + Q = Make_Q( M.Elements[0][1] + M.Elements[1][0], T, M.Elements[1][2] + M.Elements[2][1], @@ -2397,20 +2398,20 @@ static inline HMM_Quat HMM_M4ToQ_RH(HMM_Mat4 M) } } else { if (M.Elements[0][0] < -M.Elements[1][1]) { - ASSERT_COVERED(HMM_M4ToQ_RH); + ASSERT_COVERED(M4ToQ_RH); T = 1 - M.Elements[0][0] - M.Elements[1][1] + M.Elements[2][2]; - Q = HMM_Q( + Q = Make_Q( M.Elements[2][0] + M.Elements[0][2], M.Elements[1][2] + M.Elements[2][1], T, M.Elements[0][1] - M.Elements[1][0] ); } else { - ASSERT_COVERED(HMM_M4ToQ_RH); + ASSERT_COVERED(M4ToQ_RH); T = 1 + M.Elements[0][0] + M.Elements[1][1] + M.Elements[2][2]; - Q = HMM_Q( + Q = Make_Q( M.Elements[1][2] - M.Elements[2][1], M.Elements[2][0] - M.Elements[0][2], M.Elements[0][1] - M.Elements[1][0], @@ -2419,33 +2420,33 @@ static inline HMM_Quat HMM_M4ToQ_RH(HMM_Mat4 M) } } - Q = HMM_MulQF(Q, 0.5f / HMM_SqrtF(T)); + Q = MulQF(Q, 0.5f / SqrtF(T)); return Q; } -COVERAGE(HMM_M4ToQ_LH, 4) -static inline HMM_Quat HMM_M4ToQ_LH(HMM_Mat4 M) +COVERAGE(M4ToQ_LH, 4) +static inline Quat M4ToQ_LH(Mat4 M) { float T; - HMM_Quat Q; + Quat Q; if (M.Elements[2][2] < 0.0f) { if (M.Elements[0][0] > M.Elements[1][1]) { - ASSERT_COVERED(HMM_M4ToQ_LH); + ASSERT_COVERED(M4ToQ_LH); T = 1 + M.Elements[0][0] - M.Elements[1][1] - M.Elements[2][2]; - Q = HMM_Q( + Q = Make_Q( T, M.Elements[0][1] + M.Elements[1][0], M.Elements[2][0] + M.Elements[0][2], M.Elements[2][1] - M.Elements[1][2] ); } else { - ASSERT_COVERED(HMM_M4ToQ_LH); + ASSERT_COVERED(M4ToQ_LH); T = 1 - M.Elements[0][0] + M.Elements[1][1] - M.Elements[2][2]; - Q = HMM_Q( + Q = Make_Q( M.Elements[0][1] + M.Elements[1][0], T, M.Elements[1][2] + M.Elements[2][1], @@ -2454,20 +2455,20 @@ static inline HMM_Quat HMM_M4ToQ_LH(HMM_Mat4 M) } } else { if (M.Elements[0][0] < -M.Elements[1][1]) { - ASSERT_COVERED(HMM_M4ToQ_LH); + ASSERT_COVERED(M4ToQ_LH); T = 1 - M.Elements[0][0] - M.Elements[1][1] + M.Elements[2][2]; - Q = HMM_Q( + Q = Make_Q( M.Elements[2][0] + M.Elements[0][2], M.Elements[1][2] + M.Elements[2][1], T, M.Elements[1][0] - M.Elements[0][1] ); } else { - ASSERT_COVERED(HMM_M4ToQ_LH); + ASSERT_COVERED(M4ToQ_LH); T = 1 + M.Elements[0][0] + M.Elements[1][1] + M.Elements[2][2]; - Q = HMM_Q( + Q = Make_Q( M.Elements[2][1] - M.Elements[1][2], M.Elements[0][2] - M.Elements[2][0], M.Elements[1][0] - M.Elements[0][2], @@ -2476,34 +2477,34 @@ static inline HMM_Quat HMM_M4ToQ_LH(HMM_Mat4 M) } } - Q = HMM_MulQF(Q, 0.5f / HMM_SqrtF(T)); + Q = MulQF(Q, 0.5f / SqrtF(T)); return Q; } -COVERAGE(HMM_QFromAxisAngle_RH, 1) -static inline HMM_Quat HMM_QFromAxisAngle_RH(HMM_Vec3 Axis, float AngleOfRotation) +COVERAGE(QFromAxisAngle_RH, 1) +static inline Quat QFromAxisAngle_RH(Vec3 Axis, float AngleOfRotation) { - ASSERT_COVERED(HMM_QFromAxisAngle_RH); + ASSERT_COVERED(QFromAxisAngle_RH); - HMM_Quat Result; + Quat Result; - HMM_Vec3 AxisNormalized = HMM_NormV3(Axis); - float SineOfRotation = HMM_SinF(AngleOfRotation / 2.0f); + Vec3 AxisNormalized = NormV3(Axis); + float SineOfRotation = SinF(AngleOfRotation / 2.0f); - Result.XYZ = HMM_MulV3F(AxisNormalized, SineOfRotation); - Result.W = HMM_CosF(AngleOfRotation / 2.0f); + Result.XYZ = MulV3F(AxisNormalized, SineOfRotation); + Result.W = CosF(AngleOfRotation / 2.0f); return Result; } -COVERAGE(HMM_QFromAxisAngle_LH, 1) -static inline HMM_Quat HMM_QFromAxisAngle_LH(HMM_Vec3 Axis, float AngleOfRotation) +COVERAGE(QFromAxisAngle_LH, 1) +static inline Quat QFromAxisAngle_LH(Vec3 Axis, float AngleOfRotation) { - ASSERT_COVERED(HMM_QFromAxisAngle_LH); + ASSERT_COVERED(QFromAxisAngle_LH); - return HMM_QFromAxisAngle_RH(Axis, -AngleOfRotation); + return QFromAxisAngle_RH(Axis, -AngleOfRotation); } @@ -2513,1116 +2514,1116 @@ static inline HMM_Quat HMM_QFromAxisAngle_LH(HMM_Vec3 Axis, float AngleOfRotatio #ifdef __cplusplus -COVERAGE(HMM_LenV2CPP, 1) -static inline float HMM_Len(HMM_Vec2 A) +COVERAGE(LenV2CPP, 1) +static inline float Len(Vec2 A) { - ASSERT_COVERED(HMM_LenV2CPP); - return HMM_LenV2(A); + ASSERT_COVERED(LenV2CPP); + return LenV2(A); } -COVERAGE(HMM_LenV3CPP, 1) -static inline float HMM_Len(HMM_Vec3 A) +COVERAGE(LenV3CPP, 1) +static inline float Len(Vec3 A) { - ASSERT_COVERED(HMM_LenV3CPP); - return HMM_LenV3(A); + ASSERT_COVERED(LenV3CPP); + return LenV3(A); } -COVERAGE(HMM_LenV4CPP, 1) -static inline float HMM_Len(HMM_Vec4 A) +COVERAGE(LenV4CPP, 1) +static inline float Len(Vec4 A) { - ASSERT_COVERED(HMM_LenV4CPP); - return HMM_LenV4(A); + ASSERT_COVERED(LenV4CPP); + return LenV4(A); } -COVERAGE(HMM_LenSqrV2CPP, 1) -static inline float HMM_LenSqr(HMM_Vec2 A) +COVERAGE(LenSqrV2CPP, 1) +static inline float LenSqr(Vec2 A) { - ASSERT_COVERED(HMM_LenSqrV2CPP); - return HMM_LenSqrV2(A); + ASSERT_COVERED(LenSqrV2CPP); + return LenSqrV2(A); } -COVERAGE(HMM_LenSqrV3CPP, 1) -static inline float HMM_LenSqr(HMM_Vec3 A) +COVERAGE(LenSqrV3CPP, 1) +static inline float LenSqr(Vec3 A) { - ASSERT_COVERED(HMM_LenSqrV3CPP); - return HMM_LenSqrV3(A); + ASSERT_COVERED(LenSqrV3CPP); + return LenSqrV3(A); } -COVERAGE(HMM_LenSqrV4CPP, 1) -static inline float HMM_LenSqr(HMM_Vec4 A) +COVERAGE(LenSqrV4CPP, 1) +static inline float LenSqr(Vec4 A) { - ASSERT_COVERED(HMM_LenSqrV4CPP); - return HMM_LenSqrV4(A); + ASSERT_COVERED(LenSqrV4CPP); + return LenSqrV4(A); } -COVERAGE(HMM_NormV2CPP, 1) -static inline HMM_Vec2 HMM_Norm(HMM_Vec2 A) +COVERAGE(NormV2CPP, 1) +static inline Vec2 Norm(Vec2 A) { - ASSERT_COVERED(HMM_NormV2CPP); - return HMM_NormV2(A); + ASSERT_COVERED(NormV2CPP); + return NormV2(A); } -COVERAGE(HMM_NormV3CPP, 1) -static inline HMM_Vec3 HMM_Norm(HMM_Vec3 A) +COVERAGE(NormV3CPP, 1) +static inline Vec3 Norm(Vec3 A) { - ASSERT_COVERED(HMM_NormV3CPP); - return HMM_NormV3(A); + ASSERT_COVERED(NormV3CPP); + return NormV3(A); } -COVERAGE(HMM_NormV4CPP, 1) -static inline HMM_Vec4 HMM_Norm(HMM_Vec4 A) +COVERAGE(NormV4CPP, 1) +static inline Vec4 Norm(Vec4 A) { - ASSERT_COVERED(HMM_NormV4CPP); - return HMM_NormV4(A); + ASSERT_COVERED(NormV4CPP); + return NormV4(A); } -COVERAGE(HMM_NormQCPP, 1) -static inline HMM_Quat HMM_Norm(HMM_Quat A) +COVERAGE(NormQCPP, 1) +static inline Quat Norm(Quat A) { - ASSERT_COVERED(HMM_NormQCPP); - return HMM_NormQ(A); + ASSERT_COVERED(NormQCPP); + return NormQ(A); } -COVERAGE(HMM_DotV2CPP, 1) -static inline float HMM_Dot(HMM_Vec2 Left, HMM_Vec2 VecTwo) +COVERAGE(DotV2CPP, 1) +static inline float Dot(Vec2 Left, Vec2 VecTwo) { - ASSERT_COVERED(HMM_DotV2CPP); - return HMM_DotV2(Left, VecTwo); + ASSERT_COVERED(DotV2CPP); + return DotV2(Left, VecTwo); } -COVERAGE(HMM_DotV3CPP, 1) -static inline float HMM_Dot(HMM_Vec3 Left, HMM_Vec3 VecTwo) +COVERAGE(DotV3CPP, 1) +static inline float Dot(Vec3 Left, Vec3 VecTwo) { - ASSERT_COVERED(HMM_DotV3CPP); - return HMM_DotV3(Left, VecTwo); + ASSERT_COVERED(DotV3CPP); + return DotV3(Left, VecTwo); } -COVERAGE(HMM_DotV4CPP, 1) -static inline float HMM_Dot(HMM_Vec4 Left, HMM_Vec4 VecTwo) +COVERAGE(DotV4CPP, 1) +static inline float Dot(Vec4 Left, Vec4 VecTwo) { - ASSERT_COVERED(HMM_DotV4CPP); - return HMM_DotV4(Left, VecTwo); + ASSERT_COVERED(DotV4CPP); + return DotV4(Left, VecTwo); } -COVERAGE(HMM_LerpV2CPP, 1) -static inline HMM_Vec2 HMM_Lerp(HMM_Vec2 Left, float Time, HMM_Vec2 Right) +COVERAGE(LerpV2CPP, 1) +static inline Vec2 Lerp(Vec2 Left, float Time, Vec2 Right) { - ASSERT_COVERED(HMM_LerpV2CPP); - return HMM_LerpV2(Left, Time, Right); + ASSERT_COVERED(LerpV2CPP); + return LerpV2(Left, Time, Right); } -COVERAGE(HMM_LerpV3CPP, 1) -static inline HMM_Vec3 HMM_Lerp(HMM_Vec3 Left, float Time, HMM_Vec3 Right) +COVERAGE(LerpV3CPP, 1) +static inline Vec3 Lerp(Vec3 Left, float Time, Vec3 Right) { - ASSERT_COVERED(HMM_LerpV3CPP); - return HMM_LerpV3(Left, Time, Right); + ASSERT_COVERED(LerpV3CPP); + return LerpV3(Left, Time, Right); } -COVERAGE(HMM_LerpV4CPP, 1) -static inline HMM_Vec4 HMM_Lerp(HMM_Vec4 Left, float Time, HMM_Vec4 Right) +COVERAGE(LerpV4CPP, 1) +static inline Vec4 Lerp(Vec4 Left, float Time, Vec4 Right) { - ASSERT_COVERED(HMM_LerpV4CPP); - return HMM_LerpV4(Left, Time, Right); + ASSERT_COVERED(LerpV4CPP); + return LerpV4(Left, Time, Right); } -COVERAGE(HMM_TransposeM2CPP, 1) -static inline HMM_Mat2 HMM_Transpose(HMM_Mat2 Matrix) +COVERAGE(TransposeM2CPP, 1) +static inline Mat2 Transpose(Mat2 Matrix) { - ASSERT_COVERED(HMM_TransposeM2CPP); - return HMM_TransposeM2(Matrix); + ASSERT_COVERED(TransposeM2CPP); + return TransposeM2(Matrix); } -COVERAGE(HMM_TransposeM3CPP, 1) -static inline HMM_Mat3 HMM_Transpose(HMM_Mat3 Matrix) +COVERAGE(TransposeM3CPP, 1) +static inline Mat3 Transpose(Mat3 Matrix) { - ASSERT_COVERED(HMM_TransposeM3CPP); - return HMM_TransposeM3(Matrix); + ASSERT_COVERED(TransposeM3CPP); + return TransposeM3(Matrix); } -COVERAGE(HMM_TransposeM4CPP, 1) -static inline HMM_Mat4 HMM_Transpose(HMM_Mat4 Matrix) +COVERAGE(TransposeM4CPP, 1) +static inline Mat4 Transpose(Mat4 Matrix) { - ASSERT_COVERED(HMM_TransposeM4CPP); - return HMM_TransposeM4(Matrix); + ASSERT_COVERED(TransposeM4CPP); + return TransposeM4(Matrix); } -COVERAGE(HMM_DeterminantM2CPP, 1) -static inline float HMM_Determinant(HMM_Mat2 Matrix) +COVERAGE(DeterminantM2CPP, 1) +static inline float Determinant(Mat2 Matrix) { - ASSERT_COVERED(HMM_DeterminantM2CPP); - return HMM_DeterminantM2(Matrix); + ASSERT_COVERED(DeterminantM2CPP); + return DeterminantM2(Matrix); } -COVERAGE(HMM_DeterminantM3CPP, 1) -static inline float HMM_Determinant(HMM_Mat3 Matrix) +COVERAGE(DeterminantM3CPP, 1) +static inline float Determinant(Mat3 Matrix) { - ASSERT_COVERED(HMM_DeterminantM3CPP); - return HMM_DeterminantM3(Matrix); + ASSERT_COVERED(DeterminantM3CPP); + return DeterminantM3(Matrix); } -COVERAGE(HMM_DeterminantM4CPP, 1) -static inline float HMM_Determinant(HMM_Mat4 Matrix) +COVERAGE(DeterminantM4CPP, 1) +static inline float Determinant(Mat4 Matrix) { - ASSERT_COVERED(HMM_DeterminantM4CPP); - return HMM_DeterminantM4(Matrix); + ASSERT_COVERED(DeterminantM4CPP); + return DeterminantM4(Matrix); } -COVERAGE(HMM_InvGeneralM2CPP, 1) -static inline HMM_Mat2 HMM_InvGeneral(HMM_Mat2 Matrix) +COVERAGE(InvGeneralM2CPP, 1) +static inline Mat2 InvGeneral(Mat2 Matrix) { - ASSERT_COVERED(HMM_InvGeneralM2CPP); - return HMM_InvGeneralM2(Matrix); + ASSERT_COVERED(InvGeneralM2CPP); + return InvGeneralM2(Matrix); } -COVERAGE(HMM_InvGeneralM3CPP, 1) -static inline HMM_Mat3 HMM_InvGeneral(HMM_Mat3 Matrix) +COVERAGE(InvGeneralM3CPP, 1) +static inline Mat3 InvGeneral(Mat3 Matrix) { - ASSERT_COVERED(HMM_InvGeneralM3CPP); - return HMM_InvGeneralM3(Matrix); + ASSERT_COVERED(InvGeneralM3CPP); + return InvGeneralM3(Matrix); } -COVERAGE(HMM_InvGeneralM4CPP, 1) -static inline HMM_Mat4 HMM_InvGeneral(HMM_Mat4 Matrix) +COVERAGE(InvGeneralM4CPP, 1) +static inline Mat4 InvGeneral(Mat4 Matrix) { - ASSERT_COVERED(HMM_InvGeneralM4CPP); - return HMM_InvGeneralM4(Matrix); + ASSERT_COVERED(InvGeneralM4CPP); + return InvGeneralM4(Matrix); } -COVERAGE(HMM_DotQCPP, 1) -static inline float HMM_Dot(HMM_Quat QuatOne, HMM_Quat QuatTwo) +COVERAGE(DotQCPP, 1) +static inline float Dot(Quat QuatOne, Quat QuatTwo) { - ASSERT_COVERED(HMM_DotQCPP); - return HMM_DotQ(QuatOne, QuatTwo); + ASSERT_COVERED(DotQCPP); + return DotQ(QuatOne, QuatTwo); } -COVERAGE(HMM_AddV2CPP, 1) -static inline HMM_Vec2 HMM_Add(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(AddV2CPP, 1) +static inline Vec2 Add(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_AddV2CPP); - return HMM_AddV2(Left, Right); + ASSERT_COVERED(AddV2CPP); + return AddV2(Left, Right); } -COVERAGE(HMM_AddV3CPP, 1) -static inline HMM_Vec3 HMM_Add(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(AddV3CPP, 1) +static inline Vec3 Add(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_AddV3CPP); - return HMM_AddV3(Left, Right); + ASSERT_COVERED(AddV3CPP); + return AddV3(Left, Right); } -COVERAGE(HMM_AddV4CPP, 1) -static inline HMM_Vec4 HMM_Add(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(AddV4CPP, 1) +static inline Vec4 Add(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_AddV4CPP); - return HMM_AddV4(Left, Right); + ASSERT_COVERED(AddV4CPP); + return AddV4(Left, Right); } -COVERAGE(HMM_AddM2CPP, 1) -static inline HMM_Mat2 HMM_Add(HMM_Mat2 Left, HMM_Mat2 Right) +COVERAGE(AddM2CPP, 1) +static inline Mat2 Add(Mat2 Left, Mat2 Right) { - ASSERT_COVERED(HMM_AddM2CPP); - return HMM_AddM2(Left, Right); + ASSERT_COVERED(AddM2CPP); + return AddM2(Left, Right); } -COVERAGE(HMM_AddM3CPP, 1) -static inline HMM_Mat3 HMM_Add(HMM_Mat3 Left, HMM_Mat3 Right) +COVERAGE(AddM3CPP, 1) +static inline Mat3 Add(Mat3 Left, Mat3 Right) { - ASSERT_COVERED(HMM_AddM3CPP); - return HMM_AddM3(Left, Right); + ASSERT_COVERED(AddM3CPP); + return AddM3(Left, Right); } -COVERAGE(HMM_AddM4CPP, 1) -static inline HMM_Mat4 HMM_Add(HMM_Mat4 Left, HMM_Mat4 Right) +COVERAGE(AddM4CPP, 1) +static inline Mat4 Add(Mat4 Left, Mat4 Right) { - ASSERT_COVERED(HMM_AddM4CPP); - return HMM_AddM4(Left, Right); + ASSERT_COVERED(AddM4CPP); + return AddM4(Left, Right); } -COVERAGE(HMM_AddQCPP, 1) -static inline HMM_Quat HMM_Add(HMM_Quat Left, HMM_Quat Right) +COVERAGE(AddQCPP, 1) +static inline Quat Add(Quat Left, Quat Right) { - ASSERT_COVERED(HMM_AddQCPP); - return HMM_AddQ(Left, Right); + ASSERT_COVERED(AddQCPP); + return AddQ(Left, Right); } -COVERAGE(HMM_SubV2CPP, 1) -static inline HMM_Vec2 HMM_Sub(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(SubV2CPP, 1) +static inline Vec2 Sub(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_SubV2CPP); - return HMM_SubV2(Left, Right); + ASSERT_COVERED(SubV2CPP); + return SubV2(Left, Right); } -COVERAGE(HMM_SubV3CPP, 1) -static inline HMM_Vec3 HMM_Sub(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(SubV3CPP, 1) +static inline Vec3 Sub(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_SubV3CPP); - return HMM_SubV3(Left, Right); + ASSERT_COVERED(SubV3CPP); + return SubV3(Left, Right); } -COVERAGE(HMM_SubV4CPP, 1) -static inline HMM_Vec4 HMM_Sub(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(SubV4CPP, 1) +static inline Vec4 Sub(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_SubV4CPP); - return HMM_SubV4(Left, Right); + ASSERT_COVERED(SubV4CPP); + return SubV4(Left, Right); } -COVERAGE(HMM_SubM2CPP, 1) -static inline HMM_Mat2 HMM_Sub(HMM_Mat2 Left, HMM_Mat2 Right) +COVERAGE(SubM2CPP, 1) +static inline Mat2 Sub(Mat2 Left, Mat2 Right) { - ASSERT_COVERED(HMM_SubM2CPP); - return HMM_SubM2(Left, Right); + ASSERT_COVERED(SubM2CPP); + return SubM2(Left, Right); } -COVERAGE(HMM_SubM3CPP, 1) -static inline HMM_Mat3 HMM_Sub(HMM_Mat3 Left, HMM_Mat3 Right) +COVERAGE(SubM3CPP, 1) +static inline Mat3 Sub(Mat3 Left, Mat3 Right) { - ASSERT_COVERED(HMM_SubM3CPP); - return HMM_SubM3(Left, Right); + ASSERT_COVERED(SubM3CPP); + return SubM3(Left, Right); } -COVERAGE(HMM_SubM4CPP, 1) -static inline HMM_Mat4 HMM_Sub(HMM_Mat4 Left, HMM_Mat4 Right) +COVERAGE(SubM4CPP, 1) +static inline Mat4 Sub(Mat4 Left, Mat4 Right) { - ASSERT_COVERED(HMM_SubM4CPP); - return HMM_SubM4(Left, Right); + ASSERT_COVERED(SubM4CPP); + return SubM4(Left, Right); } -COVERAGE(HMM_SubQCPP, 1) -static inline HMM_Quat HMM_Sub(HMM_Quat Left, HMM_Quat Right) +COVERAGE(SubQCPP, 1) +static inline Quat Sub(Quat Left, Quat Right) { - ASSERT_COVERED(HMM_SubQCPP); - return HMM_SubQ(Left, Right); + ASSERT_COVERED(SubQCPP); + return SubQ(Left, Right); } -COVERAGE(HMM_MulV2CPP, 1) -static inline HMM_Vec2 HMM_Mul(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(MulV2CPP, 1) +static inline Vec2 Mul(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_MulV2CPP); - return HMM_MulV2(Left, Right); + ASSERT_COVERED(MulV2CPP); + return MulV2(Left, Right); } -COVERAGE(HMM_MulV2FCPP, 1) -static inline HMM_Vec2 HMM_Mul(HMM_Vec2 Left, float Right) +COVERAGE(MulV2FCPP, 1) +static inline Vec2 Mul(Vec2 Left, float Right) { - ASSERT_COVERED(HMM_MulV2FCPP); - return HMM_MulV2F(Left, Right); + ASSERT_COVERED(MulV2FCPP); + return MulV2F(Left, Right); } -COVERAGE(HMM_MulV3CPP, 1) -static inline HMM_Vec3 HMM_Mul(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(MulV3CPP, 1) +static inline Vec3 Mul(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_MulV3CPP); - return HMM_MulV3(Left, Right); + ASSERT_COVERED(MulV3CPP); + return MulV3(Left, Right); } -COVERAGE(HMM_MulV3FCPP, 1) -static inline HMM_Vec3 HMM_Mul(HMM_Vec3 Left, float Right) +COVERAGE(MulV3FCPP, 1) +static inline Vec3 Mul(Vec3 Left, float Right) { - ASSERT_COVERED(HMM_MulV3FCPP); - return HMM_MulV3F(Left, Right); + ASSERT_COVERED(MulV3FCPP); + return MulV3F(Left, Right); } -COVERAGE(HMM_MulV4CPP, 1) -static inline HMM_Vec4 HMM_Mul(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(MulV4CPP, 1) +static inline Vec4 Mul(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_MulV4CPP); - return HMM_MulV4(Left, Right); + ASSERT_COVERED(MulV4CPP); + return MulV4(Left, Right); } -COVERAGE(HMM_MulV4FCPP, 1) -static inline HMM_Vec4 HMM_Mul(HMM_Vec4 Left, float Right) +COVERAGE(MulV4FCPP, 1) +static inline Vec4 Mul(Vec4 Left, float Right) { - ASSERT_COVERED(HMM_MulV4FCPP); - return HMM_MulV4F(Left, Right); + ASSERT_COVERED(MulV4FCPP); + return MulV4F(Left, Right); } -COVERAGE(HMM_MulM2CPP, 1) -static inline HMM_Mat2 HMM_Mul(HMM_Mat2 Left, HMM_Mat2 Right) +COVERAGE(MulM2CPP, 1) +static inline Mat2 Mul(Mat2 Left, Mat2 Right) { - ASSERT_COVERED(HMM_MulM2CPP); - return HMM_MulM2(Left, Right); + ASSERT_COVERED(MulM2CPP); + return MulM2(Left, Right); } -COVERAGE(HMM_MulM3CPP, 1) -static inline HMM_Mat3 HMM_Mul(HMM_Mat3 Left, HMM_Mat3 Right) +COVERAGE(MulM3CPP, 1) +static inline Mat3 Mul(Mat3 Left, Mat3 Right) { - ASSERT_COVERED(HMM_MulM3CPP); - return HMM_MulM3(Left, Right); + ASSERT_COVERED(MulM3CPP); + return MulM3(Left, Right); } -COVERAGE(HMM_MulM4CPP, 1) -static inline HMM_Mat4 HMM_Mul(HMM_Mat4 Left, HMM_Mat4 Right) +COVERAGE(MulM4CPP, 1) +static inline Mat4 Mul(Mat4 Left, Mat4 Right) { - ASSERT_COVERED(HMM_MulM4CPP); - return HMM_MulM4(Left, Right); + ASSERT_COVERED(MulM4CPP); + return MulM4(Left, Right); } -COVERAGE(HMM_MulM2FCPP, 1) -static inline HMM_Mat2 HMM_Mul(HMM_Mat2 Left, float Right) +COVERAGE(MulM2FCPP, 1) +static inline Mat2 Mul(Mat2 Left, float Right) { - ASSERT_COVERED(HMM_MulM2FCPP); - return HMM_MulM2F(Left, Right); + ASSERT_COVERED(MulM2FCPP); + return MulM2F(Left, Right); } -COVERAGE(HMM_MulM3FCPP, 1) -static inline HMM_Mat3 HMM_Mul(HMM_Mat3 Left, float Right) +COVERAGE(MulM3FCPP, 1) +static inline Mat3 Mul(Mat3 Left, float Right) { - ASSERT_COVERED(HMM_MulM3FCPP); - return HMM_MulM3F(Left, Right); + ASSERT_COVERED(MulM3FCPP); + return MulM3F(Left, Right); } -COVERAGE(HMM_MulM4FCPP, 1) -static inline HMM_Mat4 HMM_Mul(HMM_Mat4 Left, float Right) +COVERAGE(MulM4FCPP, 1) +static inline Mat4 Mul(Mat4 Left, float Right) { - ASSERT_COVERED(HMM_MulM4FCPP); - return HMM_MulM4F(Left, Right); + ASSERT_COVERED(MulM4FCPP); + return MulM4F(Left, Right); } -COVERAGE(HMM_MulM2V2CPP, 1) -static inline HMM_Vec2 HMM_Mul(HMM_Mat2 Matrix, HMM_Vec2 Vector) +COVERAGE(MulM2V2CPP, 1) +static inline Vec2 Mul(Mat2 Matrix, Vec2 Vector) { - ASSERT_COVERED(HMM_MulM2V2CPP); - return HMM_MulM2V2(Matrix, Vector); + ASSERT_COVERED(MulM2V2CPP); + return MulM2V2(Matrix, Vector); } -COVERAGE(HMM_MulM3V3CPP, 1) -static inline HMM_Vec3 HMM_Mul(HMM_Mat3 Matrix, HMM_Vec3 Vector) +COVERAGE(MulM3V3CPP, 1) +static inline Vec3 Mul(Mat3 Matrix, Vec3 Vector) { - ASSERT_COVERED(HMM_MulM3V3CPP); - return HMM_MulM3V3(Matrix, Vector); + ASSERT_COVERED(MulM3V3CPP); + return MulM3V3(Matrix, Vector); } -COVERAGE(HMM_MulM4V4CPP, 1) -static inline HMM_Vec4 HMM_Mul(HMM_Mat4 Matrix, HMM_Vec4 Vector) +COVERAGE(MulM4V4CPP, 1) +static inline Vec4 Mul(Mat4 Matrix, Vec4 Vector) { - ASSERT_COVERED(HMM_MulM4V4CPP); - return HMM_MulM4V4(Matrix, Vector); + ASSERT_COVERED(MulM4V4CPP); + return MulM4V4(Matrix, Vector); } -COVERAGE(HMM_MulQCPP, 1) -static inline HMM_Quat HMM_Mul(HMM_Quat Left, HMM_Quat Right) +COVERAGE(MulQCPP, 1) +static inline Quat Mul(Quat Left, Quat Right) { - ASSERT_COVERED(HMM_MulQCPP); - return HMM_MulQ(Left, Right); + ASSERT_COVERED(MulQCPP); + return MulQ(Left, Right); } -COVERAGE(HMM_MulQFCPP, 1) -static inline HMM_Quat HMM_Mul(HMM_Quat Left, float Right) +COVERAGE(MulQFCPP, 1) +static inline Quat Mul(Quat Left, float Right) { - ASSERT_COVERED(HMM_MulQFCPP); - return HMM_MulQF(Left, Right); + ASSERT_COVERED(MulQFCPP); + return MulQF(Left, Right); } -COVERAGE(HMM_DivV2CPP, 1) -static inline HMM_Vec2 HMM_Div(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(DivV2CPP, 1) +static inline Vec2 Div(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_DivV2CPP); - return HMM_DivV2(Left, Right); + ASSERT_COVERED(DivV2CPP); + return DivV2(Left, Right); } -COVERAGE(HMM_DivV2FCPP, 1) -static inline HMM_Vec2 HMM_Div(HMM_Vec2 Left, float Right) +COVERAGE(DivV2FCPP, 1) +static inline Vec2 Div(Vec2 Left, float Right) { - ASSERT_COVERED(HMM_DivV2FCPP); - return HMM_DivV2F(Left, Right); + ASSERT_COVERED(DivV2FCPP); + return DivV2F(Left, Right); } -COVERAGE(HMM_DivV3CPP, 1) -static inline HMM_Vec3 HMM_Div(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(DivV3CPP, 1) +static inline Vec3 Div(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_DivV3CPP); - return HMM_DivV3(Left, Right); + ASSERT_COVERED(DivV3CPP); + return DivV3(Left, Right); } -COVERAGE(HMM_DivV3FCPP, 1) -static inline HMM_Vec3 HMM_Div(HMM_Vec3 Left, float Right) +COVERAGE(DivV3FCPP, 1) +static inline Vec3 Div(Vec3 Left, float Right) { - ASSERT_COVERED(HMM_DivV3FCPP); - return HMM_DivV3F(Left, Right); + ASSERT_COVERED(DivV3FCPP); + return DivV3F(Left, Right); } -COVERAGE(HMM_DivV4CPP, 1) -static inline HMM_Vec4 HMM_Div(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(DivV4CPP, 1) +static inline Vec4 Div(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_DivV4CPP); - return HMM_DivV4(Left, Right); + ASSERT_COVERED(DivV4CPP); + return DivV4(Left, Right); } -COVERAGE(HMM_DivV4FCPP, 1) -static inline HMM_Vec4 HMM_Div(HMM_Vec4 Left, float Right) +COVERAGE(DivV4FCPP, 1) +static inline Vec4 Div(Vec4 Left, float Right) { - ASSERT_COVERED(HMM_DivV4FCPP); - return HMM_DivV4F(Left, Right); + ASSERT_COVERED(DivV4FCPP); + return DivV4F(Left, Right); } -COVERAGE(HMM_DivM2FCPP, 1) -static inline HMM_Mat2 HMM_Div(HMM_Mat2 Left, float Right) +COVERAGE(DivM2FCPP, 1) +static inline Mat2 Div(Mat2 Left, float Right) { - ASSERT_COVERED(HMM_DivM2FCPP); - return HMM_DivM2F(Left, Right); + ASSERT_COVERED(DivM2FCPP); + return DivM2F(Left, Right); } -COVERAGE(HMM_DivM3FCPP, 1) -static inline HMM_Mat3 HMM_Div(HMM_Mat3 Left, float Right) +COVERAGE(DivM3FCPP, 1) +static inline Mat3 Div(Mat3 Left, float Right) { - ASSERT_COVERED(HMM_DivM3FCPP); - return HMM_DivM3F(Left, Right); + ASSERT_COVERED(DivM3FCPP); + return DivM3F(Left, Right); } -COVERAGE(HMM_DivM4FCPP, 1) -static inline HMM_Mat4 HMM_Div(HMM_Mat4 Left, float Right) +COVERAGE(DivM4FCPP, 1) +static inline Mat4 Div(Mat4 Left, float Right) { - ASSERT_COVERED(HMM_DivM4FCPP); - return HMM_DivM4F(Left, Right); + ASSERT_COVERED(DivM4FCPP); + return DivM4F(Left, Right); } -COVERAGE(HMM_DivQFCPP, 1) -static inline HMM_Quat HMM_Div(HMM_Quat Left, float Right) +COVERAGE(DivQFCPP, 1) +static inline Quat Div(Quat Left, float Right) { - ASSERT_COVERED(HMM_DivQFCPP); - return HMM_DivQF(Left, Right); + ASSERT_COVERED(DivQFCPP); + return DivQF(Left, Right); } -COVERAGE(HMM_EqV2CPP, 1) -static inline HMM_Bool HMM_Eq(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(EqV2CPP, 1) +static inline Bool Eq(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_EqV2CPP); - return HMM_EqV2(Left, Right); + ASSERT_COVERED(EqV2CPP); + return EqV2(Left, Right); } -COVERAGE(HMM_EqV3CPP, 1) -static inline HMM_Bool HMM_Eq(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(EqV3CPP, 1) +static inline Bool Eq(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_EqV3CPP); - return HMM_EqV3(Left, Right); + ASSERT_COVERED(EqV3CPP); + return EqV3(Left, Right); } -COVERAGE(HMM_EqV4CPP, 1) -static inline HMM_Bool HMM_Eq(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(EqV4CPP, 1) +static inline Bool Eq(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_EqV4CPP); - return HMM_EqV4(Left, Right); + ASSERT_COVERED(EqV4CPP); + return EqV4(Left, Right); } -COVERAGE(HMM_AddV2Op, 1) -static inline HMM_Vec2 operator+(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(AddV2Op, 1) +static inline Vec2 operator+(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_AddV2Op); - return HMM_AddV2(Left, Right); + ASSERT_COVERED(AddV2Op); + return AddV2(Left, Right); } -COVERAGE(HMM_AddV3Op, 1) -static inline HMM_Vec3 operator+(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(AddV3Op, 1) +static inline Vec3 operator+(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_AddV3Op); - return HMM_AddV3(Left, Right); + ASSERT_COVERED(AddV3Op); + return AddV3(Left, Right); } -COVERAGE(HMM_AddV4Op, 1) -static inline HMM_Vec4 operator+(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(AddV4Op, 1) +static inline Vec4 operator+(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_AddV4Op); - return HMM_AddV4(Left, Right); + ASSERT_COVERED(AddV4Op); + return AddV4(Left, Right); } -COVERAGE(HMM_AddM2Op, 1) -static inline HMM_Mat2 operator+(HMM_Mat2 Left, HMM_Mat2 Right) +COVERAGE(AddM2Op, 1) +static inline Mat2 operator+(Mat2 Left, Mat2 Right) { - ASSERT_COVERED(HMM_AddM2Op); - return HMM_AddM2(Left, Right); + ASSERT_COVERED(AddM2Op); + return AddM2(Left, Right); } -COVERAGE(HMM_AddM3Op, 1) -static inline HMM_Mat3 operator+(HMM_Mat3 Left, HMM_Mat3 Right) +COVERAGE(AddM3Op, 1) +static inline Mat3 operator+(Mat3 Left, Mat3 Right) { - ASSERT_COVERED(HMM_AddM3Op); - return HMM_AddM3(Left, Right); + ASSERT_COVERED(AddM3Op); + return AddM3(Left, Right); } -COVERAGE(HMM_AddM4Op, 1) -static inline HMM_Mat4 operator+(HMM_Mat4 Left, HMM_Mat4 Right) +COVERAGE(AddM4Op, 1) +static inline Mat4 operator+(Mat4 Left, Mat4 Right) { - ASSERT_COVERED(HMM_AddM4Op); - return HMM_AddM4(Left, Right); + ASSERT_COVERED(AddM4Op); + return AddM4(Left, Right); } -COVERAGE(HMM_AddQOp, 1) -static inline HMM_Quat operator+(HMM_Quat Left, HMM_Quat Right) +COVERAGE(AddQOp, 1) +static inline Quat operator+(Quat Left, Quat Right) { - ASSERT_COVERED(HMM_AddQOp); - return HMM_AddQ(Left, Right); + ASSERT_COVERED(AddQOp); + return AddQ(Left, Right); } -COVERAGE(HMM_SubV2Op, 1) -static inline HMM_Vec2 operator-(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(SubV2Op, 1) +static inline Vec2 operator-(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_SubV2Op); - return HMM_SubV2(Left, Right); + ASSERT_COVERED(SubV2Op); + return SubV2(Left, Right); } -COVERAGE(HMM_SubV3Op, 1) -static inline HMM_Vec3 operator-(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(SubV3Op, 1) +static inline Vec3 operator-(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_SubV3Op); - return HMM_SubV3(Left, Right); + ASSERT_COVERED(SubV3Op); + return SubV3(Left, Right); } -COVERAGE(HMM_SubV4Op, 1) -static inline HMM_Vec4 operator-(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(SubV4Op, 1) +static inline Vec4 operator-(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_SubV4Op); - return HMM_SubV4(Left, Right); + ASSERT_COVERED(SubV4Op); + return SubV4(Left, Right); } -COVERAGE(HMM_SubM2Op, 1) -static inline HMM_Mat2 operator-(HMM_Mat2 Left, HMM_Mat2 Right) +COVERAGE(SubM2Op, 1) +static inline Mat2 operator-(Mat2 Left, Mat2 Right) { - ASSERT_COVERED(HMM_SubM2Op); - return HMM_SubM2(Left, Right); + ASSERT_COVERED(SubM2Op); + return SubM2(Left, Right); } -COVERAGE(HMM_SubM3Op, 1) -static inline HMM_Mat3 operator-(HMM_Mat3 Left, HMM_Mat3 Right) +COVERAGE(SubM3Op, 1) +static inline Mat3 operator-(Mat3 Left, Mat3 Right) { - ASSERT_COVERED(HMM_SubM3Op); - return HMM_SubM3(Left, Right); + ASSERT_COVERED(SubM3Op); + return SubM3(Left, Right); } -COVERAGE(HMM_SubM4Op, 1) -static inline HMM_Mat4 operator-(HMM_Mat4 Left, HMM_Mat4 Right) +COVERAGE(SubM4Op, 1) +static inline Mat4 operator-(Mat4 Left, Mat4 Right) { - ASSERT_COVERED(HMM_SubM4Op); - return HMM_SubM4(Left, Right); + ASSERT_COVERED(SubM4Op); + return SubM4(Left, Right); } -COVERAGE(HMM_SubQOp, 1) -static inline HMM_Quat operator-(HMM_Quat Left, HMM_Quat Right) +COVERAGE(SubQOp, 1) +static inline Quat operator-(Quat Left, Quat Right) { - ASSERT_COVERED(HMM_SubQOp); - return HMM_SubQ(Left, Right); + ASSERT_COVERED(SubQOp); + return SubQ(Left, Right); } -COVERAGE(HMM_MulV2Op, 1) -static inline HMM_Vec2 operator*(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(MulV2Op, 1) +static inline Vec2 operator*(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_MulV2Op); - return HMM_MulV2(Left, Right); + ASSERT_COVERED(MulV2Op); + return MulV2(Left, Right); } -COVERAGE(HMM_MulV3Op, 1) -static inline HMM_Vec3 operator*(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(MulV3Op, 1) +static inline Vec3 operator*(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_MulV3Op); - return HMM_MulV3(Left, Right); + ASSERT_COVERED(MulV3Op); + return MulV3(Left, Right); } -COVERAGE(HMM_MulV4Op, 1) -static inline HMM_Vec4 operator*(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(MulV4Op, 1) +static inline Vec4 operator*(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_MulV4Op); - return HMM_MulV4(Left, Right); + ASSERT_COVERED(MulV4Op); + return MulV4(Left, Right); } -COVERAGE(HMM_MulM2Op, 1) -static inline HMM_Mat2 operator*(HMM_Mat2 Left, HMM_Mat2 Right) +COVERAGE(MulM2Op, 1) +static inline Mat2 operator*(Mat2 Left, Mat2 Right) { - ASSERT_COVERED(HMM_MulM2Op); - return HMM_MulM2(Left, Right); + ASSERT_COVERED(MulM2Op); + return MulM2(Left, Right); } -COVERAGE(HMM_MulM3Op, 1) -static inline HMM_Mat3 operator*(HMM_Mat3 Left, HMM_Mat3 Right) +COVERAGE(MulM3Op, 1) +static inline Mat3 operator*(Mat3 Left, Mat3 Right) { - ASSERT_COVERED(HMM_MulM3Op); - return HMM_MulM3(Left, Right); + ASSERT_COVERED(MulM3Op); + return MulM3(Left, Right); } -COVERAGE(HMM_MulM4Op, 1) -static inline HMM_Mat4 operator*(HMM_Mat4 Left, HMM_Mat4 Right) +COVERAGE(MulM4Op, 1) +static inline Mat4 operator*(Mat4 Left, Mat4 Right) { - ASSERT_COVERED(HMM_MulM4Op); - return HMM_MulM4(Left, Right); + ASSERT_COVERED(MulM4Op); + return MulM4(Left, Right); } -COVERAGE(HMM_MulQOp, 1) -static inline HMM_Quat operator*(HMM_Quat Left, HMM_Quat Right) +COVERAGE(MulQOp, 1) +static inline Quat operator*(Quat Left, Quat Right) { - ASSERT_COVERED(HMM_MulQOp); - return HMM_MulQ(Left, Right); + ASSERT_COVERED(MulQOp); + return MulQ(Left, Right); } -COVERAGE(HMM_MulV2FOp, 1) -static inline HMM_Vec2 operator*(HMM_Vec2 Left, float Right) +COVERAGE(MulV2FOp, 1) +static inline Vec2 operator*(Vec2 Left, float Right) { - ASSERT_COVERED(HMM_MulV2FOp); - return HMM_MulV2F(Left, Right); + ASSERT_COVERED(MulV2FOp); + return MulV2F(Left, Right); } -COVERAGE(HMM_MulV3FOp, 1) -static inline HMM_Vec3 operator*(HMM_Vec3 Left, float Right) +COVERAGE(MulV3FOp, 1) +static inline Vec3 operator*(Vec3 Left, float Right) { - ASSERT_COVERED(HMM_MulV3FOp); - return HMM_MulV3F(Left, Right); + ASSERT_COVERED(MulV3FOp); + return MulV3F(Left, Right); } -COVERAGE(HMM_MulV4FOp, 1) -static inline HMM_Vec4 operator*(HMM_Vec4 Left, float Right) +COVERAGE(MulV4FOp, 1) +static inline Vec4 operator*(Vec4 Left, float Right) { - ASSERT_COVERED(HMM_MulV4FOp); - return HMM_MulV4F(Left, Right); + ASSERT_COVERED(MulV4FOp); + return MulV4F(Left, Right); } -COVERAGE(HMM_MulM2FOp, 1) -static inline HMM_Mat2 operator*(HMM_Mat2 Left, float Right) +COVERAGE(MulM2FOp, 1) +static inline Mat2 operator*(Mat2 Left, float Right) { - ASSERT_COVERED(HMM_MulM2FOp); - return HMM_MulM2F(Left, Right); + ASSERT_COVERED(MulM2FOp); + return MulM2F(Left, Right); } -COVERAGE(HMM_MulM3FOp, 1) -static inline HMM_Mat3 operator*(HMM_Mat3 Left, float Right) +COVERAGE(MulM3FOp, 1) +static inline Mat3 operator*(Mat3 Left, float Right) { - ASSERT_COVERED(HMM_MulM3FOp); - return HMM_MulM3F(Left, Right); + ASSERT_COVERED(MulM3FOp); + return MulM3F(Left, Right); } -COVERAGE(HMM_MulM4FOp, 1) -static inline HMM_Mat4 operator*(HMM_Mat4 Left, float Right) +COVERAGE(MulM4FOp, 1) +static inline Mat4 operator*(Mat4 Left, float Right) { - ASSERT_COVERED(HMM_MulM4FOp); - return HMM_MulM4F(Left, Right); + ASSERT_COVERED(MulM4FOp); + return MulM4F(Left, Right); } -COVERAGE(HMM_MulQFOp, 1) -static inline HMM_Quat operator*(HMM_Quat Left, float Right) +COVERAGE(MulQFOp, 1) +static inline Quat operator*(Quat Left, float Right) { - ASSERT_COVERED(HMM_MulQFOp); - return HMM_MulQF(Left, Right); + ASSERT_COVERED(MulQFOp); + return MulQF(Left, Right); } -COVERAGE(HMM_MulV2FOpLeft, 1) -static inline HMM_Vec2 operator*(float Left, HMM_Vec2 Right) +COVERAGE(MulV2FOpLeft, 1) +static inline Vec2 operator*(float Left, Vec2 Right) { - ASSERT_COVERED(HMM_MulV2FOpLeft); - return HMM_MulV2F(Right, Left); + ASSERT_COVERED(MulV2FOpLeft); + return MulV2F(Right, Left); } -COVERAGE(HMM_MulV3FOpLeft, 1) -static inline HMM_Vec3 operator*(float Left, HMM_Vec3 Right) +COVERAGE(MulV3FOpLeft, 1) +static inline Vec3 operator*(float Left, Vec3 Right) { - ASSERT_COVERED(HMM_MulV3FOpLeft); - return HMM_MulV3F(Right, Left); + ASSERT_COVERED(MulV3FOpLeft); + return MulV3F(Right, Left); } -COVERAGE(HMM_MulV4FOpLeft, 1) -static inline HMM_Vec4 operator*(float Left, HMM_Vec4 Right) +COVERAGE(MulV4FOpLeft, 1) +static inline Vec4 operator*(float Left, Vec4 Right) { - ASSERT_COVERED(HMM_MulV4FOpLeft); - return HMM_MulV4F(Right, Left); + ASSERT_COVERED(MulV4FOpLeft); + return MulV4F(Right, Left); } -COVERAGE(HMM_MulM2FOpLeft, 1) -static inline HMM_Mat2 operator*(float Left, HMM_Mat2 Right) +COVERAGE(MulM2FOpLeft, 1) +static inline Mat2 operator*(float Left, Mat2 Right) { - ASSERT_COVERED(HMM_MulM2FOpLeft); - return HMM_MulM2F(Right, Left); + ASSERT_COVERED(MulM2FOpLeft); + return MulM2F(Right, Left); } -COVERAGE(HMM_MulM3FOpLeft, 1) -static inline HMM_Mat3 operator*(float Left, HMM_Mat3 Right) +COVERAGE(MulM3FOpLeft, 1) +static inline Mat3 operator*(float Left, Mat3 Right) { - ASSERT_COVERED(HMM_MulM3FOpLeft); - return HMM_MulM3F(Right, Left); + ASSERT_COVERED(MulM3FOpLeft); + return MulM3F(Right, Left); } -COVERAGE(HMM_MulM4FOpLeft, 1) -static inline HMM_Mat4 operator*(float Left, HMM_Mat4 Right) +COVERAGE(MulM4FOpLeft, 1) +static inline Mat4 operator*(float Left, Mat4 Right) { - ASSERT_COVERED(HMM_MulM4FOpLeft); - return HMM_MulM4F(Right, Left); + ASSERT_COVERED(MulM4FOpLeft); + return MulM4F(Right, Left); } -COVERAGE(HMM_MulQFOpLeft, 1) -static inline HMM_Quat operator*(float Left, HMM_Quat Right) +COVERAGE(MulQFOpLeft, 1) +static inline Quat operator*(float Left, Quat Right) { - ASSERT_COVERED(HMM_MulQFOpLeft); - return HMM_MulQF(Right, Left); + ASSERT_COVERED(MulQFOpLeft); + return MulQF(Right, Left); } -COVERAGE(HMM_MulM2V2Op, 1) -static inline HMM_Vec2 operator*(HMM_Mat2 Matrix, HMM_Vec2 Vector) +COVERAGE(MulM2V2Op, 1) +static inline Vec2 operator*(Mat2 Matrix, Vec2 Vector) { - ASSERT_COVERED(HMM_MulM2V2Op); - return HMM_MulM2V2(Matrix, Vector); + ASSERT_COVERED(MulM2V2Op); + return MulM2V2(Matrix, Vector); } -COVERAGE(HMM_MulM3V3Op, 1) -static inline HMM_Vec3 operator*(HMM_Mat3 Matrix, HMM_Vec3 Vector) +COVERAGE(MulM3V3Op, 1) +static inline Vec3 operator*(Mat3 Matrix, Vec3 Vector) { - ASSERT_COVERED(HMM_MulM3V3Op); - return HMM_MulM3V3(Matrix, Vector); + ASSERT_COVERED(MulM3V3Op); + return MulM3V3(Matrix, Vector); } -COVERAGE(HMM_MulM4V4Op, 1) -static inline HMM_Vec4 operator*(HMM_Mat4 Matrix, HMM_Vec4 Vector) +COVERAGE(MulM4V4Op, 1) +static inline Vec4 operator*(Mat4 Matrix, Vec4 Vector) { - ASSERT_COVERED(HMM_MulM4V4Op); - return HMM_MulM4V4(Matrix, Vector); + ASSERT_COVERED(MulM4V4Op); + return MulM4V4(Matrix, Vector); } -COVERAGE(HMM_DivV2Op, 1) -static inline HMM_Vec2 operator/(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(DivV2Op, 1) +static inline Vec2 operator/(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_DivV2Op); - return HMM_DivV2(Left, Right); + ASSERT_COVERED(DivV2Op); + return DivV2(Left, Right); } -COVERAGE(HMM_DivV3Op, 1) -static inline HMM_Vec3 operator/(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(DivV3Op, 1) +static inline Vec3 operator/(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_DivV3Op); - return HMM_DivV3(Left, Right); + ASSERT_COVERED(DivV3Op); + return DivV3(Left, Right); } -COVERAGE(HMM_DivV4Op, 1) -static inline HMM_Vec4 operator/(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(DivV4Op, 1) +static inline Vec4 operator/(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_DivV4Op); - return HMM_DivV4(Left, Right); + ASSERT_COVERED(DivV4Op); + return DivV4(Left, Right); } -COVERAGE(HMM_DivV2FOp, 1) -static inline HMM_Vec2 operator/(HMM_Vec2 Left, float Right) +COVERAGE(DivV2FOp, 1) +static inline Vec2 operator/(Vec2 Left, float Right) { - ASSERT_COVERED(HMM_DivV2FOp); - return HMM_DivV2F(Left, Right); + ASSERT_COVERED(DivV2FOp); + return DivV2F(Left, Right); } -COVERAGE(HMM_DivV3FOp, 1) -static inline HMM_Vec3 operator/(HMM_Vec3 Left, float Right) +COVERAGE(DivV3FOp, 1) +static inline Vec3 operator/(Vec3 Left, float Right) { - ASSERT_COVERED(HMM_DivV3FOp); - return HMM_DivV3F(Left, Right); + ASSERT_COVERED(DivV3FOp); + return DivV3F(Left, Right); } -COVERAGE(HMM_DivV4FOp, 1) -static inline HMM_Vec4 operator/(HMM_Vec4 Left, float Right) +COVERAGE(DivV4FOp, 1) +static inline Vec4 operator/(Vec4 Left, float Right) { - ASSERT_COVERED(HMM_DivV4FOp); - return HMM_DivV4F(Left, Right); + ASSERT_COVERED(DivV4FOp); + return DivV4F(Left, Right); } -COVERAGE(HMM_DivM4FOp, 1) -static inline HMM_Mat4 operator/(HMM_Mat4 Left, float Right) +COVERAGE(DivM4FOp, 1) +static inline Mat4 operator/(Mat4 Left, float Right) { - ASSERT_COVERED(HMM_DivM4FOp); - return HMM_DivM4F(Left, Right); + ASSERT_COVERED(DivM4FOp); + return DivM4F(Left, Right); } -COVERAGE(HMM_DivM3FOp, 1) -static inline HMM_Mat3 operator/(HMM_Mat3 Left, float Right) +COVERAGE(DivM3FOp, 1) +static inline Mat3 operator/(Mat3 Left, float Right) { - ASSERT_COVERED(HMM_DivM3FOp); - return HMM_DivM3F(Left, Right); + ASSERT_COVERED(DivM3FOp); + return DivM3F(Left, Right); } -COVERAGE(HMM_DivM2FOp, 1) -static inline HMM_Mat2 operator/(HMM_Mat2 Left, float Right) +COVERAGE(DivM2FOp, 1) +static inline Mat2 operator/(Mat2 Left, float Right) { - ASSERT_COVERED(HMM_DivM2FOp); - return HMM_DivM2F(Left, Right); + ASSERT_COVERED(DivM2FOp); + return DivM2F(Left, Right); } -COVERAGE(HMM_DivQFOp, 1) -static inline HMM_Quat operator/(HMM_Quat Left, float Right) +COVERAGE(DivQFOp, 1) +static inline Quat operator/(Quat Left, float Right) { - ASSERT_COVERED(HMM_DivQFOp); - return HMM_DivQF(Left, Right); + ASSERT_COVERED(DivQFOp); + return DivQF(Left, Right); } -COVERAGE(HMM_AddV2Assign, 1) -static inline HMM_Vec2 &operator+=(HMM_Vec2 &Left, HMM_Vec2 Right) +COVERAGE(AddV2Assign, 1) +static inline Vec2 &operator+=(Vec2 &Left, Vec2 Right) { - ASSERT_COVERED(HMM_AddV2Assign); + ASSERT_COVERED(AddV2Assign); return Left = Left + Right; } -COVERAGE(HMM_AddV3Assign, 1) -static inline HMM_Vec3 &operator+=(HMM_Vec3 &Left, HMM_Vec3 Right) +COVERAGE(AddV3Assign, 1) +static inline Vec3 &operator+=(Vec3 &Left, Vec3 Right) { - ASSERT_COVERED(HMM_AddV3Assign); + ASSERT_COVERED(AddV3Assign); return Left = Left + Right; } -COVERAGE(HMM_AddV4Assign, 1) -static inline HMM_Vec4 &operator+=(HMM_Vec4 &Left, HMM_Vec4 Right) +COVERAGE(AddV4Assign, 1) +static inline Vec4 &operator+=(Vec4 &Left, Vec4 Right) { - ASSERT_COVERED(HMM_AddV4Assign); + ASSERT_COVERED(AddV4Assign); return Left = Left + Right; } -COVERAGE(HMM_AddM2Assign, 1) -static inline HMM_Mat2 &operator+=(HMM_Mat2 &Left, HMM_Mat2 Right) +COVERAGE(AddM2Assign, 1) +static inline Mat2 &operator+=(Mat2 &Left, Mat2 Right) { - ASSERT_COVERED(HMM_AddM2Assign); + ASSERT_COVERED(AddM2Assign); return Left = Left + Right; } -COVERAGE(HMM_AddM3Assign, 1) -static inline HMM_Mat3 &operator+=(HMM_Mat3 &Left, HMM_Mat3 Right) +COVERAGE(AddM3Assign, 1) +static inline Mat3 &operator+=(Mat3 &Left, Mat3 Right) { - ASSERT_COVERED(HMM_AddM3Assign); + ASSERT_COVERED(AddM3Assign); return Left = Left + Right; } -COVERAGE(HMM_AddM4Assign, 1) -static inline HMM_Mat4 &operator+=(HMM_Mat4 &Left, HMM_Mat4 Right) +COVERAGE(AddM4Assign, 1) +static inline Mat4 &operator+=(Mat4 &Left, Mat4 Right) { - ASSERT_COVERED(HMM_AddM4Assign); + ASSERT_COVERED(AddM4Assign); return Left = Left + Right; } -COVERAGE(HMM_AddQAssign, 1) -static inline HMM_Quat &operator+=(HMM_Quat &Left, HMM_Quat Right) +COVERAGE(AddQAssign, 1) +static inline Quat &operator+=(Quat &Left, Quat Right) { - ASSERT_COVERED(HMM_AddQAssign); + ASSERT_COVERED(AddQAssign); return Left = Left + Right; } -COVERAGE(HMM_SubV2Assign, 1) -static inline HMM_Vec2 &operator-=(HMM_Vec2 &Left, HMM_Vec2 Right) +COVERAGE(SubV2Assign, 1) +static inline Vec2 &operator-=(Vec2 &Left, Vec2 Right) { - ASSERT_COVERED(HMM_SubV2Assign); + ASSERT_COVERED(SubV2Assign); return Left = Left - Right; } -COVERAGE(HMM_SubV3Assign, 1) -static inline HMM_Vec3 &operator-=(HMM_Vec3 &Left, HMM_Vec3 Right) +COVERAGE(SubV3Assign, 1) +static inline Vec3 &operator-=(Vec3 &Left, Vec3 Right) { - ASSERT_COVERED(HMM_SubV3Assign); + ASSERT_COVERED(SubV3Assign); return Left = Left - Right; } -COVERAGE(HMM_SubV4Assign, 1) -static inline HMM_Vec4 &operator-=(HMM_Vec4 &Left, HMM_Vec4 Right) +COVERAGE(SubV4Assign, 1) +static inline Vec4 &operator-=(Vec4 &Left, Vec4 Right) { - ASSERT_COVERED(HMM_SubV4Assign); + ASSERT_COVERED(SubV4Assign); return Left = Left - Right; } -COVERAGE(HMM_SubM2Assign, 1) -static inline HMM_Mat2 &operator-=(HMM_Mat2 &Left, HMM_Mat2 Right) +COVERAGE(SubM2Assign, 1) +static inline Mat2 &operator-=(Mat2 &Left, Mat2 Right) { - ASSERT_COVERED(HMM_SubM2Assign); + ASSERT_COVERED(SubM2Assign); return Left = Left - Right; } -COVERAGE(HMM_SubM3Assign, 1) -static inline HMM_Mat3 &operator-=(HMM_Mat3 &Left, HMM_Mat3 Right) +COVERAGE(SubM3Assign, 1) +static inline Mat3 &operator-=(Mat3 &Left, Mat3 Right) { - ASSERT_COVERED(HMM_SubM3Assign); + ASSERT_COVERED(SubM3Assign); return Left = Left - Right; } -COVERAGE(HMM_SubM4Assign, 1) -static inline HMM_Mat4 &operator-=(HMM_Mat4 &Left, HMM_Mat4 Right) +COVERAGE(SubM4Assign, 1) +static inline Mat4 &operator-=(Mat4 &Left, Mat4 Right) { - ASSERT_COVERED(HMM_SubM4Assign); + ASSERT_COVERED(SubM4Assign); return Left = Left - Right; } -COVERAGE(HMM_SubQAssign, 1) -static inline HMM_Quat &operator-=(HMM_Quat &Left, HMM_Quat Right) +COVERAGE(SubQAssign, 1) +static inline Quat &operator-=(Quat &Left, Quat Right) { - ASSERT_COVERED(HMM_SubQAssign); + ASSERT_COVERED(SubQAssign); return Left = Left - Right; } -COVERAGE(HMM_MulV2Assign, 1) -static inline HMM_Vec2 &operator*=(HMM_Vec2 &Left, HMM_Vec2 Right) +COVERAGE(MulV2Assign, 1) +static inline Vec2 &operator*=(Vec2 &Left, Vec2 Right) { - ASSERT_COVERED(HMM_MulV2Assign); + ASSERT_COVERED(MulV2Assign); return Left = Left * Right; } -COVERAGE(HMM_MulV3Assign, 1) -static inline HMM_Vec3 &operator*=(HMM_Vec3 &Left, HMM_Vec3 Right) +COVERAGE(MulV3Assign, 1) +static inline Vec3 &operator*=(Vec3 &Left, Vec3 Right) { - ASSERT_COVERED(HMM_MulV3Assign); + ASSERT_COVERED(MulV3Assign); return Left = Left * Right; } -COVERAGE(HMM_MulV4Assign, 1) -static inline HMM_Vec4 &operator*=(HMM_Vec4 &Left, HMM_Vec4 Right) +COVERAGE(MulV4Assign, 1) +static inline Vec4 &operator*=(Vec4 &Left, Vec4 Right) { - ASSERT_COVERED(HMM_MulV4Assign); + ASSERT_COVERED(MulV4Assign); return Left = Left * Right; } -COVERAGE(HMM_MulV2FAssign, 1) -static inline HMM_Vec2 &operator*=(HMM_Vec2 &Left, float Right) +COVERAGE(MulV2FAssign, 1) +static inline Vec2 &operator*=(Vec2 &Left, float Right) { - ASSERT_COVERED(HMM_MulV2FAssign); + ASSERT_COVERED(MulV2FAssign); return Left = Left * Right; } -COVERAGE(HMM_MulV3FAssign, 1) -static inline HMM_Vec3 &operator*=(HMM_Vec3 &Left, float Right) +COVERAGE(MulV3FAssign, 1) +static inline Vec3 &operator*=(Vec3 &Left, float Right) { - ASSERT_COVERED(HMM_MulV3FAssign); + ASSERT_COVERED(MulV3FAssign); return Left = Left * Right; } -COVERAGE(HMM_MulV4FAssign, 1) -static inline HMM_Vec4 &operator*=(HMM_Vec4 &Left, float Right) +COVERAGE(MulV4FAssign, 1) +static inline Vec4 &operator*=(Vec4 &Left, float Right) { - ASSERT_COVERED(HMM_MulV4FAssign); + ASSERT_COVERED(MulV4FAssign); return Left = Left * Right; } -COVERAGE(HMM_MulM2FAssign, 1) -static inline HMM_Mat2 &operator*=(HMM_Mat2 &Left, float Right) +COVERAGE(MulM2FAssign, 1) +static inline Mat2 &operator*=(Mat2 &Left, float Right) { - ASSERT_COVERED(HMM_MulM2FAssign); + ASSERT_COVERED(MulM2FAssign); return Left = Left * Right; } -COVERAGE(HMM_MulM3FAssign, 1) -static inline HMM_Mat3 &operator*=(HMM_Mat3 &Left, float Right) +COVERAGE(MulM3FAssign, 1) +static inline Mat3 &operator*=(Mat3 &Left, float Right) { - ASSERT_COVERED(HMM_MulM3FAssign); + ASSERT_COVERED(MulM3FAssign); return Left = Left * Right; } -COVERAGE(HMM_MulM4FAssign, 1) -static inline HMM_Mat4 &operator*=(HMM_Mat4 &Left, float Right) +COVERAGE(MulM4FAssign, 1) +static inline Mat4 &operator*=(Mat4 &Left, float Right) { - ASSERT_COVERED(HMM_MulM4FAssign); + ASSERT_COVERED(MulM4FAssign); return Left = Left * Right; } -COVERAGE(HMM_MulQFAssign, 1) -static inline HMM_Quat &operator*=(HMM_Quat &Left, float Right) +COVERAGE(MulQFAssign, 1) +static inline Quat &operator*=(Quat &Left, float Right) { - ASSERT_COVERED(HMM_MulQFAssign); + ASSERT_COVERED(MulQFAssign); return Left = Left * Right; } -COVERAGE(HMM_DivV2Assign, 1) -static inline HMM_Vec2 &operator/=(HMM_Vec2 &Left, HMM_Vec2 Right) +COVERAGE(DivV2Assign, 1) +static inline Vec2 &operator/=(Vec2 &Left, Vec2 Right) { - ASSERT_COVERED(HMM_DivV2Assign); + ASSERT_COVERED(DivV2Assign); return Left = Left / Right; } -COVERAGE(HMM_DivV3Assign, 1) -static inline HMM_Vec3 &operator/=(HMM_Vec3 &Left, HMM_Vec3 Right) +COVERAGE(DivV3Assign, 1) +static inline Vec3 &operator/=(Vec3 &Left, Vec3 Right) { - ASSERT_COVERED(HMM_DivV3Assign); + ASSERT_COVERED(DivV3Assign); return Left = Left / Right; } -COVERAGE(HMM_DivV4Assign, 1) -static inline HMM_Vec4 &operator/=(HMM_Vec4 &Left, HMM_Vec4 Right) +COVERAGE(DivV4Assign, 1) +static inline Vec4 &operator/=(Vec4 &Left, Vec4 Right) { - ASSERT_COVERED(HMM_DivV4Assign); + ASSERT_COVERED(DivV4Assign); return Left = Left / Right; } -COVERAGE(HMM_DivV2FAssign, 1) -static inline HMM_Vec2 &operator/=(HMM_Vec2 &Left, float Right) +COVERAGE(DivV2FAssign, 1) +static inline Vec2 &operator/=(Vec2 &Left, float Right) { - ASSERT_COVERED(HMM_DivV2FAssign); + ASSERT_COVERED(DivV2FAssign); return Left = Left / Right; } -COVERAGE(HMM_DivV3FAssign, 1) -static inline HMM_Vec3 &operator/=(HMM_Vec3 &Left, float Right) +COVERAGE(DivV3FAssign, 1) +static inline Vec3 &operator/=(Vec3 &Left, float Right) { - ASSERT_COVERED(HMM_DivV3FAssign); + ASSERT_COVERED(DivV3FAssign); return Left = Left / Right; } -COVERAGE(HMM_DivV4FAssign, 1) -static inline HMM_Vec4 &operator/=(HMM_Vec4 &Left, float Right) +COVERAGE(DivV4FAssign, 1) +static inline Vec4 &operator/=(Vec4 &Left, float Right) { - ASSERT_COVERED(HMM_DivV4FAssign); + ASSERT_COVERED(DivV4FAssign); return Left = Left / Right; } -COVERAGE(HMM_DivM4FAssign, 1) -static inline HMM_Mat4 &operator/=(HMM_Mat4 &Left, float Right) +COVERAGE(DivM4FAssign, 1) +static inline Mat4 &operator/=(Mat4 &Left, float Right) { - ASSERT_COVERED(HMM_DivM4FAssign); + ASSERT_COVERED(DivM4FAssign); return Left = Left / Right; } -COVERAGE(HMM_DivQFAssign, 1) -static inline HMM_Quat &operator/=(HMM_Quat &Left, float Right) +COVERAGE(DivQFAssign, 1) +static inline Quat &operator/=(Quat &Left, float Right) { - ASSERT_COVERED(HMM_DivQFAssign); + ASSERT_COVERED(DivQFAssign); return Left = Left / Right; } -COVERAGE(HMM_EqV2Op, 1) -static inline HMM_Bool operator==(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(EqV2Op, 1) +static inline Bool operator==(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_EqV2Op); - return HMM_EqV2(Left, Right); + ASSERT_COVERED(EqV2Op); + return EqV2(Left, Right); } -COVERAGE(HMM_EqV3Op, 1) -static inline HMM_Bool operator==(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(EqV3Op, 1) +static inline Bool operator==(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_EqV3Op); - return HMM_EqV3(Left, Right); + ASSERT_COVERED(EqV3Op); + return EqV3(Left, Right); } -COVERAGE(HMM_EqV4Op, 1) -static inline HMM_Bool operator==(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(EqV4Op, 1) +static inline Bool operator==(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_EqV4Op); - return HMM_EqV4(Left, Right); + ASSERT_COVERED(EqV4Op); + return EqV4(Left, Right); } -COVERAGE(HMM_EqV2OpNot, 1) -static inline HMM_Bool operator!=(HMM_Vec2 Left, HMM_Vec2 Right) +COVERAGE(EqV2OpNot, 1) +static inline Bool operator!=(Vec2 Left, Vec2 Right) { - ASSERT_COVERED(HMM_EqV2OpNot); - return !HMM_EqV2(Left, Right); + ASSERT_COVERED(EqV2OpNot); + return !EqV2(Left, Right); } -COVERAGE(HMM_EqV3OpNot, 1) -static inline HMM_Bool operator!=(HMM_Vec3 Left, HMM_Vec3 Right) +COVERAGE(EqV3OpNot, 1) +static inline Bool operator!=(Vec3 Left, Vec3 Right) { - ASSERT_COVERED(HMM_EqV3OpNot); - return !HMM_EqV3(Left, Right); + ASSERT_COVERED(EqV3OpNot); + return !EqV3(Left, Right); } -COVERAGE(HMM_EqV4OpNot, 1) -static inline HMM_Bool operator!=(HMM_Vec4 Left, HMM_Vec4 Right) +COVERAGE(EqV4OpNot, 1) +static inline Bool operator!=(Vec4 Left, Vec4 Right) { - ASSERT_COVERED(HMM_EqV4OpNot); - return !HMM_EqV4(Left, Right); + ASSERT_COVERED(EqV4OpNot); + return !EqV4(Left, Right); } -COVERAGE(HMM_UnaryMinusV2, 1) -static inline HMM_Vec2 operator-(HMM_Vec2 In) +COVERAGE(UnaryMinusV2, 1) +static inline Vec2 operator-(Vec2 In) { - ASSERT_COVERED(HMM_UnaryMinusV2); + ASSERT_COVERED(UnaryMinusV2); - HMM_Vec2 Result; + Vec2 Result; Result.X = -In.X; Result.Y = -In.Y; return Result; } -COVERAGE(HMM_UnaryMinusV3, 1) -static inline HMM_Vec3 operator-(HMM_Vec3 In) +COVERAGE(UnaryMinusV3, 1) +static inline Vec3 operator-(Vec3 In) { - ASSERT_COVERED(HMM_UnaryMinusV3); + ASSERT_COVERED(UnaryMinusV3); - HMM_Vec3 Result; + Vec3 Result; Result.X = -In.X; Result.Y = -In.Y; Result.Z = -In.Z; @@ -3630,12 +3631,12 @@ static inline HMM_Vec3 operator-(HMM_Vec3 In) return Result; } -COVERAGE(HMM_UnaryMinusV4, 1) -static inline HMM_Vec4 operator-(HMM_Vec4 In) +COVERAGE(UnaryMinusV4, 1) +static inline Vec4 operator-(Vec4 In) { - ASSERT_COVERED(HMM_UnaryMinusV4); + ASSERT_COVERED(UnaryMinusV4); - HMM_Vec4 Result; + Vec4 Result; #if HANDMADE_MATH__USE_SSE Result.SSE = _mm_xor_ps(In.SSE, _mm_set1_ps(-0.0f)); #else @@ -3651,124 +3652,124 @@ static inline HMM_Vec4 operator-(HMM_Vec4 In) #endif /* __cplusplus*/ #ifdef HANDMADE_MATH__USE_C11_GENERICS -#define HMM_Add(A, B) _Generic((A), \ - HMM_Vec2: HMM_AddV2, \ - HMM_Vec3: HMM_AddV3, \ - HMM_Vec4: HMM_AddV4, \ - HMM_Mat2: HMM_AddM2, \ - HMM_Mat3: HMM_AddM3, \ - HMM_Mat4: HMM_AddM4, \ - HMM_Quat: HMM_AddQ \ +#define Add(A, B) _Generic((A), \ + Vec2: AddV2, \ + Vec3: AddV3, \ + Vec4: AddV4, \ + Mat2: AddM2, \ + Mat3: AddM3, \ + Mat4: AddM4, \ + Quat: AddQ \ )(A, B) -#define HMM_Sub(A, B) _Generic((A), \ - HMM_Vec2: HMM_SubV2, \ - HMM_Vec3: HMM_SubV3, \ - HMM_Vec4: HMM_SubV4, \ - HMM_Mat2: HMM_SubM2, \ - HMM_Mat3: HMM_SubM3, \ - HMM_Mat4: HMM_SubM4, \ - HMM_Quat: HMM_SubQ \ +#define Sub(A, B) _Generic((A), \ + Vec2: SubV2, \ + Vec3: SubV3, \ + Vec4: SubV4, \ + Mat2: SubM2, \ + Mat3: SubM3, \ + Mat4: SubM4, \ + Quat: SubQ \ )(A, B) -#define HMM_Mul(A, B) _Generic((B), \ +#define Mul(A, B) _Generic((B), \ float: _Generic((A), \ - HMM_Vec2: HMM_MulV2F, \ - HMM_Vec3: HMM_MulV3F, \ - HMM_Vec4: HMM_MulV4F, \ - HMM_Mat2: HMM_MulM2F, \ - HMM_Mat3: HMM_MulM3F, \ - HMM_Mat4: HMM_MulM4F, \ - HMM_Quat: HMM_MulQF \ + Vec2: MulV2F, \ + Vec3: MulV3F, \ + Vec4: MulV4F, \ + Mat2: MulM2F, \ + Mat3: MulM3F, \ + Mat4: MulM4F, \ + Quat: MulQF \ ), \ - HMM_Mat2: HMM_MulM2, \ - HMM_Mat3: HMM_MulM3, \ - HMM_Mat4: HMM_MulM4, \ - HMM_Quat: HMM_MulQ, \ + Mat2: MulM2, \ + Mat3: MulM3, \ + Mat4: MulM4, \ + Quat: MulQ, \ default: _Generic((A), \ - HMM_Vec2: HMM_MulV2, \ - HMM_Vec3: HMM_MulV3, \ - HMM_Vec4: HMM_MulV4, \ - HMM_Mat2: HMM_MulM2V2, \ - HMM_Mat3: HMM_MulM3V3, \ - HMM_Mat4: HMM_MulM4V4 \ + Vec2: MulV2, \ + Vec3: MulV3, \ + Vec4: MulV4, \ + Mat2: MulM2V2, \ + Mat3: MulM3V3, \ + Mat4: MulM4V4 \ ) \ )(A, B) -#define HMM_Div(A, B) _Generic((B), \ +#define Div(A, B) _Generic((B), \ float: _Generic((A), \ - HMM_Mat2: HMM_DivM2F, \ - HMM_Mat3: HMM_DivM3F, \ - HMM_Mat4: HMM_DivM4F, \ - HMM_Vec2: HMM_DivV2F, \ - HMM_Vec3: HMM_DivV3F, \ - HMM_Vec4: HMM_DivV4F, \ - HMM_Quat: HMM_DivQF \ + Mat2: DivM2F, \ + Mat3: DivM3F, \ + Mat4: DivM4F, \ + Vec2: DivV2F, \ + Vec3: DivV3F, \ + Vec4: DivV4F, \ + Quat: DivQF \ ), \ - HMM_Mat2: HMM_DivM2, \ - HMM_Mat3: HMM_DivM3, \ - HMM_Mat4: HMM_DivM4, \ - HMM_Quat: HMM_DivQ, \ + Mat2: DivM2, \ + Mat3: DivM3, \ + Mat4: DivM4, \ + Quat: DivQ, \ default: _Generic((A), \ - HMM_Vec2: HMM_DivV2, \ - HMM_Vec3: HMM_DivV3, \ - HMM_Vec4: HMM_DivV4 \ + Vec2: DivV2, \ + Vec3: DivV3, \ + Vec4: DivV4 \ ) \ )(A, B) -#define HMM_Len(A) _Generic((A), \ - HMM_Vec2: HMM_LenV2, \ - HMM_Vec3: HMM_LenV3, \ - HMM_Vec4: HMM_LenV4 \ +#define Len(A) _Generic((A), \ + Vec2: LenV2, \ + Vec3: LenV3, \ + Vec4: LenV4 \ )(A) -#define HMM_LenSqr(A) _Generic((A), \ - HMM_Vec2: HMM_LenSqrV2, \ - HMM_Vec3: HMM_LenSqrV3, \ - HMM_Vec4: HMM_LenSqrV4 \ +#define LenSqr(A) _Generic((A), \ + Vec2: LenSqrV2, \ + Vec3: LenSqrV3, \ + Vec4: LenSqrV4 \ )(A) -#define HMM_Norm(A) _Generic((A), \ - HMM_Vec2: HMM_NormV2, \ - HMM_Vec3: HMM_NormV3, \ - HMM_Vec4: HMM_NormV4 \ +#define Norm(A) _Generic((A), \ + Vec2: NormV2, \ + Vec3: NormV3, \ + Vec4: NormV4 \ )(A) -#define HMM_Dot(A, B) _Generic((A), \ - HMM_Vec2: HMM_DotV2, \ - HMM_Vec3: HMM_DotV3, \ - HMM_Vec4: HMM_DotV4 \ +#define Dot(A, B) _Generic((A), \ + Vec2: DotV2, \ + Vec3: DotV3, \ + Vec4: DotV4 \ )(A, B) -#define HMM_Lerp(A, T, B) _Generic((A), \ - float: HMM_Lerp, \ - HMM_Vec2: HMM_LerpV2, \ - HMM_Vec3: HMM_LerpV3, \ - HMM_Vec4: HMM_LerpV4 \ +#define Lerp(A, T, B) _Generic((A), \ + float: Lerp, \ + Vec2: LerpV2, \ + Vec3: LerpV3, \ + Vec4: LerpV4 \ )(A, T, B) -#define HMM_Eq(A, B) _Generic((A), \ - HMM_Vec2: HMM_EqV2, \ - HMM_Vec3: HMM_EqV3, \ - HMM_Vec4: HMM_EqV4 \ +#define Eq(A, B) _Generic((A), \ + Vec2: EqV2, \ + Vec3: EqV3, \ + Vec4: EqV4 \ )(A, B) -#define HMM_Transpose(M) _Generic((M), \ - HMM_Mat2: HMM_TransposeM2, \ - HMM_Mat3: HMM_TransposeM3, \ - HMM_Mat4: HMM_TransposeM4 \ +#define Transpose(M) _Generic((M), \ + Mat2: TransposeM2, \ + Mat3: TransposeM3, \ + Mat4: TransposeM4 \ )(M) -#define HMM_Determinant(M) _Generic((M), \ - HMM_Mat2: HMM_DeterminantM2, \ - HMM_Mat3: HMM_DeterminantM3, \ - HMM_Mat4: HMM_DeterminantM4 \ +#define Determinant(M) _Generic((M), \ + Mat2: DeterminantM2, \ + Mat3: DeterminantM3, \ + Mat4: DeterminantM4 \ )(M) -#define HMM_InvGeneral(M) _Generic((M), \ - HMM_Mat2: HMM_InvGeneralM2, \ - HMM_Mat3: HMM_InvGeneralM3, \ - HMM_Mat4: HMM_InvGeneralM4 \ +#define InvGeneral(M) _Generic((M), \ + Mat2: InvGeneralM2, \ + Mat3: InvGeneralM3, \ + Mat4: InvGeneralM4 \ )(M) #endif