Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions code/4ed_api_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion code/4ed_api_parser_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
59 changes: 1 addition & 58 deletions code/4ed_render_target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 0 additions & 4 deletions code/custom/generated/custom_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 0 additions & 10 deletions code/custom/generated/custom_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
30 changes: 0 additions & 30 deletions code/custom/generated/custom_api_constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 0 additions & 2 deletions code/custom/generated/custom_api_master_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down