diff --git a/armorpaint/sources/ui_header_ext.ts b/armorpaint/sources/ui_header_ext.ts index 81cbc670..b0372fe0 100644 --- a/armorpaint/sources/ui_header_ext.ts +++ b/armorpaint/sources/ui_header_ext.ts @@ -6,7 +6,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { ui_text(tr("Picked Color")); if (context_raw.colorid_picked) { let rt: render_target_t = map_get(render_path_render_targets, "texpaint_colorid"); - _ui_image(rt._image, 0xffffffff, 64); + ui_image(rt._image, 0xffffffff, 64); } ui.enabled = context_raw.colorid_picked; if (ui_button(tr("Clear"))) { @@ -22,7 +22,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { context_raw.colorid_picked = false; ui_toolbar_handle.redraws = 1; } - _ui_image(project_get_image(project_assets[cid])); + ui_image(project_get_image(project_assets[cid])); if (ui.is_hovered) { ui_tooltip_image(project_get_image(project_assets[cid]), 256); } diff --git a/armorsculpt/sources/tab_layers.ts b/armorsculpt/sources/tab_layers.ts index ac0f4732..a5b65373 100644 --- a/armorsculpt/sources/tab_layers.ts +++ b/armorsculpt/sources/tab_layers.ts @@ -235,7 +235,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { col -= 0x99000000; } - if (_ui_image(icons, col, -1.0, r.x, r.y, r.w, r.h) == ui_state_t.RELEASED) { + if (ui_sub_image(icons, col, -1.0, r.x, r.y, r.w, r.h) == ui_state_t.RELEASED) { tab_layers_layer_toggle_visible(l); } ui._x -= 2; diff --git a/base/sources/iron_ui.c b/base/sources/iron_ui.c index e8aa96cb..686d1e2a 100644 --- a/base/sources/iron_ui.c +++ b/base/sources/iron_ui.c @@ -1667,7 +1667,7 @@ bool ui_window_dirty(ui_handle_t *handle, int x, int y, int w, int h) { return current->always_redraw || current->is_scrolling || input_changed; } -bool _ui_window(ui_handle_t *handle, int x, int y, int w, int h, bool drag) { +bool ui_window(ui_handle_t *handle, int x, int y, int w, int h, bool drag) { if (handle->texture.width == 0 || w != handle->texture.width || h != handle->texture.height) { ui_resize(handle, w, h); } @@ -2281,7 +2281,7 @@ void ui_tooltip_image(gpu_texture_t *image, int max_width) { current->tooltip_y = current->_y + current->_window_y; } -void _ui_end(bool last) { +void ui_end(bool last) { if (!current->window_ended) { ui_end_window(); } diff --git a/base/sources/iron_ui.h b/base/sources/iron_ui.h index e0e9112d..505bd6e7 100644 --- a/base/sources/iron_ui.h +++ b/base/sources/iron_ui.h @@ -275,7 +275,7 @@ void ui_begin_sticky(); void ui_end_sticky(); void ui_begin_region(ui_t *ui, int x, int y, int w); void ui_end_region(bool last); -bool _ui_window(ui_handle_t *handle, int x, int y, int w, int h, bool drag); // Returns true if redraw is needed +bool ui_window(ui_handle_t *handle, int x, int y, int w, int h, bool drag); // Returns true if redraw is needed bool ui_button(char *text, int align, char *label); int ui_text(char *text, int align, int bg); bool ui_tab(ui_handle_t *handle, char *text, bool vertical, uint32_t color); @@ -297,7 +297,7 @@ void ui_row7(); void ui_separator(int h, bool fill); void ui_tooltip(char *text); void ui_tooltip_image(gpu_texture_t *image, int max_width); -void _ui_end(bool last); +void ui_end(bool last); void ui_end_window(); char *ui_hovered_tab_name(); void ui_set_hovered_tab_name(char *name); diff --git a/base/sources/ts/box_projects.ts b/base/sources/ts/box_projects.ts index e425ebb1..4763e536 100644 --- a/base/sources/ts/box_projects.ts +++ b/base/sources/ts/box_projects.ts @@ -124,7 +124,7 @@ function box_projects_tab(ui: ui_t) { if (icon != null) { ui_fill(0, 0, 128, 128, ui.ops.theme.SEPARATOR_COL); - let state: i32 = _ui_image(icon, 0xffffffff, 128 * ui_SCALE(ui)); + let state: i32 = ui_image(icon, 0xffffffff, 128 * ui_SCALE(ui)); if (state == ui_state_t.RELEASED) { let _uix: i32 = ui._x; ui._x = uix; @@ -242,7 +242,7 @@ function box_projects_recent_tab(ui: ui_t) { function box_projects_draw_badge(ui: ui_t) { let img: gpu_texture_t = data_get_image("badge.k"); - _ui_image(img); + ui_image(img); _ui_end_element(); } diff --git a/base/sources/ts/import_envmap.ts b/base/sources/ts/import_envmap.ts index 22d6f57d..912a7fad 100644 --- a/base/sources/ts/import_envmap.ts +++ b/base/sources/ts/import_envmap.ts @@ -13,7 +13,7 @@ function import_envmap_run(path: string, image: gpu_texture_t) { import_envmap_pipeline = gpu_create_pipeline(); import_envmap_pipeline.vertex_shader = sys_get_shader("prefilter_envmap.vert"); import_envmap_pipeline.fragment_shader = sys_get_shader("prefilter_envmap.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); import_envmap_pipeline.input_layout = vs; import_envmap_pipeline.color_attachment_count = 1; diff --git a/base/sources/ts/iron/const_data.ts b/base/sources/ts/iron/const_data.ts index 5d39e7ab..4404aa52 100644 --- a/base/sources/ts/iron/const_data.ts +++ b/base/sources/ts/iron/const_data.ts @@ -9,7 +9,7 @@ function const_data_create_screen_aligned_data() { let data: f32[] = [-1.0, -1.0, 3.0, -1.0, -1.0, 3.0]; let indices: i32[] = [0, 1, 2]; - let structure: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let structure: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_2X); const_data_screen_aligned_vb = gpu_create_vertex_buffer(math_floor(data.length / math_floor(gpu_vertex_struct_size(structure) / 4)), structure); let vertices: buffer_t = gpu_lock_vertex_buffer(const_data_screen_aligned_vb); @@ -35,7 +35,7 @@ declare let _const_data_skydome_nor: f32_ptr; declare let _const_data_skydome_nor_count: i32; function const_data_create_skydome_data() { - let structure: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let structure: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_3X); gpu_vertex_struct_add(structure, "nor", vertex_data_t.F32_3X); let struct_length: i32 = math_floor(gpu_vertex_struct_size(structure) / 4); diff --git a/base/sources/ts/iron/iron.ts b/base/sources/ts/iron/iron.ts index 75f9fa82..7b5c19aa 100644 --- a/base/sources/ts/iron/iron.ts +++ b/base/sources/ts/iron/iron.ts @@ -569,12 +569,6 @@ type vec4_box_t = { declare function f32_nan(): f32; declare function f32_isnan(f: f32): bool; - -function gpu_vertex_struct_create(): gpu_vertex_structure_t { - let raw: gpu_vertex_structure_t = {}; - return raw; -} - function gpu_vertex_struct_add(raw: gpu_vertex_structure_t, name: string, data: vertex_data_t) { let e: gpu_vertex_element_t = ADDRESS(ARRAY_ACCESS(raw.elements, raw.size)); e.name = name; @@ -589,25 +583,20 @@ declare type gpu_pipeline_t = { input_layout?: any; vertex_shader?: any; fragment_shader?: any; - cull_mode?: cull_mode_t; depth_write?: bool; depth_mode?: compare_mode_t; - blend_source?: blend_factor_t; blend_destination?: blend_factor_t; alpha_blend_source?: blend_factor_t; alpha_blend_destination?: blend_factor_t; - color_write_mask_red?: any; color_write_mask_green?: any; color_write_mask_blue?: any; color_write_mask_alpha?: any; - color_attachment?: any; color_attachment_count?: i32; depth_attachment_bits?: i32; - impl?: any; }; @@ -721,9 +710,7 @@ declare function ui_tooltip(s: string): void; declare function ui_tooltip_image(tex: any, max_width: i32 = 0): void; declare function ui_separator(h: i32 = 4, fill: bool = true): void; declare function ui_text_area(handle: ui_handle_t, align: ui_align_t = ui_align_t.LEFT, editable: bool = true, label: string = "", word_wrap: bool = false): string; -declare function _ui_window(handle: ui_handle_t, x: i32, y: i32, w: i32, h: i32, drag: bool = false): bool; declare function ui_begin(ui: ui_t): void; -declare function _ui_end(last: bool = true): void; declare function ui_end_window(): void; declare function ui_end_region(last: bool = true): void; declare function ui_float_input(handle: ui_handle_t, label: string = "", align: ui_align_t = ui_align_t.LEFT, precision: f32 = 1000.0): f32; @@ -951,11 +938,15 @@ enum ui_state_t { HOVERED, } -let ui_children: map_t = map_create(); -let ui_nodes_custom_buttons: map_tvoid> = map_create(); - declare function UI_OUTPUTS_H(sockets_count: i32, length: i32 = -1): f32; declare function ui_tooltip_image(image: gpu_texture_t, max_width: i32 = 0); +declare function ui_image(image: gpu_texture_t, tint: i32 = 0xffffffff, h: f32 = -1.0): ui_state_t; +declare function ui_sub_image(image: gpu_texture_t, tint: i32 = 0xffffffff, h: f32 = -1.0, sx: i32 = 0, sy: i32 = 0, sw: i32 = 0, sh: i32 = 0): ui_state_t; +declare function ui_window(handle: ui_handle_t, x: i32, y: i32, w: i32, h: i32, drag: bool = false): bool; +declare function ui_end(last: bool = true); + +let ui_children: map_t = map_create(); +let ui_nodes_custom_buttons: map_tvoid> = map_create(); function ui_SCALE(ui: ui_t): f32 { let current: ui_t = ui_get_current(); @@ -998,18 +989,6 @@ function ui_nodes_INPUT_Y(canvas: ui_node_canvas_t, sockets: ui_node_socket_t[], return UI_INPUT_Y(canvas, sockets.buffer, sockets.length, pos); } -function _ui_image(image: gpu_texture_t, tint: i32 = 0xffffffff, h: f32 = -1.0, sx: i32 = 0, sy: i32 = 0, sw: i32 = 0, sh: i32 = 0): ui_state_t { - return ui_sub_image(image, tint, h, sx, sy, sw, sh); -} - -function ui_window(handle: ui_handle_t, x: i32, y: i32, w: i32, h: i32, drag: bool = false): bool { - return _ui_window(handle, x, y, w, h, drag); -} - -function ui_end(last: bool = true) { - _ui_end(last); -} - function _ui_set_scale(ui: ui_t, factor: f32) { let current: ui_t = ui_get_current(); ui_set_current(ui); diff --git a/base/sources/ts/iron/mesh_data.ts b/base/sources/ts/iron/mesh_data.ts index fdf06a5e..0742f2bd 100644 --- a/base/sources/ts/iron/mesh_data.ts +++ b/base/sources/ts/iron/mesh_data.ts @@ -105,7 +105,7 @@ function mesh_data_create(raw: mesh_data_t): mesh_data_t { } function mesh_data_get_vertex_struct(vertex_arrays: vertex_array_t[]): gpu_vertex_structure_t { - let structure: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let structure: gpu_vertex_structure_t = {}; for (let i: i32 = 0; i < vertex_arrays.length; ++i) { gpu_vertex_struct_add(structure, vertex_arrays[i].attrib, mesh_data_get_vertex_data(vertex_arrays[i].data)); } diff --git a/base/sources/ts/iron/shader_data.ts b/base/sources/ts/iron/shader_data.ts index a2a732b9..414238ef 100644 --- a/base/sources/ts/iron/shader_data.ts +++ b/base/sources/ts/iron/shader_data.ts @@ -264,7 +264,7 @@ function shader_context_parse_data(data: string): vertex_data_t { } function shader_context_parse_vertex_struct(raw: shader_context_t) { - raw._.structure = gpu_vertex_struct_create(); + raw._.structure = {}; for (let i: i32 = 0; i < raw.vertex_elements.length; ++i) { let elem: vertex_element_t = raw.vertex_elements[i]; diff --git a/base/sources/ts/line_draw.ts b/base/sources/ts/line_draw.ts index 7245730d..b7983dc5 100644 --- a/base/sources/ts/line_draw.ts +++ b/base/sources/ts/line_draw.ts @@ -40,7 +40,7 @@ let line_draw_camera_look: vec4_t = vec4_create(); function line_draw_init() { if (line_draw_pipeline == null) { - let structure: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let structure: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_3X); line_draw_pipeline = gpu_create_pipeline(); line_draw_pipeline.input_layout = structure; @@ -62,7 +62,7 @@ function line_draw_init() { line_draw_index_buffer = gpu_create_index_buffer(line_draw_max_indices); } if (line_draw_overlay_pipeline == null) { - let structure: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let structure: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_3X); line_draw_overlay_pipeline = gpu_create_pipeline(); line_draw_overlay_pipeline.input_layout = structure; @@ -259,7 +259,7 @@ function shape_draw_sphere(mat: mat4_t) { let md: mesh_data_t = sphere.data; let posa: i16_array_t = md.vertex_arrays[0].values; - let structure: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let structure: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(structure, "pos", vertex_data_t.F32_3X); _shape_draw_sphere_vb = gpu_create_vertex_buffer(posa.length, structure); let data: buffer_t = gpu_lock_vertex_buffer(_shape_draw_sphere_vb); diff --git a/base/sources/ts/pipes.ts b/base/sources/ts/pipes.ts index 3286a2ac..361e3f4a 100644 --- a/base/sources/ts/pipes.ts +++ b/base/sources/ts/pipes.ts @@ -57,7 +57,7 @@ function _pipes_make_merge(red: bool, green: bool, blue: bool, alpha: bool): gpu let pipe: gpu_pipeline_t = gpu_create_pipeline(); pipe.vertex_shader = sys_get_shader("layer_merge.vert"); pipe.fragment_shader = sys_get_shader("layer_merge.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipe.input_layout = vs; ARRAY_ACCESS(pipe.color_write_mask_red, 0) = red; @@ -88,7 +88,7 @@ function pipes_init() { pipes_copy = gpu_create_pipeline(); pipes_copy.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy.fragment_shader = sys_get_shader("layer_copy.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_copy.input_layout = vs; gpu_pipeline_compile(pipes_copy); @@ -98,7 +98,7 @@ function pipes_init() { pipes_copy_bgra = gpu_create_pipeline(); pipes_copy_bgra.vertex_shader = sys_get_shader("layer_copy_bgra.vert"); pipes_copy_bgra.fragment_shader = sys_get_shader("layer_copy_bgra.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_copy_bgra.input_layout = vs; gpu_pipeline_compile(pipes_copy_bgra); @@ -108,7 +108,7 @@ function pipes_init() { pipes_copy8 = gpu_create_pipeline(); pipes_copy8.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy8.fragment_shader = sys_get_shader("layer_copy.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_copy8.input_layout = vs; pipes_copy8.color_attachment_count = 1; @@ -120,7 +120,7 @@ function pipes_init() { pipes_copy64 = gpu_create_pipeline(); pipes_copy64.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy64.fragment_shader = sys_get_shader("layer_copy.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_copy64.input_layout = vs; pipes_copy64.color_attachment_count = 1; @@ -132,7 +132,7 @@ function pipes_init() { pipes_copy128 = gpu_create_pipeline(); pipes_copy128.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy128.fragment_shader = sys_get_shader("layer_copy.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_copy128.input_layout = vs; pipes_copy128.color_attachment_count = 1; @@ -145,7 +145,7 @@ function pipes_init() { pipes_invert8 = gpu_create_pipeline(); pipes_invert8.vertex_shader = sys_get_shader("layer_invert.vert"); pipes_invert8.fragment_shader = sys_get_shader("layer_invert.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_invert8.input_layout = vs; pipes_invert8.color_attachment_count = 1; @@ -157,7 +157,7 @@ function pipes_init() { pipes_apply_mask = gpu_create_pipeline(); pipes_apply_mask.vertex_shader = sys_get_shader("mask_apply.vert"); pipes_apply_mask.fragment_shader = sys_get_shader("mask_apply.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_apply_mask.input_layout = vs; gpu_pipeline_compile(pipes_apply_mask); @@ -169,7 +169,7 @@ function pipes_init() { pipes_merge_mask = gpu_create_pipeline(); pipes_merge_mask.vertex_shader = sys_get_shader("mask_merge.vert"); pipes_merge_mask.fragment_shader = sys_get_shader("mask_merge.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_merge_mask.input_layout = vs; gpu_pipeline_compile(pipes_merge_mask); @@ -184,7 +184,7 @@ function pipes_init() { pipes_colorid_to_mask = gpu_create_pipeline(); pipes_colorid_to_mask.vertex_shader = sys_get_shader("mask_colorid.vert"); pipes_colorid_to_mask.fragment_shader = sys_get_shader("mask_colorid.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_colorid_to_mask.input_layout = vs; gpu_pipeline_compile(pipes_colorid_to_mask); @@ -198,7 +198,7 @@ function pipes_init() { pipes_copy_r = gpu_create_pipeline(); pipes_copy_r.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy_r.fragment_shader = sys_get_shader("layer_copy.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_copy_r.input_layout = vs; ARRAY_ACCESS(pipes_copy_r.color_write_mask_green, 0) = false; @@ -211,7 +211,7 @@ function pipes_init() { pipes_copy_g = gpu_create_pipeline(); pipes_copy_g.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy_g.fragment_shader = sys_get_shader("layer_copy.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_copy_g.input_layout = vs; ARRAY_ACCESS(pipes_copy_g.color_write_mask_red, 0) = false; @@ -224,7 +224,7 @@ function pipes_init() { pipes_inpaint_preview = gpu_create_pipeline(); pipes_inpaint_preview.vertex_shader = sys_get_shader("inpaint_preview.vert"); pipes_inpaint_preview.fragment_shader = sys_get_shader("inpaint_preview.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_inpaint_preview.input_layout = vs; gpu_pipeline_compile(pipes_inpaint_preview); @@ -236,7 +236,7 @@ function pipes_init() { pipes_copy_a = gpu_create_pipeline(); pipes_copy_a.vertex_shader = sys_get_shader("layer_copy_rrrr.vert"); pipes_copy_a.fragment_shader = sys_get_shader("layer_copy_rrrr.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_copy_a.input_layout = vs; ARRAY_ACCESS(pipes_copy_a.color_write_mask_red, 0) = false; @@ -251,7 +251,7 @@ function pipes_init() { pipes_copy_rgb = gpu_create_pipeline(); pipes_copy_rgb.vertex_shader = sys_get_shader("layer_copy.vert"); pipes_copy_rgb.fragment_shader = sys_get_shader("layer_copy.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); pipes_copy_rgb.input_layout = vs; ARRAY_ACCESS(pipes_copy_rgb.color_write_mask_alpha, 0) = false; @@ -262,7 +262,7 @@ function pipes_init() { pipes_cursor = gpu_create_pipeline(); pipes_cursor.vertex_shader = sys_get_shader("cursor.vert"); pipes_cursor.fragment_shader = sys_get_shader("cursor.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.I16_4X_NORM); gpu_vertex_struct_add(vs, "nor", vertex_data_t.I16_2X_NORM); gpu_vertex_struct_add(vs, "tex", vertex_data_t.I16_2X_NORM); diff --git a/base/sources/ts/tab_brushes.ts b/base/sources/ts/tab_brushes.ts index 30e18d89..24d0d82d 100644 --- a/base/sources/ts/tab_brushes.ts +++ b/base/sources/ts/tab_brushes.ts @@ -71,7 +71,7 @@ function tab_brushes_draw(htab: ui_handle_t) { let uix: f32 = ui._x; //let uiy: f32 = ui._y; let tile: i32 = ui_SCALE(ui) > 1 ? 100 : 50; - let state: ui_state_t = project_brushes[i].preview_ready ? _ui_image(img) : _ui_image(resource_get("icons.k"), -1, -1.0, tile * 5, tile, tile, tile); + let state: ui_state_t = project_brushes[i].preview_ready ? ui_image(img) : ui_sub_image(resource_get("icons.k"), -1, -1.0, tile * 5, tile, tile, tile); if (state == ui_state_t.STARTED) { if (context_raw.brush != project_brushes[i]) { context_select_brush(i); diff --git a/base/sources/ts/tab_fonts.ts b/base/sources/ts/tab_fonts.ts index c1be7bb7..ec8544be 100644 --- a/base/sources/ts/tab_fonts.ts +++ b/base/sources/ts/tab_fonts.ts @@ -81,11 +81,11 @@ function tab_fonts_draw(htab: ui_handle_t) { if (project_fonts[i].preview_ready) { // draw_set_pipeline(pipe); // L8 // gpu_set_int(channel_location, 1); - state = _ui_image(img); + state = ui_image(img); // draw_set_pipeline(null); } else { - state = _ui_image(resource_get("icons.k"), -1, -1.0, tile * 6, tile, tile, tile); + state = ui_sub_image(resource_get("icons.k"), -1, -1.0, tile * 6, tile, tile, tile); } if (state == ui_state_t.STARTED) { diff --git a/base/sources/ts/tab_layers.ts b/base/sources/ts/tab_layers.ts index d02a1602..7e2a4517 100644 --- a/base/sources/ts/tab_layers.ts +++ b/base/sources/ts/tab_layers.ts @@ -364,7 +364,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { col -= 0x99000000; } - if (_ui_image(icons, col, -1.0, r.x, r.y, r.w, r.h) == ui_state_t.RELEASED) { + if (ui_sub_image(icons, col, -1.0, r.x, r.y, r.w, r.h) == ui_state_t.RELEASED) { tab_layers_layer_toggle_visible(l); } ui._x -= 2; @@ -653,7 +653,7 @@ function tab_layers_draw_layer_icon(l: slot_layer_t, i: i32, uix: f32, uiy: f32, let _x: f32 = ui._x; let _y: f32 = ui._y; let _w: f32 = ui._w; - _ui_image(icons, 0xffffffff, icon_h, r.x, r.y, r.w, r.h); + ui_sub_image(icons, 0xffffffff, icon_h, r.x, r.y, r.w, r.h); ui.current_ratio--; ui._x = _x; ui._y = _y; @@ -664,7 +664,7 @@ function tab_layers_draw_layer_icon(l: slot_layer_t, i: i32, uix: f32, uiy: f32, gpu_set_int(ui_view2d_channel_loc, 1); } - let state: ui_state_t = _ui_image(icon, 0xffffffff, icon_h); + let state: ui_state_t = ui_image(icon, 0xffffffff, icon_h); if (l.fill_layer == null && slot_layer_is_mask(l)) { draw_set_pipeline(null); @@ -690,7 +690,7 @@ function tab_layers_draw_layer_icon(l: slot_layer_t, i: i32, uix: f32, uiy: f32, let folder_closed: rect_t = resource_tile50(icons, 2, 1); let folder_open: rect_t = resource_tile50(icons, 8, 1); let folder: rect_t = l.show_panel ? folder_open : folder_closed; - return _ui_image(icons, ui.ops.theme.LABEL_COL - 0x00202020, icon_h, folder.x, folder.y, folder.w, folder.h); + return ui_sub_image(icons, ui.ops.theme.LABEL_COL - 0x00202020, icon_h, folder.x, folder.y, folder.w, folder.h); } } diff --git a/base/sources/ts/tab_materials.ts b/base/sources/ts/tab_materials.ts index d3e3ac4a..8b214b7c 100644 --- a/base/sources/ts/tab_materials.ts +++ b/base/sources/ts/tab_materials.ts @@ -108,8 +108,8 @@ function tab_materials_draw_slots(mini: bool) { let tile: i32 = ui_SCALE(ui) > 1 ? 100 : 50; let imgh: f32 = mini ? ui_base_default_sidebar_mini_w * 0.85 * ui_SCALE(ui) : -1.0; let state: ui_state_t = project_materials[i].preview_ready ? - _ui_image(img, 0xffffffff, imgh) : - _ui_image(resource_get("icons.k"), 0xffffffff, -1.0, tile, tile, tile, tile); + ui_image(img, 0xffffffff, imgh) : + ui_sub_image(resource_get("icons.k"), 0xffffffff, -1.0, tile, tile, tile, tile); // Draw material numbers when selecting a material via keyboard shortcut let is_typing: bool = ui.is_typing || ui_view2d_ui.is_typing || ui_nodes_ui.is_typing; diff --git a/base/sources/ts/tab_plugins.ts b/base/sources/ts/tab_plugins.ts index 8f66e8ff..12dea39e 100644 --- a/base/sources/ts/tab_plugins.ts +++ b/base/sources/ts/tab_plugins.ts @@ -35,7 +35,7 @@ function tab_plugins_draw(htab: ui_handle_t) { for (let i: i32 = 0; i < rt_keys.length; ++i) { let rt: render_target_t = map_get(render_path_render_targets, rt_keys[i]); ui_text(rt_keys[i]); - _ui_image(rt._image); + ui_image(rt._image); } ///end } diff --git a/base/sources/ts/tab_swatches.ts b/base/sources/ts/tab_swatches.ts index 6a60cc97..2ccd2f5a 100644 --- a/base/sources/ts/tab_swatches.ts +++ b/base/sources/ts/tab_swatches.ts @@ -121,7 +121,7 @@ function tab_swatches_draw(htab: ui_handle_t) { ui_fill(-1, -2 , 2, 32, ui.ops.theme.HIGHLIGHT_COL); } - let state: ui_state_t = _ui_image(tab_swatches_empty_get(), project_raw.swatches[i].base, slotw); + let state: ui_state_t = ui_image(tab_swatches_empty_get(), project_raw.swatches[i].base, slotw); if (state == ui_state_t.STARTED) { context_set_swatch(project_raw.swatches[i]); diff --git a/base/sources/ts/tab_textures.ts b/base/sources/ts/tab_textures.ts index 0dbe0a8d..f2f32717 100644 --- a/base/sources/ts/tab_textures.ts +++ b/base/sources/ts/tab_textures.ts @@ -86,7 +86,7 @@ function tab_textures_draw(htab: ui_handle_t) { let uix: f32 = ui._x; let uiy: f32 = ui._y; let sw: i32 = img.height < img.width ? img.height : 0; - if (_ui_image(img, 0xffffffff, slotw, 0, 0, sw, sw) == ui_state_t.STARTED && ui.input_y > ui._window_y) { + if (ui_sub_image(img, 0xffffffff, slotw, 0, 0, sw, sw) == ui_state_t.STARTED && ui.input_y > ui._window_y) { base_drag_off_x = -(mouse_x - uix - ui._window_x - 3); base_drag_off_y = -(mouse_y - uiy - ui._window_y + 1); base_drag_asset = asset; @@ -222,7 +222,7 @@ function tab_textures_draw(htab: ui_handle_t) { else { let img: gpu_texture_t = resource_get("icons.k"); let r: rect_t = resource_tile50(img, 0, 1); - _ui_image(img, ui.ops.theme.BUTTON_COL, r.h, r.x, r.y, r.w, r.h); + ui_sub_image(img, ui.ops.theme.BUTTON_COL, r.h, r.x, r.y, r.w, r.h); if (ui.is_hovered) { ui_tooltip(tr("Drag and drop files here")); } diff --git a/base/sources/ts/ui_files.ts b/base/sources/ts/ui_files.ts index ea24310f..b6e9ce1b 100644 --- a/base/sources/ts/ui_files.ts +++ b/base/sources/ts/ui_files.ts @@ -240,7 +240,7 @@ function ui_files_file_browser(ui: ui_t, handle: ui_handle_t, drag_files: bool = ui_fill(-2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); ui_fill(w + 2 , -2, 2, w + 6, ui.ops.theme.HIGHLIGHT_COL); } - state = _ui_image(icon, 0xffffffff, w * ui_SCALE(ui)); + state = ui_image(icon, 0xffffffff, w * ui_SCALE(ui)); if (ui.is_hovered) { ui_tooltip_image(icon); ui_tooltip(f); @@ -293,7 +293,7 @@ function ui_files_file_browser(ui: ui_t, handle: ui_handle_t, drag_files: bool = ui_fill(-2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); ui_fill(w + 2 , -2, 2, w + 6, ui.ops.theme.HIGHLIGHT_COL); } - state = _ui_image(icon, 0xffffffff, w * ui_SCALE(ui)); + state = ui_image(icon, 0xffffffff, w * ui_SCALE(ui)); if (ui.is_hovered) { ui_tooltip_image(icon); ui_tooltip(f); @@ -329,13 +329,13 @@ function ui_files_file_browser(ui: ui_t, handle: ui_handle_t, drag_files: bool = ui_fill(-2, 0, 2, w + 4, ui.ops.theme.HIGHLIGHT_COL); ui_fill(w + 2 , -2, 2, w + 6, ui.ops.theme.HIGHLIGHT_COL); } - state = _ui_image(icon, 0xffffffff, icon.height * ui_SCALE(ui)); + state = ui_image(icon, 0xffffffff, icon.height * ui_SCALE(ui)); generic = false; } } if (generic) { - state = _ui_image(icons, col, 50 * ui_SCALE(ui), rect.x, rect.y, rect.w, rect.h); + state = ui_sub_image(icons, col, 50 * ui_SCALE(ui), rect.x, rect.y, rect.w, rect.h); } if (ui.is_hovered && ui.input_released_r && context_menu != null) { diff --git a/base/sources/ts/ui_menu.ts b/base/sources/ts/ui_menu.ts index 000446b3..a89b5d92 100644 --- a/base/sources/ts/ui_menu.ts +++ b/base/sources/ts/ui_menu.ts @@ -530,7 +530,7 @@ function ui_menu_render() { if (ui_tab(ui_handle(__ID__), tr("About"), tab_vertical)) { let img: gpu_texture_t = data_get_image("badge.k"); - _ui_image(img); + ui_image(img); _ui_end_element(); let h: ui_handle_t = ui_handle(__ID__); diff --git a/base/sources/ts/ui_menubar.ts b/base/sources/ts/ui_menubar.ts index d24fa936..a00432ec 100644 --- a/base/sources/ts/ui_menubar.ts +++ b/base/sources/ts/ui_menubar.ts @@ -233,5 +233,5 @@ function ui_menubar_icon_button(ui: ui_t, i: i32, j: i32): bool { let icon_accent: i32 = light ? 0xff666666 : 0xffaaaaaa; let img: gpu_texture_t = resource_get("icons.k"); let rect: rect_t = resource_tile50(img, i, j); - return _ui_image(img, icon_accent, -1.0, rect.x, rect.y, rect.w, rect.h) == ui_state_t.RELEASED; + return ui_sub_image(img, icon_accent, -1.0, rect.x, rect.y, rect.w, rect.h) == ui_state_t.RELEASED; } diff --git a/base/sources/ts/ui_toolbar.ts b/base/sources/ts/ui_toolbar.ts index a221bbec..d033f281 100644 --- a/base/sources/ts/ui_toolbar.ts +++ b/base/sources/ts/ui_toolbar.ts @@ -39,7 +39,7 @@ function ui_toolbar_draw_tool(i: i32, ui: ui_t, img: gpu_texture_t, icon_accent: let rect: rect_t = resource_tile50(img, tile_x, tile_y); let _y: i32 = ui._y; - let image_state: ui_state_t = _ui_image(img, icon_accent, -1.0, rect.x, rect.y, rect.w, rect.h); + let image_state: ui_state_t = ui_sub_image(img, icon_accent, -1.0, rect.x, rect.y, rect.w, rect.h); if (image_state == ui_state_t.STARTED) { _ui_toolbar_i = i; sys_notify_on_next_frame(function() { @@ -115,7 +115,7 @@ function ui_toolbar_render_ui() { // Properties icon if (config_raw.layout[layout_size_t.HEADER] == 1) { let rect: rect_t = resource_tile50(img, 7, 1); - if (_ui_image(img, light ? 0xff666666 : ui.ops.theme.BUTTON_COL, -1.0, rect.x, rect.y, rect.w, rect.h) == ui_state_t.RELEASED) { + if (ui_sub_image(img, light ? 0xff666666 : ui.ops.theme.BUTTON_COL, -1.0, rect.x, rect.y, rect.w, rect.h) == ui_state_t.RELEASED) { config_raw.layout[layout_size_t.HEADER] = 0; } } diff --git a/base/sources/ts/ui_view2d.ts b/base/sources/ts/ui_view2d.ts index 19bc7065..49ad2790 100644 --- a/base/sources/ts/ui_view2d.ts +++ b/base/sources/ts/ui_view2d.ts @@ -35,7 +35,7 @@ function ui_view2d_init() { ui_view2d_pipe = gpu_create_pipeline(); ui_view2d_pipe.vertex_shader = sys_get_shader("layer_view.vert"); ui_view2d_pipe.fragment_shader = sys_get_shader("layer_view.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_2X); ui_view2d_pipe.input_layout = vs; ui_view2d_pipe.blend_source = blend_factor_t.BLEND_ONE; diff --git a/base/sources/ts/util_render.ts b/base/sources/ts/util_render.ts index 65969e08..83d3b579 100644 --- a/base/sources/ts/util_render.ts +++ b/base/sources/ts/util_render.ts @@ -448,7 +448,7 @@ function util_render_create_screen_aligned_full_data() { let indices: u32[] = [0, 1, 2]; // Mandatory vertex data names and sizes - let structure: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let structure: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(structure, "pos", vertex_data_t.I16_4X_NORM); gpu_vertex_struct_add(structure, "nor", vertex_data_t.I16_2X_NORM); gpu_vertex_struct_add(structure, "tex", vertex_data_t.I16_2X_NORM); diff --git a/base/sources/ts/util_uv.ts b/base/sources/ts/util_uv.ts index 0df48d3d..8473b3d3 100644 --- a/base/sources/ts/util_uv.ts +++ b/base/sources/ts/util_uv.ts @@ -107,7 +107,7 @@ function util_uv_cache_dilate_map() { util_uv_pipe_dilate = gpu_create_pipeline(); util_uv_pipe_dilate.vertex_shader = sys_get_shader("dilate_map.vert"); util_uv_pipe_dilate.fragment_shader = sys_get_shader("dilate_map.frag"); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.I16_4X_NORM); gpu_vertex_struct_add(vs, "nor", vertex_data_t.I16_2X_NORM); gpu_vertex_struct_add(vs, "tex", vertex_data_t.I16_2X_NORM); diff --git a/base/tests/triangle/main.ts b/base/tests/triangle/main.ts index 216abb22..2df8d2cd 100644 --- a/base/tests/triangle/main.ts +++ b/base/tests/triangle/main.ts @@ -31,7 +31,7 @@ function main() { _iron_init(ops); pipeline = gpu_create_pipeline(); - let vs: gpu_vertex_structure_t = gpu_vertex_struct_create(); + let vs: gpu_vertex_structure_t = {}; gpu_vertex_struct_add(vs, "pos", vertex_data_t.F32_3X); let vs_buffer: buffer_t = iron_load_blob("./data/test.vert" + sys_shader_ext()); let fs_buffer: buffer_t = iron_load_blob("./data/test.frag" + sys_shader_ext());