Misc changes
* Made refactor rende procedures to specify dependencies instead of directly grabbing from state singleton
This commit is contained in:
@ -48,9 +48,9 @@ render :: proc()
|
||||
// Will need to profile how expensive it is for batching with the UI box rendering
|
||||
// since the the text is correlated with the box rendering
|
||||
|
||||
font_provider := & state.font_provider_data
|
||||
font_provider := & state.font_provider_ctx
|
||||
using font_provider
|
||||
// ve_ctx := & font_provider.ve_font_cache
|
||||
// ve_ctx := & font_provider.ve_ctx
|
||||
|
||||
// Triangle Demo
|
||||
if false
|
||||
@ -125,14 +125,14 @@ render :: proc()
|
||||
// text_test_str := str_fmt("HELLO VE FONT CACHE!")
|
||||
// text_test_str := str_fmt("C")
|
||||
|
||||
// font_provider := & state.font_provider_data
|
||||
// font_provider := & state.font_provider_ctx
|
||||
fdef := hmap_chained_get( font_cache, default_font.key )
|
||||
|
||||
|
||||
ve.set_colour( & ve_font_cache, { 1.0, 1.0, 1.0, 1.0 } )
|
||||
ve.configure_snap( & ve_font_cache, u32(state.app_window.extent.x * 2.0), u32(state.app_window.extent.y * 2.0) )
|
||||
ve.set_colour( & ve_ctx, { 1.0, 1.0, 1.0, 1.0 } )
|
||||
ve.configure_snap( & ve_ctx, u32(state.app_window.extent.x * 2.0), u32(state.app_window.extent.y * 2.0) )
|
||||
|
||||
ve.draw_text( & ve_font_cache, fdef.ve_id, text_test_str, {0.0, 0.975}, Vec2{1 / width, 1 / height} )
|
||||
ve.draw_text( & ve_ctx, fdef.ve_id, text_test_str, {0.0, 0.975}, Vec2{1 / width, 1 / height} )
|
||||
}
|
||||
|
||||
|
||||
@ -144,8 +144,8 @@ render :: proc()
|
||||
{
|
||||
profile("VEFontCache: render frame")
|
||||
|
||||
ve.optimize_draw_list( & ve_font_cache )
|
||||
draw_list := ve.get_draw_list( & ve_font_cache )
|
||||
ve.optimize_draw_list( & ve_ctx )
|
||||
draw_list := ve.get_draw_list( & ve_ctx )
|
||||
|
||||
draw_list_vert_slice := array_to_slice(draw_list.vertices)
|
||||
draw_list_index_slice := array_to_slice(draw_list.indices)
|
||||
@ -169,8 +169,8 @@ render :: proc()
|
||||
continue
|
||||
}
|
||||
|
||||
width := ve_font_cache.atlas.buffer_width
|
||||
height := ve_font_cache.atlas.buffer_height
|
||||
width := ve_ctx.atlas.buffer_width
|
||||
height := ve_ctx.atlas.buffer_height
|
||||
|
||||
pass := glyph_pass
|
||||
if draw_call.clear_before_draw {
|
||||
@ -205,8 +205,8 @@ render :: proc()
|
||||
continue
|
||||
}
|
||||
|
||||
width := ve_font_cache.atlas.width
|
||||
height := ve_font_cache.atlas.height
|
||||
width := ve_ctx.atlas.width
|
||||
height := ve_ctx.atlas.height
|
||||
|
||||
pass := atlas_pass
|
||||
if draw_call.clear_before_draw {
|
||||
@ -299,6 +299,6 @@ render :: proc()
|
||||
}
|
||||
|
||||
sokol_gfx.commit()
|
||||
ve.flush_draw_list( & ve_font_cache )
|
||||
ve.flush_draw_list( & ve_ctx )
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
|
||||
// Setup Persistent Slabs & String Cache
|
||||
{
|
||||
// alignment := uint(mem.DEFAULT_ALIGNMENT)
|
||||
alignment := uint(64) // Doing the cache line
|
||||
alignment := uint(16)
|
||||
|
||||
policy_ptr := & default_slab_policy
|
||||
push( policy_ptr, SlabSizeClass { 128 * Kilobyte, 1 * Kilobyte, alignment })
|
||||
@ -138,11 +138,11 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
|
||||
refresh_rate = 0
|
||||
|
||||
cam_min_zoom = 0.10
|
||||
cam_max_zoom = 30.0
|
||||
cam_max_zoom = 5.0
|
||||
cam_zoom_mode = .Smooth
|
||||
cam_zoom_smooth_snappiness = 4.0
|
||||
cam_zoom_sensitivity_digital = 0.2
|
||||
cam_zoom_sensitivity_smooth = 4.0
|
||||
cam_zoom_sensitivity_digital = 0.05
|
||||
cam_zoom_sensitivity_smooth = 2.0
|
||||
|
||||
engine_refresh_hz = 0
|
||||
|
||||
@ -260,24 +260,24 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
|
||||
// Basic Font Setup
|
||||
if true
|
||||
{
|
||||
font_provider_startup()
|
||||
path_rec_mono_semicasual_reg := strings.concatenate( { Path_Assets, "RecMonoSemicasual-Regular-1.084.ttf" })
|
||||
font_rec_mono_semicasual_reg = font_load( path_rec_mono_semicasual_reg, 16.0, "RecMonoSemiCasual_Regular" )
|
||||
font_provider_startup( & font_provider_ctx )
|
||||
// path_rec_mono_semicasual_reg := strings.concatenate( { Path_Assets, "RecMonoSemicasual-Regular-1.084.ttf" })
|
||||
// font_rec_mono_semicasual_reg = font_load( path_rec_mono_semicasual_reg, 16.0, "RecMonoSemiCasual_Regular" )
|
||||
|
||||
path_squidgy_slimes := strings.concatenate( { Path_Assets, "Squidgy Slimes.ttf" } )
|
||||
font_squidgy_slimes = font_load( path_squidgy_slimes, 32.0, "Squidgy_Slime" )
|
||||
// path_squidgy_slimes := strings.concatenate( { Path_Assets, "Squidgy Slimes.ttf" } )
|
||||
// font_squidgy_slimes = font_load( path_squidgy_slimes, 32.0, "Squidgy_Slime" )
|
||||
|
||||
path_firacode := strings.concatenate( { Path_Assets, "FiraCode-Regular.ttf" } )
|
||||
font_firacode = font_load( path_firacode, 16.0, "FiraCode" )
|
||||
|
||||
path_open_sans := strings.concatenate( { Path_Assets, "OpenSans-Regular.ttf" } )
|
||||
font_open_sans = font_load( path_open_sans, 16.0, "OpenSans" )
|
||||
// path_open_sans := strings.concatenate( { Path_Assets, "OpenSans-Regular.ttf" } )
|
||||
// font_open_sans = font_load( path_open_sans, 16.0, "OpenSans" )
|
||||
|
||||
path_noto_sans := strings.concatenate( { Path_Assets, "NotoSans-Regular.ttf" } )
|
||||
font_noto_sans = font_load( path_noto_sans, 16.0, "NotoSans" )
|
||||
// path_noto_sans := strings.concatenate( { Path_Assets, "NotoSans-Regular.ttf" } )
|
||||
// font_noto_sans = font_load( path_noto_sans, 16.0, "NotoSans" )
|
||||
|
||||
path_arial_unicode_ms := strings.concatenate( { Path_Assets, "Arial Unicode MS.ttf" } )
|
||||
font_arial_unicode_ms = font_load( path_arial_unicode_ms, 16.0, "Arial_Unicode_MS" )
|
||||
// path_arial_unicode_ms := strings.concatenate( { Path_Assets, "Arial Unicode MS.ttf" } )
|
||||
// font_arial_unicode_ms = font_load( path_arial_unicode_ms, 16.0, "Arial_Unicode_MS" )
|
||||
|
||||
default_font = font_firacode
|
||||
log( "Default font loaded" )
|
||||
@ -328,8 +328,8 @@ 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 (1022).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())
|
||||
|
||||
alloc_error : AllocatorError; success : bool
|
||||
debug.lorem_content, success = os.read_entire_file( debug.path_lorem, persistent_slab_allocator() )
|
||||
@ -436,7 +436,7 @@ hot_reload :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_
|
||||
staged_input_events.backing = persistent_slab_allocator()
|
||||
}
|
||||
|
||||
font_provider_reload()
|
||||
font_provider_reload( & font_provider_ctx )
|
||||
|
||||
str_cache_reload( & string_cache, persistent_allocator(), persistent_allocator() )
|
||||
str_cache_set_module_ctx( & string_cache )
|
||||
|
@ -34,8 +34,6 @@ sokol_app_frame_callback :: proc "c" ()
|
||||
// log("sokol_app: Event-based frame callback triggered (detected a resize")
|
||||
// }
|
||||
|
||||
font_provider_reload()
|
||||
|
||||
// sokol_app is the only good reference for a frame-time at this point.
|
||||
sokol_delta_ms := sokol_app.frame_delta()
|
||||
sokol_delta_ns := transmute(Duration) sokol_delta_ms * MS_To_NS
|
||||
|
@ -40,33 +40,24 @@ render :: proc()
|
||||
}
|
||||
// Workspace and screen rendering passes
|
||||
{
|
||||
render_mode_2d_workspace()
|
||||
render_mode_screenspace()
|
||||
render_mode_2d_workspace( screen_extent, project.workspace.cam, input^, & project.workspace.ui, & font_provider_ctx.ve_ctx, font_provider_ctx.render )
|
||||
render_mode_screenspace( app_window.extent, & screen_ui, & font_provider_ctx.ve_ctx, font_provider_ctx.render, config, & debug )
|
||||
}
|
||||
gp.end()
|
||||
gfx.commit()
|
||||
ve.flush_draw_list( & font_provider_data.ve_font_cache )
|
||||
font_provider_data.vbuf_layer_offset = 0
|
||||
font_provider_data.ibuf_layer_offset = 0
|
||||
font_provider_data.calls_layer_offset = 0
|
||||
ve.flush_draw_list( & font_provider_ctx.ve_ctx )
|
||||
}
|
||||
|
||||
// TODO(Ed): Eventually this needs to become a 'viewport within a UI'
|
||||
// This would allow the user to have more than one workspace open at the same time
|
||||
render_mode_2d_workspace :: proc()
|
||||
render_mode_2d_workspace :: proc( screen_extent : Vec2, cam : Camera, input : InputState, ui : ^UI_State, ve_ctx : ^ve.Context, ve_render : VE_RenderData )
|
||||
{
|
||||
profile(#procedure)
|
||||
state := get_state(); using state // TODO(Ed): Prefer passing static context to through the callstack
|
||||
cam := project.workspace.cam
|
||||
|
||||
screen_extent := app_window.extent
|
||||
screen_size := app_window.extent * 2
|
||||
screen_ratio := screen_size.x * ( 1.0 / screen_size.y )
|
||||
|
||||
cam_zoom_ratio := 1.0 / cam.zoom
|
||||
screen_size := screen_extent * 2
|
||||
|
||||
// TODO(Ed): Eventually will be the viewport extents
|
||||
ve.configure_snap( & font_provider_data.ve_font_cache, u32(state.app_window.extent.x * 2.0), u32(state.app_window.extent.y * 2.0) )
|
||||
ve.configure_snap( ve_ctx, u32(screen_size.x), u32(screen_size.y) )
|
||||
|
||||
Render_Debug:
|
||||
{
|
||||
@ -111,36 +102,26 @@ render_mode_2d_workspace :: proc()
|
||||
render_set_view_space(screen_extent)
|
||||
render_set_camera(cam)
|
||||
|
||||
ui := & project.workspace.ui
|
||||
ui_context = & project.workspace.ui
|
||||
|
||||
cam := cam
|
||||
when UI_Render_Method == .Layers {
|
||||
render_list := array_to_slice( ui.render_list )
|
||||
render_ui_via_box_list( render_list, & cam )
|
||||
}
|
||||
when UI_Render_Method == .Depth_First
|
||||
{
|
||||
render_ui_via_box_tree( ui.root, & cam )
|
||||
render_ui_via_box_tree( ui.root, screen_extent, ve_ctx, ve_render, & cam )
|
||||
}
|
||||
|
||||
ui_context = nil
|
||||
}
|
||||
|
||||
render_mode_screenspace :: proc()
|
||||
render_mode_screenspace :: proc( screen_extent : Extents2, screen_ui : ^UI_State, ve_ctx : ^ve.Context, ve_render : VE_RenderData, config : AppConfig, debug : ^DebugData )
|
||||
{
|
||||
profile(#procedure)
|
||||
state := get_state(); using state // TODO(Ed): Prefer passing static context to through the callstack
|
||||
replay := & Memory_App.replay
|
||||
cam := & project.workspace.cam
|
||||
win_extent := state.app_window.extent
|
||||
|
||||
screen_extent := app_window.extent
|
||||
screen_size := app_window.extent * 2
|
||||
screen_size := screen_extent * 2
|
||||
screen_ratio := screen_size.x * ( 1.0 / screen_size.y )
|
||||
|
||||
ve.configure_snap( & font_provider_data.ve_font_cache, u32(state.app_window.extent.x * 2.0), u32(state.app_window.extent.y * 2.0) )
|
||||
ve.configure_snap( ve_ctx, u32(screen_size.x), u32(screen_size.y) )
|
||||
|
||||
render_screen_ui()
|
||||
render_screen_ui( screen_extent, screen_ui, ve_ctx, ve_render )
|
||||
|
||||
Render_Reference_Dots:
|
||||
{
|
||||
@ -152,7 +133,7 @@ render_mode_screenspace :: proc()
|
||||
|
||||
Mouse_Position:
|
||||
{
|
||||
mouse_pos := input.mouse.pos
|
||||
mouse_pos := get_state().input.mouse.pos
|
||||
render_set_color( Color_White_A125 )
|
||||
draw_filled_circle( mouse_pos.x, mouse_pos.y, 4, 24 )
|
||||
}
|
||||
@ -163,6 +144,10 @@ render_mode_screenspace :: proc()
|
||||
debug.debug_text_vis = true
|
||||
if debug.debug_text_vis
|
||||
{
|
||||
state := get_state(); using state // TODO(Ed): Prefer passing static context to through the callstack
|
||||
replay := & Memory_App.replay
|
||||
cam := & project.workspace.cam
|
||||
|
||||
debug_draw_text :: proc( content : string, pos : Vec2, size : f32, color := Color_White, font : FontID = Font_Default )
|
||||
{
|
||||
state := get_state(); using state
|
||||
@ -271,7 +256,7 @@ render_mode_screenspace :: proc()
|
||||
}
|
||||
|
||||
if true {
|
||||
state.config.font_size_canvas_scalar = 1.0
|
||||
// state.config.font_size_canvas_scalar = 1
|
||||
zoom_adjust_size := 16 * state.project.workspace.cam.zoom
|
||||
over_sample := zoom_adjust_size < 12 ? 1.0 : f32(state.config.font_size_canvas_scalar)
|
||||
debug_text("font_size_canvas_scalar: %v", config.font_size_canvas_scalar)
|
||||
@ -279,64 +264,39 @@ render_mode_screenspace :: proc()
|
||||
debug_text("font_size resolved: %v px", resolved_size)
|
||||
}
|
||||
|
||||
render_text_layer()
|
||||
render_text_layer( screen_extent, ve_ctx, ve_render )
|
||||
}
|
||||
|
||||
debug.draw_debug_text_y = 14
|
||||
}
|
||||
|
||||
render_screen_ui :: proc()
|
||||
render_screen_ui :: proc( screen_extent : Extents2, ui : ^UI_State, ve_ctx : ^ve.Context, ve_render : VE_RenderData )
|
||||
{
|
||||
profile(#procedure)
|
||||
state := get_state(); using state // TODO(Ed): Prefer passing static context to through the callstack
|
||||
|
||||
screen_extent := app_window.extent
|
||||
screen_size := app_window.extent * 2
|
||||
screen_ratio := screen_size.x * ( 1.0 / screen_size.y )
|
||||
render_set_view_space(screen_extent)
|
||||
|
||||
ui := & screen_ui
|
||||
state.ui_context = & screen_ui
|
||||
|
||||
text_enqueued : b32 = false
|
||||
shape_enqueued : b32 = false
|
||||
|
||||
when UI_Render_Method == .Layers {
|
||||
render_list := array_to_slice( ui.render_list )
|
||||
render_ui_via_box_list( render_list )
|
||||
}
|
||||
when UI_Render_Method == .Depth_First
|
||||
{
|
||||
render_ui_via_box_tree( ui.root )
|
||||
render_ui_via_box_tree( ui.root, screen_extent, ve_ctx, ve_render )
|
||||
}
|
||||
|
||||
state.ui_context = nil
|
||||
}
|
||||
|
||||
render_text_layer :: proc()
|
||||
render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render : VE_RenderData )
|
||||
{
|
||||
profile("VEFontCache: render text layer")
|
||||
using render
|
||||
|
||||
Bindings :: gfx.Bindings
|
||||
Range :: gfx.Range
|
||||
ShaderStage :: gfx.Shader_Stage
|
||||
|
||||
state := get_state(); using state
|
||||
font_provider := & state.font_provider_data
|
||||
using font_provider
|
||||
|
||||
// TODO(Ed): All this functionality for being able to segregate rendering of the drawlist incrementally should be lifted to the library itself (VEFontCache)
|
||||
|
||||
ve.optimize_draw_list( & ve_font_cache.draw_list, calls_layer_offset )
|
||||
draw_list := ve.get_draw_list( & ve_font_cache )
|
||||
|
||||
draw_list_vert_slice := array_to_slice(draw_list.vertices)
|
||||
draw_list_index_slice := array_to_slice(draw_list.indices)
|
||||
draw_list_calls_slice := array_to_slice(draw_list.calls)
|
||||
|
||||
vbuf_layer_slice := draw_list_vert_slice [ vbuf_layer_offset : ]
|
||||
ibuf_layer_slice := draw_list_index_slice[ ibuf_layer_offset : ]
|
||||
calls_layer_slice := draw_list_calls_slice[ calls_layer_offset : ]
|
||||
vbuf_layer_slice, ibuf_layer_slice, calls_layer_slice := ve.get_draw_list_layer( ve_ctx )
|
||||
|
||||
vbuf_ve_range := Range{ raw_data(vbuf_layer_slice), cast(u64) len(vbuf_layer_slice) * size_of(ve.Vertex) }
|
||||
ibuf_ve_range := Range{ raw_data(ibuf_layer_slice), cast(u64) len(ibuf_layer_slice) * size_of(u32) }
|
||||
@ -344,9 +304,7 @@ render_text_layer :: proc()
|
||||
gfx.append_buffer( draw_list_vbuf, vbuf_ve_range )
|
||||
gfx.append_buffer( draw_list_ibuf, ibuf_ve_range )
|
||||
|
||||
vbuf_layer_offset = cast(u64) len(draw_list_vert_slice)
|
||||
ibuf_layer_offset = cast(u64) len(draw_list_index_slice)
|
||||
calls_layer_offset = cast(u64) len(draw_list_calls_slice)
|
||||
ve.flush_draw_list_layer( ve_ctx )
|
||||
|
||||
for & draw_call in calls_layer_slice
|
||||
{
|
||||
@ -365,8 +323,8 @@ render_text_layer :: proc()
|
||||
continue
|
||||
}
|
||||
|
||||
width := ve_font_cache.atlas.buffer_width
|
||||
height := ve_font_cache.atlas.buffer_height
|
||||
width := ve_ctx.atlas.buffer_width
|
||||
height := ve_ctx.atlas.buffer_height
|
||||
|
||||
pass := glyph_pass
|
||||
if draw_call.clear_before_draw {
|
||||
@ -401,8 +359,8 @@ render_text_layer :: proc()
|
||||
continue
|
||||
}
|
||||
|
||||
width := ve_font_cache.atlas.width
|
||||
height := ve_font_cache.atlas.height
|
||||
width := ve_ctx.atlas.width
|
||||
height := ve_ctx.atlas.height
|
||||
|
||||
pass := atlas_pass
|
||||
if draw_call.clear_before_draw {
|
||||
@ -443,13 +401,13 @@ render_text_layer :: proc()
|
||||
}
|
||||
|
||||
profile("VEFontCache: draw call: target")
|
||||
width := u32(app_window.extent.x * 2)
|
||||
height := u32(app_window.extent.y * 2)
|
||||
|
||||
pass := screen_pass
|
||||
pass.swapchain = sokol_glue.swapchain()
|
||||
gfx.begin_pass( pass )
|
||||
|
||||
// width := u32(screen_extent.x * 2)
|
||||
// height := u32(screen_extent.y * 2)
|
||||
// sokol_gfx.apply_viewport( 0, 0, width, height, origin_top_left = true )
|
||||
// sokol_gfx.apply_scissor_rect( 0, 0, width, height, origin_top_left = true )
|
||||
|
||||
@ -494,7 +452,7 @@ render_text_layer :: proc()
|
||||
}
|
||||
}
|
||||
|
||||
render_ui_via_box_tree :: proc( root : ^UI_Box, cam : ^Camera = nil )
|
||||
render_ui_via_box_tree :: proc( root : ^UI_Box, screen_extent : Vec2, ve_ctx : ^ve.Context, ve_render : VE_RenderData, cam : ^Camera = nil )
|
||||
{
|
||||
debug := get_state().debug
|
||||
default_font := get_state().default_font
|
||||
@ -510,7 +468,7 @@ render_ui_via_box_tree :: proc( root : ^UI_Box, cam : ^Camera = nil )
|
||||
{
|
||||
if box.ancestors != previous_layer {
|
||||
if shape_enqueued do render_flush_gp()
|
||||
if text_enqueued do render_text_layer()
|
||||
if text_enqueued do render_text_layer( screen_extent, ve_ctx, ve_render )
|
||||
shape_enqueued = false
|
||||
text_enqueued = false
|
||||
}
|
||||
@ -577,10 +535,10 @@ render_ui_via_box_tree :: proc( root : ^UI_Box, cam : ^Camera = nil )
|
||||
}
|
||||
|
||||
if shape_enqueued do render_flush_gp()
|
||||
if text_enqueued do render_text_layer()
|
||||
if text_enqueued do render_text_layer( screen_extent, ve_ctx, ve_render )
|
||||
}
|
||||
|
||||
render_ui_via_box_list :: proc( render_list : []UI_RenderBoxInfo, cam : ^Camera = nil )
|
||||
render_ui_via_box_list :: proc( render_list : []UI_RenderBoxInfo, screen_extent : Vec2, ve_ctx : ^ve.Context, ve_render : VE_RenderData, cam : ^Camera = nil )
|
||||
{
|
||||
debug := get_state().debug
|
||||
default_font := get_state().default_font
|
||||
@ -595,7 +553,7 @@ render_ui_via_box_list :: proc( render_list : []UI_RenderBoxInfo, cam : ^Camera
|
||||
{
|
||||
profile("render ui layer")
|
||||
render_flush_gp()
|
||||
if text_enqueued do render_text_layer()
|
||||
if text_enqueued do render_text_layer( screen_extent, ve_ctx, ve_render )
|
||||
continue
|
||||
}
|
||||
using entry
|
||||
@ -640,7 +598,7 @@ render_ui_via_box_list :: proc( render_list : []UI_RenderBoxInfo, cam : ^Camera
|
||||
}
|
||||
|
||||
if shape_enqueued do render_flush_gp()
|
||||
if text_enqueued do render_text_layer()
|
||||
if text_enqueued do render_text_layer( screen_extent, ve_ctx, ve_render )
|
||||
}
|
||||
|
||||
#region("Helpers")
|
||||
@ -705,8 +663,8 @@ draw_text_string_pos_norm :: proc( content : string, id : FontID, size : f32, po
|
||||
ve_id, resolved_size := font_provider_resolve_draw_id( id, size )
|
||||
color_norm := normalize_rgba8(color)
|
||||
|
||||
ve.set_colour( & font_provider_data.ve_font_cache, color_norm )
|
||||
ve.draw_text( & font_provider_data.ve_font_cache, ve_id, content, pos, Vec2{1 / width, 1 / height} * scale )
|
||||
ve.set_colour( & font_provider_ctx.ve_ctx, color_norm )
|
||||
ve.draw_text( & font_provider_ctx.ve_ctx, ve_id, content, pos, Vec2{1 / width, 1 / height} * scale )
|
||||
return
|
||||
}
|
||||
|
||||
@ -742,7 +700,7 @@ draw_text_string_pos_extent_zoomed :: proc( content : string, id : FontID, size
|
||||
zoom_adjust_size := size * cam.zoom
|
||||
|
||||
// Over-sample font-size for any render under a camera
|
||||
over_sample : f32 = zoom_adjust_size < 12 ? 1.0 : f32(state.config.font_size_canvas_scalar)
|
||||
over_sample : f32 = zoom_adjust_size <= 8 ? 1.0 : f32(state.config.font_size_canvas_scalar)
|
||||
zoom_adjust_size *= over_sample
|
||||
|
||||
ve_id, resolved_size := font_provider_resolve_draw_id( id, zoom_adjust_size )
|
||||
@ -761,8 +719,8 @@ draw_text_string_pos_extent_zoomed :: proc( content : string, id : FontID, size
|
||||
text_scale /= over_sample
|
||||
|
||||
color_norm := normalize_rgba8(color)
|
||||
ve.set_colour( & font_provider_data.ve_font_cache, color_norm )
|
||||
ve.draw_text( & font_provider_data.ve_font_cache, ve_id, content, normalized_pos, text_scale )
|
||||
ve.set_colour( & font_provider_ctx.ve_ctx, color_norm )
|
||||
ve.draw_text( & font_provider_ctx.ve_ctx, ve_id, content, normalized_pos, text_scale )
|
||||
}
|
||||
|
||||
// TODO(Ed): Eventually the workspace will need a viewport for drawing text
|
||||
|
@ -43,10 +43,6 @@ poll_debug_actions :: proc( actions : ^ DebugActions, input : ^ InputState )
|
||||
load_project = keyboard.left_control.ended_down && pressed( keyboard.O )
|
||||
save_project = keyboard.left_control.ended_down && pressed( keyboard.S )
|
||||
|
||||
base_replay_bind := keyboard.right_alt.ended_down && pressed( keyboard.L)
|
||||
record_replay = base_replay_bind && keyboard.right_shift.ended_down
|
||||
play_replay = base_replay_bind && ! keyboard.right_shift.ended_down
|
||||
|
||||
show_debug_text = keyboard.right_alt.ended_down && pressed(keyboard.T)
|
||||
show_mouse_pos = keyboard.right_alt.ended_down && pressed(keyboard.M)
|
||||
|
||||
@ -164,11 +160,11 @@ update :: proc( delta_time : f64 ) -> b32
|
||||
workspace.zoom_target = cam.zoom
|
||||
}
|
||||
|
||||
config.cam_max_zoom = 10
|
||||
config.cam_min_zoom = 0.05
|
||||
config.cam_zoom_sensitivity_digital = 0.05
|
||||
config.cam_zoom_sensitivity_smooth = 2.0
|
||||
config.cam_zoom_mode = .Smooth
|
||||
// config.cam_max_zoom = 10
|
||||
// config.cam_min_zoom = 0.05
|
||||
// config.cam_zoom_sensitivity_digital = 0.05
|
||||
// config.cam_zoom_sensitivity_smooth = 2.0
|
||||
// config.cam_zoom_mode = .Smooth
|
||||
switch config.cam_zoom_mode
|
||||
{
|
||||
case .Smooth:
|
||||
|
Reference in New Issue
Block a user