From d34a42248464bab627571278675d0145538f048c Mon Sep 17 00:00:00 2001 From: Jack Punter Date: Thu, 8 Jan 2026 20:59:33 +0000 Subject: [PATCH 1/2] Revert "Added API to specify vertex parameters for rectangle corners." This reverts commit 7f70d5511248d1c45d0f3770b1a3f2dcdc5902c1. --- code/4ed_api_implementation.cpp | 26 --------------- code/4ed_render_target.cpp | 59 +-------------------------------- 2 files changed, 1 insertion(+), 84 deletions(-) diff --git a/code/4ed_api_implementation.cpp b/code/4ed_api_implementation.cpp index af93cc5a5..6ae52c93c 100644 --- a/code/4ed_api_implementation.cpp +++ b/code/4ed_api_implementation.cpp @@ -2898,32 +2898,6 @@ draw_rectangle_outline(Application_Links *app, Rect_f32 rect, f32 roundness, f32 } } -api(custom) function void -draw_rectangle_outline_corner_parameters(Application_Links *app, Rect_f32 rect, - f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, - f32 thickness_x0y0, f32 thickness_x1y0, f32 thickness_x0y1, f32 thickness_x1y1, - u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1){ - Models *models = (Models*)app->cmd_context; - if (models->in_render_mode){ - draw_rectangle_outline_corner_parameters(models->target, rect, - roundness_x0y0, roundness_x1y0, roundness_x0y1, roundness_x1y1, - thickness_x0y0, thickness_x1y0, thickness_x0y1, thickness_x1y1, - color_x0y0, color_x1y0, color_x0y1, color_x1y1); - } -} - -api(custom) function void -draw_rectangle_corner_parameters(Application_Links *app, Rect_f32 rect, - f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, - u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1){ - Models *models = (Models*)app->cmd_context; - if (models->in_render_mode){ - draw_rectangle_corner_parameters(models->target, rect, - roundness_x0y0, roundness_x1y0, roundness_x0y1, roundness_x1y1, - color_x0y0, color_x1y0, color_x0y1, color_x1y1); - } -} - api(custom) function Rect_f32 draw_set_clip(Application_Links *app, Rect_f32 new_clip){ Models *models = (Models*)app->cmd_context; diff --git a/code/4ed_render_target.cpp b/code/4ed_render_target.cpp index 98d807203..4ade6657b 100644 --- a/code/4ed_render_target.cpp +++ b/code/4ed_render_target.cpp @@ -130,68 +130,11 @@ end_render_section(Render_Target *target){ //////////////////////////////// -internal void -draw_rectangle_outline_corner_parameters(Render_Target *target, Rect_f32 rect, - f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, - f32 thickness_x0y0, f32 thickness_x1y0, f32 thickness_x0y1, f32 thickness_x1y1, - u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1){ - - if ( rect_overlap(rect, target->current_clip_box) ) { - - if (roundness_x0y0 < epsilon_f32) roundness_x0y0 = 0.f; - if (roundness_x1y0 < epsilon_f32) roundness_x1y0 = 0.f; - if (roundness_x0y1 < epsilon_f32) roundness_x0y1 = 0.f; - if (roundness_x1y1 < epsilon_f32) roundness_x1y1 = 0.f; - - thickness_x0y0 = clamp_bot(1.f, thickness_x0y0); - thickness_x1y0 = clamp_bot(1.f, thickness_x1y0); - thickness_x0y1 = clamp_bot(1.f, thickness_x0y1); - thickness_x1y1 = clamp_bot(1.f, thickness_x1y1); - - Render_Vertex vertices[6] = {}; - vertices[0].xy = V2f32(rect.x0, rect.y0); - vertices[1].xy = vertices[3].xy = V2f32(rect.x1, rect.y0); - vertices[2].xy = vertices[4].xy = V2f32(rect.x0, rect.y1); - vertices[5].xy = V2f32(rect.x1, rect.y1); - - vertices[0].color = color_x0y0; - vertices[1].color = vertices[3].color = color_x1y0; - vertices[2].color = vertices[4].color = color_x0y1; - vertices[5].color = color_x1y1; - - vertices[0].half_thickness = thickness_x0y0/2.f; - vertices[1].half_thickness = vertices[3].half_thickness = thickness_x1y0/2.f; - vertices[2].half_thickness = vertices[4].half_thickness = thickness_x0y1/2.f; - vertices[5].half_thickness = thickness_x1y1/2.f; - - Vec2_f32 center = rect_center(rect); - - vertices[0].uvw = V3f32(center.x, center.y, roundness_x0y0); - vertices[1].uvw = vertices[3].uvw = V3f32(center.x, center.y, roundness_x1y0); - vertices[2].uvw = vertices[4].uvw = V3f32(center.x, center.y, roundness_x0y1); - vertices[5].uvw = V3f32(center.x, center.y, roundness_x1y1); - - draw__write_vertices_in_current_group(target, vertices, ArrayCount(vertices)); - } -} - -internal void -draw_rectangle_corner_parameters(Render_Target *target, Rect_f32 rect, - f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, - u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1){ - Vec2_f32 dim = rect_dim(rect); - f32 thickness = Max(dim.x, dim.y); - draw_rectangle_outline_corner_parameters(target, rect, - roundness_x0y0, roundness_x1y0, roundness_x0y1, roundness_x1y1, - thickness, thickness, thickness, thickness, - color_x0y0, color_x1y0, color_x0y1, color_x1y1); -} - internal void draw_rectangle_outline(Render_Target *target, Rect_f32 rect, f32 roundness, f32 thickness, u32 color){ if ( rect_overlap(rect, target->current_clip_box) ) { - + if (roundness < epsilon_f32){ roundness = 0.f; } From da6680c9b49395f239f4589195d3432baa8376a5 Mon Sep 17 00:00:00 2001 From: Jack Punter Date: Thu, 8 Jan 2026 20:59:38 +0000 Subject: [PATCH 2/2] Revert "Fixed cast in 4ed_api_parser_main.cpp, updated custom/generated files" This reverts commit 9c37d54d54912bd3ca5209e85fd459e7a87477d9. --- code/4ed_api_parser_main.cpp | 2 +- code/custom/generated/custom_api.cpp | 4 --- code/custom/generated/custom_api.h | 10 ------- .../generated/custom_api_constructor.cpp | 30 ------------------- .../custom/generated/custom_api_master_list.h | 2 -- 5 files changed, 1 insertion(+), 47 deletions(-) diff --git a/code/4ed_api_parser_main.cpp b/code/4ed_api_parser_main.cpp index d4688cdd7..aba3eafda 100644 --- a/code/4ed_api_parser_main.cpp +++ b/code/4ed_api_parser_main.cpp @@ -38,7 +38,7 @@ main(int argc, char **argv){ } String_Const_u8 exe = SCu8("code/4ed_api_parser_main.exe"); - u64 command_line_length = exe.size; + u32 command_line_length = exe.size; for (i32 i = 1; i < argc; i+=1){ command_line_length += 1 + cstring_length(argv[i]); diff --git a/code/custom/generated/custom_api.cpp b/code/custom/generated/custom_api.cpp index e7ade1430..d0d02fdb9 100644 --- a/code/custom/generated/custom_api.cpp +++ b/code/custom/generated/custom_api.cpp @@ -165,8 +165,6 @@ custom_api_fill_vtable(API_VTable_custom *vtable){ vtable->get_string_advance = get_string_advance; vtable->draw_rectangle = draw_rectangle; vtable->draw_rectangle_outline = draw_rectangle_outline; - vtable->draw_rectangle_outline_corner_parameters = draw_rectangle_outline_corner_parameters; - vtable->draw_rectangle_corner_parameters = draw_rectangle_corner_parameters; vtable->draw_set_clip = draw_set_clip; vtable->text_layout_create = text_layout_create; vtable->text_layout_region = text_layout_region; @@ -351,8 +349,6 @@ custom_api_read_vtable(API_VTable_custom *vtable){ get_string_advance = vtable->get_string_advance; draw_rectangle = vtable->draw_rectangle; draw_rectangle_outline = vtable->draw_rectangle_outline; - draw_rectangle_outline_corner_parameters = vtable->draw_rectangle_outline_corner_parameters; - draw_rectangle_corner_parameters = vtable->draw_rectangle_corner_parameters; draw_set_clip = vtable->draw_set_clip; text_layout_create = vtable->text_layout_create; text_layout_region = vtable->text_layout_region; diff --git a/code/custom/generated/custom_api.h b/code/custom/generated/custom_api.h index cd34fb7ca..e7ef7e3c7 100644 --- a/code/custom/generated/custom_api.h +++ b/code/custom/generated/custom_api.h @@ -163,8 +163,6 @@ #define custom_get_string_advance_sig() f32 custom_get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str) #define custom_draw_rectangle_sig() void custom_draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color) #define custom_draw_rectangle_outline_sig() void custom_draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color) -#define custom_draw_rectangle_outline_corner_parameters_sig() void custom_draw_rectangle_outline_corner_parameters(Application_Links* app, Rect_f32 rect, f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, f32 thickness_x0y0, f32 thickness_x1y0, f32 thickness_x0y1, f32 thickness_x1y1, u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1) -#define custom_draw_rectangle_corner_parameters_sig() void custom_draw_rectangle_corner_parameters(Application_Links* app, Rect_f32 rect, f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1) #define custom_draw_set_clip_sig() Rect_f32 custom_draw_set_clip(Application_Links* app, Rect_f32 new_clip) #define custom_text_layout_create_sig() Text_Layout_ID custom_text_layout_create(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point) #define custom_text_layout_region_sig() Rect_f32 custom_text_layout_region(Application_Links* app, Text_Layout_ID text_layout_id) @@ -345,8 +343,6 @@ typedef Vec2_f32 custom_draw_string_oriented_type(Application_Links* app, Face_I typedef f32 custom_get_string_advance_type(Application_Links* app, Face_ID font_id, String_Const_u8 str); typedef void custom_draw_rectangle_type(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color); typedef void custom_draw_rectangle_outline_type(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color); -typedef void custom_draw_rectangle_outline_corner_parameters_type(Application_Links* app, Rect_f32 rect, f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, f32 thickness_x0y0, f32 thickness_x1y0, f32 thickness_x0y1, f32 thickness_x1y1, u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1); -typedef void custom_draw_rectangle_corner_parameters_type(Application_Links* app, Rect_f32 rect, f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1); typedef Rect_f32 custom_draw_set_clip_type(Application_Links* app, Rect_f32 new_clip); typedef Text_Layout_ID custom_text_layout_create_type(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point); typedef Rect_f32 custom_text_layout_region_type(Application_Links* app, Text_Layout_ID text_layout_id); @@ -528,8 +524,6 @@ struct API_VTable_custom{ custom_get_string_advance_type *get_string_advance; custom_draw_rectangle_type *draw_rectangle; custom_draw_rectangle_outline_type *draw_rectangle_outline; - custom_draw_rectangle_outline_corner_parameters_type *draw_rectangle_outline_corner_parameters; - custom_draw_rectangle_corner_parameters_type *draw_rectangle_corner_parameters; custom_draw_set_clip_type *draw_set_clip; custom_text_layout_create_type *text_layout_create; custom_text_layout_region_type *text_layout_region; @@ -712,8 +706,6 @@ internal Vec2_f32 draw_string_oriented(Application_Links* app, Face_ID font_id, internal f32 get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str); internal void draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color); internal void draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color); -internal void draw_rectangle_outline_corner_parameters(Application_Links* app, Rect_f32 rect, f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, f32 thickness_x0y0, f32 thickness_x1y0, f32 thickness_x0y1, f32 thickness_x1y1, u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1); -internal void draw_rectangle_corner_parameters(Application_Links* app, Rect_f32 rect, f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1); internal Rect_f32 draw_set_clip(Application_Links* app, Rect_f32 new_clip); internal Text_Layout_ID text_layout_create(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point); internal Rect_f32 text_layout_region(Application_Links* app, Text_Layout_ID text_layout_id); @@ -896,8 +888,6 @@ global custom_draw_string_oriented_type *draw_string_oriented = 0; global custom_get_string_advance_type *get_string_advance = 0; global custom_draw_rectangle_type *draw_rectangle = 0; global custom_draw_rectangle_outline_type *draw_rectangle_outline = 0; -global custom_draw_rectangle_outline_corner_parameters_type *draw_rectangle_outline_corner_parameters = 0; -global custom_draw_rectangle_corner_parameters_type *draw_rectangle_corner_parameters = 0; global custom_draw_set_clip_type *draw_set_clip = 0; global custom_text_layout_create_type *text_layout_create = 0; global custom_text_layout_region_type *text_layout_region = 0; diff --git a/code/custom/generated/custom_api_constructor.cpp b/code/custom/generated/custom_api_constructor.cpp index f4f8199b4..a63d6def4 100644 --- a/code/custom/generated/custom_api_constructor.cpp +++ b/code/custom/generated/custom_api_constructor.cpp @@ -946,36 +946,6 @@ custom_api_construct(Arena *arena){ api_param(arena, call, "f32", "thickness"); api_param(arena, call, "ARGB_Color", "color"); } - { - API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("draw_rectangle_outline_corner_parameters"), string_u8_litexpr("void"), string_u8_litexpr("")); - api_param(arena, call, "Application_Links*", "app"); - api_param(arena, call, "Rect_f32", "rect"); - api_param(arena, call, "f32", "roundness_x0y0"); - api_param(arena, call, "f32", "roundness_x1y0"); - api_param(arena, call, "f32", "roundness_x0y1"); - api_param(arena, call, "f32", "roundness_x1y1"); - api_param(arena, call, "f32", "thickness_x0y0"); - api_param(arena, call, "f32", "thickness_x1y0"); - api_param(arena, call, "f32", "thickness_x0y1"); - api_param(arena, call, "f32", "thickness_x1y1"); - api_param(arena, call, "u32", "color_x0y0"); - api_param(arena, call, "u32", "color_x1y0"); - api_param(arena, call, "u32", "color_x0y1"); - api_param(arena, call, "u32", "color_x1y1"); - } - { - API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("draw_rectangle_corner_parameters"), string_u8_litexpr("void"), string_u8_litexpr("")); - api_param(arena, call, "Application_Links*", "app"); - api_param(arena, call, "Rect_f32", "rect"); - api_param(arena, call, "f32", "roundness_x0y0"); - api_param(arena, call, "f32", "roundness_x1y0"); - api_param(arena, call, "f32", "roundness_x0y1"); - api_param(arena, call, "f32", "roundness_x1y1"); - api_param(arena, call, "u32", "color_x0y0"); - api_param(arena, call, "u32", "color_x1y0"); - api_param(arena, call, "u32", "color_x0y1"); - api_param(arena, call, "u32", "color_x1y1"); - } { API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("draw_set_clip"), string_u8_litexpr("Rect_f32"), string_u8_litexpr("")); api_param(arena, call, "Application_Links*", "app"); diff --git a/code/custom/generated/custom_api_master_list.h b/code/custom/generated/custom_api_master_list.h index 281e7deab..f05f6f733 100644 --- a/code/custom/generated/custom_api_master_list.h +++ b/code/custom/generated/custom_api_master_list.h @@ -163,8 +163,6 @@ api(custom) function Vec2_f32 draw_string_oriented(Application_Links* app, Face_ api(custom) function f32 get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str); api(custom) function void draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color); api(custom) function void draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color); -api(custom) function void draw_rectangle_outline_corner_parameters(Application_Links* app, Rect_f32 rect, f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, f32 thickness_x0y0, f32 thickness_x1y0, f32 thickness_x0y1, f32 thickness_x1y1, u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1); -api(custom) function void draw_rectangle_corner_parameters(Application_Links* app, Rect_f32 rect, f32 roundness_x0y0, f32 roundness_x1y0, f32 roundness_x0y1, f32 roundness_x1y1, u32 color_x0y0, u32 color_x1y0, u32 color_x0y1, u32 color_x1y1); api(custom) function Rect_f32 draw_set_clip(Application_Links* app, Rect_f32 new_clip); api(custom) function Text_Layout_ID text_layout_create(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point); api(custom) function Rect_f32 text_layout_region(Application_Links* app, Text_Layout_ID text_layout_id);