fixing some normalized space calculation issues

I need to review the convention I'm using for the "view" or at least how I interpret these coordinate spaces so its inutitive for the interface.
At the end of the day, the draw_list should be in normalized space, however how it gets digested to that state needs to be better documented or made more explicit in its transformation from the usual user calls.
This commit is contained in:
2025-01-10 16:14:59 -05:00
parent 91e8af8839
commit 52584f888c
2 changed files with 26 additions and 10 deletions

View File

@@ -154,8 +154,7 @@ draw_text_string_pos_norm :: proc( content : string, font : Font_ID, size : f32,
{
color_norm := normalize_rgba8(color)
def := demo_ctx.font_ids[ font.label ]
size := size > 2.0 ? size : f32(def.default_size)
size := size > 2.0 ? size : f32(def.default_size)
ve.draw_text_normalized_space( & demo_ctx.ve_ctx,
def.ve_id,
@@ -163,7 +162,7 @@ draw_text_string_pos_norm :: proc( content : string, font : Font_ID, size : f32,
color_norm,
demo_ctx.screen_size,
pos,
scale * 1 / demo_ctx.screen_size,
scale,
1.0,
content
)
@@ -257,7 +256,18 @@ init :: proc "c" ()
case .DUMMY: fmt.println(">> using dummy backend")
}
ve.startup( & demo_ctx.ve_ctx, .STB_TrueType, allocator = context.allocator )
glyph_draw_opts := ve.Init_Glyph_Draw_Params_Default
glyph_draw_opts.snap_glyph_height = false
shaper_opts := ve.Init_Shaper_Params_Default
shaper_opts.snap_glyph_position = false
ve.startup( & demo_ctx.ve_ctx, .STB_TrueType, allocator = context.allocator,
glyph_draw_params = glyph_draw_opts,
shaper_params = shaper_opts,
px_scalar = 1.5,
alpha_sharpen = 0.1,
)
ve_sokol.setup_gfx_objects( & demo_ctx.render_ctx, & demo_ctx.ve_ctx, vert_cap = 1024 * 1024, index_cap = 1024 * 1024 )
error : mem.Allocator_Error