Finally reached parity pre-rendering overhaul
This commit is contained in:
parent
72eb3a1b3b
commit
2698670890
@ -490,7 +490,7 @@ draw_text_batch :: proc(ctx: ^Context, entry: ^Entry, shaped: ^ShapedText,
|
||||
slot_position, _ := atlas_bbox( atlas, region_kind, atlas_index )
|
||||
glyph_scale := bounds_size * entry.size_scale + glyph_padding
|
||||
bounds_0_scaled := ceil( vbounds_0 * entry.size_scale )
|
||||
dst := glyph_translate + (bounds_0_scaled - glyph_padding) * scale
|
||||
dst := glyph_translate + bounds_0_scaled * scale
|
||||
dst_scale := glyph_scale * scale
|
||||
textspace_x_form( & slot_position, & glyph_scale, atlas_size )
|
||||
|
||||
|
@ -122,7 +122,7 @@ shape_text_uncached :: proc( ctx : ^Context, font : FontID, text_utf8 : string,
|
||||
position.y
|
||||
})
|
||||
|
||||
position.x += f32(advance) * entry.size_scale
|
||||
position.x += ceil(f32(advance) * entry.size_scale)
|
||||
prev_codepoint = codepoint
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ ui_screen_menu_bar :: proc( captures : rawptr = nil ) -> (should_raise : b32 = f
|
||||
{
|
||||
@static theme : UI_Theme
|
||||
@static loaded : b32 = false
|
||||
if ! loaded
|
||||
if ! loaded || true
|
||||
{
|
||||
app_color := app_color_theme()
|
||||
layout := UI_Layout {
|
||||
@ -56,7 +56,7 @@ ui_screen_menu_bar :: proc( captures : rawptr = nil ) -> (should_raise : b32 = f
|
||||
anchor = range2({},{}),
|
||||
// alignment = UI_Align_Presets.text_centered,
|
||||
text_alignment = {0.0, 0},
|
||||
font_size = 12,
|
||||
font_size = 10,
|
||||
margins = {0, 0, 0, 0},
|
||||
padding = {0, 0, 0, 0},
|
||||
border_width = 1.0,
|
||||
@ -232,7 +232,7 @@ ui_screen_settings_menu :: proc( captures : rawptr = nil ) -> ( should_raise : b
|
||||
using input_box
|
||||
layout.flags = {.Fixed_Width}
|
||||
layout.margins.left = 5
|
||||
layout.padding.right = 10
|
||||
layout.padding.right = 5
|
||||
layout.size.min.x = 80
|
||||
style.corner_radii[0] = 0.35
|
||||
|
||||
@ -273,11 +273,11 @@ ui_screen_settings_menu :: proc( captures : rawptr = nil ) -> ( should_raise : b
|
||||
scope(theme_text)
|
||||
value_txt = ui_text("settings_menu.engine_refresh.input_box.value", to_str_runes_pair(array_to_slice(value_str)))
|
||||
using value_txt
|
||||
layout.alignment = {1, 0.0}
|
||||
layout.text_alignment = {0, 0.5}
|
||||
layout.anchor.left = 1.0
|
||||
layout.flags = {.Fixed_Width}
|
||||
// layout.size.min = cast(Vec2) measure_text_size( value_txt.text.str, value_txt.style.font, value_txt.layout.font_size, 0 )
|
||||
layout.alignment = {0.0, 0.0}
|
||||
layout.text_alignment = {1.0, 0.5}
|
||||
layout.anchor.left = 0.0
|
||||
// layout.flags = {.Fixed_Width}
|
||||
layout.size.min = cast(Vec2) measure_text_size( value_txt.text.str, value_txt.style.font, value_txt.layout.font_size, 0 )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ theme_button :: proc() -> UI_Theme
|
||||
anchor = range2_zero,
|
||||
alignment = {0, 0},
|
||||
text_alignment = {0.5, 0.5},
|
||||
font_size = 16,
|
||||
font_size = 12,
|
||||
margins = {0, 0, 0, 0},
|
||||
padding = {0, 0, 0, 0},
|
||||
border_width = 1,
|
||||
@ -113,7 +113,7 @@ theme_table_row :: proc( is_even : bool ) -> UI_Theme
|
||||
{
|
||||
@static theme : UI_Theme
|
||||
@static loaded : b32 = false
|
||||
if ! loaded
|
||||
if ! loaded || true
|
||||
{
|
||||
app_color := app_color_theme()
|
||||
table_bg : RGBA8
|
||||
@ -127,7 +127,7 @@ theme_table_row :: proc( is_even : bool ) -> UI_Theme
|
||||
flags = {},
|
||||
anchor = range2({},{}),
|
||||
alignment = {0, 0},
|
||||
text_alignment = {0.0, 0.0},
|
||||
text_alignment = {0.5, 0.0},
|
||||
font_size = 16,
|
||||
margins = {0, 0, 0, 0},
|
||||
padding = {0, 0, 0, 0},
|
||||
@ -276,12 +276,12 @@ theme_window_bar_btn :: proc() -> UI_Theme
|
||||
anchor = range2({1, 0},{}),
|
||||
alignment = {0, 0},
|
||||
text_alignment = {0.5, 0.5},
|
||||
font_size = 16,
|
||||
font_size = 12,
|
||||
margins = {0, 0, 0, 0},
|
||||
padding = {0, 0, 0, 0},
|
||||
border_width = 1,
|
||||
pos = {0, 0},
|
||||
size = range2({50,0},{})
|
||||
size = range2({60,0},{})
|
||||
}
|
||||
style := UI_Style {
|
||||
bg_color = app_color.btn_bg_default,
|
||||
|
@ -332,10 +332,10 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
|
||||
ui_startup( & workspace.ui, cache_allocator = persistent_slab_allocator() )
|
||||
}
|
||||
|
||||
// debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/Lorem Ipsum (197).txt", allocator = persistent_slab_allocator())
|
||||
debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/Lorem Ipsum (197).txt", allocator = persistent_slab_allocator())
|
||||
// debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/Lorem Ipsum (1022).txt", allocator = persistent_slab_allocator())
|
||||
// debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/sokol_gp.h", allocator = persistent_slab_allocator())
|
||||
debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/ve_fontcache.h", allocator = persistent_slab_allocator())
|
||||
// debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/ve_fontcache.h", allocator = persistent_slab_allocator())
|
||||
|
||||
alloc_error : AllocatorError; success : bool
|
||||
debug.lorem_content, success = os.read_entire_file( debug.path_lorem, persistent_slab_allocator() )
|
||||
|
@ -339,8 +339,8 @@ update :: proc( delta_time : f64 ) -> b32
|
||||
// test_hover_n_click()
|
||||
// test_draggable()
|
||||
// test_text_box()
|
||||
// test_parenting( & default_layout, & frame_style_default )
|
||||
test_whitespace_ast( & default_layout, & frame_style_default )
|
||||
test_parenting( & default_layout, & frame_style_default )
|
||||
// test_whitespace_ast( & default_layout, & frame_style_default )
|
||||
}
|
||||
//endregion Workspace Imgui Tick
|
||||
|
||||
|
@ -51,10 +51,12 @@ import fmt_io "core:fmt"
|
||||
str_tmp_from_any :: fmt_io.tprint
|
||||
|
||||
import "core:math"
|
||||
lerp :: math.lerp
|
||||
lerp :: math.lerp
|
||||
|
||||
import "core:math/bits"
|
||||
u64_max :: bits.U64_MAX
|
||||
u64_max :: bits.U64_MAX
|
||||
|
||||
import "core:math/linalg"
|
||||
|
||||
import "core:mem"
|
||||
align_forward_int :: mem.align_forward_int
|
||||
@ -365,6 +367,20 @@ dot :: proc {
|
||||
// ws_view_draw_text_StrRunesPair,
|
||||
// }
|
||||
|
||||
floor :: proc {
|
||||
math.floor_f16,
|
||||
math.floor_f16le,
|
||||
math.floor_f16be,
|
||||
math.floor_f32,
|
||||
math.floor_f32le,
|
||||
math.floor_f32be,
|
||||
math.floor_f64,
|
||||
math.floor_f64le,
|
||||
math.floor_f64be,
|
||||
|
||||
linalg.floor
|
||||
}
|
||||
|
||||
from_bytes :: proc {
|
||||
str_builder_from_bytes,
|
||||
}
|
||||
|
@ -167,6 +167,10 @@ ui_box_compute_layout :: proc( box : ^UI_Box,
|
||||
if len(box.text.str) > 0
|
||||
{
|
||||
ascent, descent, line_gap := get_font_vertical_metrics(style.font, layout.font_size)
|
||||
|
||||
offset := text_size
|
||||
offset += { 0, -descent }
|
||||
|
||||
content_size := content_bounds.max - content_bounds.min
|
||||
text_pos : Vec2
|
||||
text_pos = content_bounds.min
|
||||
|
@ -204,10 +204,10 @@ push-location $path_root
|
||||
# $build_args += $flag_micro_architecture_native
|
||||
$build_args += $flag_use_separate_modules
|
||||
$build_args += $flag_thread_count + $CoreCount_Physical
|
||||
# $build_args += $flag_optimize_none
|
||||
$build_args += $flag_optimize_none
|
||||
# $build_args += $flag_optimize_minimal
|
||||
# $build_args += $flag_optimize_speed
|
||||
$build_args += $falg_optimize_aggressive
|
||||
# $build_args += $falg_optimize_aggressive
|
||||
$build_args += $flag_debug
|
||||
$build_args += $flag_pdb_name + $pdb
|
||||
$build_args += $flag_subsystem + 'windows'
|
||||
|
Loading…
Reference in New Issue
Block a user