diff --git a/base/sources/backends/data/wasm/start.js b/base/sources/backends/data/wasm/start.js index 0362ef7d..709eec64 100644 --- a/base/sources/backends/data/wasm/start.js +++ b/base/sources/backends/data/wasm/start.js @@ -62,6 +62,15 @@ function id_to_texture_format(id) { return "depth32float"; if (id === 0x0000001B) return "bgra8unorm"; + if (id === 0x00000028) + return "rgba16float"; + if (id === 0x00000029) + return "rgba16float"; + // return "rgba32float"; // Total color attachment bytes per sample (48) exceeds maximum (32) + if (id === 0x00000009) + return "r16float"; + if (id === 0x0000000E) + return "r32float"; } function id_to_vertex_format(id) { @@ -79,11 +88,33 @@ function id_to_vertex_format(id) { return "snorm16x4"; } +function id_to_blend_factor(id) { + if (id === 0x00000001) + return "zero"; + if (id === 0x00000002) + return "one"; + if (id === 0x00000005) + return "src-alpha"; + if (id === 0x00000009) + return "dst-alpha"; + if (id === 0x00000006) + return "one-minus-src-alpha"; + if (id === 0x0000000A) + return "one-minus-dst-alpha"; +} + +function id_to_filter_mode(id) { + if (id === 0x00000001) + return "nearest"; + if (id === 0x00000002) + return "linear"; +} + async function init() { let wasm_bytes = null; await fetch("./start.wasm").then(res => res.arrayBuffer()).then(buffer => wasm_bytes = new Uint8Array(buffer)); - memory = new WebAssembly.Memory({initial : 8192, maximum : 8192, shared : true}); // * 65536 = 536870912 (make.js --initial-memory) + memory = new WebAssembly.Memory({initial : 10240, maximum : 10240, shared : true}); // * 65536 = 671088640 (make.js --initial-memory) heapu8 = new Uint8Array(memory.buffer); heapu16 = new Uint16Array(memory.buffer); heapu32 = new Uint32Array(memory.buffer); @@ -184,6 +215,8 @@ async function init() { e.sampler = {type : read_u32(i * 88 + pentries + 52)}; if (e.sampler.type === 0x00000002) e.sampler.type = "filtering"; + else if (e.sampler.type === 0x00000003) + e.sampler.type = "non-filtering"; } if (read_u32(i * 88 + pentries + 60) != 0x00000000) { // WGPUTextureSampleType_BindingNotUsed @@ -194,6 +227,10 @@ async function init() { }; if (e.texture.sampleType === 0x00000002) e.texture.sampleType = "float"; + else if (e.texture.sampleType === 0x00000003) + e.texture.sampleType = "unfilterable-float"; + else if (e.texture.sampleType === 0x00000004) + e.texture.sampleType = "depth"; } desc.entries.push(e); @@ -272,9 +309,9 @@ async function init() { addressModeU : "repeat", addressModeV : "repeat", addressModeW : "repeat", - magFilter : "linear", - minFilter : "linear", - mipmapFilter : "linear", + magFilter : id_to_filter_mode(read_u32(pdescriptor + 24)), + minFilter : id_to_filter_mode(read_u32(pdescriptor + 28)), + mipmapFilter : id_to_filter_mode(read_u32(pdescriptor + 32)), maxAnisotropy : 1 }; let sampler = device.createSampler(desc); @@ -304,7 +341,7 @@ async function init() { // WGPURenderPassColorAttachment let ca = { view : id_to_ptr(read_u32(pcas + 4 + i * 56)), - loadOp : "clear", + loadOp : read_u32(pcas + 16 + i * 56) == 0x00000001 ? "load" : "clear", storeOp : "store", clearValue : [ read_f64(pcas + 24 + i * 56), read_f64(pcas + 32 + i * 56), read_f64(pcas + 40 + i * 56), read_f64(pcas + 48 + i * 56) ] }; @@ -314,7 +351,7 @@ async function init() { // WGPURenderPassDepthStencilAttachment let pdsa = read_u32(pdescriptor + 20); if (pdsa !== 0) { - desc.depthStencilAttachment = {view : id_to_ptr(read_u32(pdsa + 4)), depthLoadOp : "clear", depthStoreOp : "store", depthClearValue : 1.0}; + desc.depthStencilAttachment = {view : id_to_ptr(read_u32(pdsa + 4)), depthLoadOp : read_u32(pdsa + 8) == 0x00000001 ? "load" : "clear", depthStoreOp : "store", depthClearValue : 1.0}; } let render_pass = encoder.beginRenderPass(desc); @@ -428,39 +465,44 @@ async function init() { // WGPUFragmentState let pfrag = read_u32(pdescriptor + 92); - let frag = {module : id_to_ptr(read_u32(pfrag + 4)), entryPoint : "main", targetCount : 1, targets : []}; + let frag = {module : id_to_ptr(read_u32(pfrag + 4)), entryPoint : "main", targetCount : read_u32(pfrag + 24), targets : []}; let ptragets = read_u32(pfrag + 28); for (let i = 0; i < frag.targetCount; ++i) { // WGPUColorTargetState let t = { format : id_to_texture_format(read_u32(ptragets + 4 + i * 24)), - blend : { - color : {operation : "add", srcFactor : "one", dstFactor : "zero"}, - alpha : {operation : "add", srcFactor : "one", dstFactor : "zero"} - }, writeMask : read_u32(ptragets + 16 + i * 24) }; + let pbs = read_u32(ptragets + 8 + i * 24); // WGPUBlendState + if (pbs != 0) { + t.blend = { + color : {operation : "add", srcFactor : id_to_blend_factor(read_u32(pbs + 4)), dstFactor : id_to_blend_factor(read_u32(pbs + 8))}, + alpha : {operation : "add", srcFactor : id_to_blend_factor(read_u32(pbs + 16)), dstFactor : id_to_blend_factor(read_u32(pbs + 20))} + }; + } frag.targets.push(t); } - // WGPUDepthStencilState - let pds = read_u32(pdescriptor + 72); - let ds = {format : id_to_texture_format(read_u32(pds + 4)), depthWriteEnabled : read_u32(pds + 8), depthCompare : read_u32(pds + 12)}; - if (ds.depthCompare === 0x00000002) - ds.depthCompare = "less"; - if (ds.depthCompare === 0x00000008) - ds.depthCompare = "always"; - // WGPURenderPipelineDescriptor let desc = { layout : id_to_ptr(read_u32(pdescriptor + 12)), // WGPUVertexState vertex : {module : id_to_ptr(read_u32(pdescriptor + 20)), entryPoint : "main", bufferCount : 1, buffers : []}, primitive : {topology : "triangle-list", frontFace : "ccw", cullMode : "none"}, - depthStencil : ds, fragment : frag, }; + // WGPUDepthStencilState + let pds = read_u32(pdescriptor + 72); + if (pds != 0) { + let ds = {format : id_to_texture_format(read_u32(pds + 4)), depthWriteEnabled : read_u32(pds + 8), depthCompare : read_u32(pds + 12)}; + if (ds.depthCompare === 0x00000002) + ds.depthCompare = "less"; + if (ds.depthCompare === 0x00000008) + ds.depthCompare = "always"; + desc.depthStencil = ds; + } + let pbuffers = read_u32(pdescriptor + 44); for (let i = 0; i < desc.vertex.bufferCount; ++i) { // WGPUVertexBufferLayout @@ -567,9 +609,6 @@ async function init() { js_pow : function(x) { return Math.pow(x); }, - js_floor : function(x) { - return Math.floor(x); - }, js_sin : function(x) { return Math.sin(x); }, @@ -588,6 +627,19 @@ async function init() { js_sqrt : function(x) { return Math.sqrt(x); }, + js_acos : function(x) { + return Math.acos(x); + }, + js_asin : function(x) { + return Math.asin(x); + }, + js_atan : function(x) { + return Math.atan(x); + }, + js_atan2 : function(x, y) { + return Math.atan2(x, y); + }, + js_eval : function(str) { (1, eval)(read_string(str)); }, diff --git a/base/sources/backends/webgpu_gpu.c b/base/sources/backends/webgpu_gpu.c index eacef38e..49040ec0 100644 --- a/base/sources/backends/webgpu_gpu.c +++ b/base/sources/backends/webgpu_gpu.c @@ -12,10 +12,11 @@ extern int constant_buffer_index; static gpu_buffer_t *current_vb; static gpu_buffer_t *current_ib; static WGPUBindGroupLayout descriptor_layout; +static WGPUBindGroupLayout descriptor_layout_depth; static WGPUSampler linear_sampler; static WGPUSampler point_sampler; static bool linear_sampling = true; -static WGPUCommandEncoder command_encoder; +static WGPUCommandEncoder command_encoder = NULL; static WGPURenderPassEncoder render_pass_encoder; static char device_name[256]; static WGPUInstance instance; @@ -134,6 +135,10 @@ static void create_descriptors(void) { }; descriptor_layout = wgpuDeviceCreateBindGroupLayout(device, &layout_create_info); + bindings[1].sampler.type = WGPUSamplerBindingType_NonFiltering; + bindings[2].texture.sampleType = WGPUTextureSampleType_UnfilterableFloat; + descriptor_layout_depth = wgpuDeviceCreateBindGroupLayout(device, &layout_create_info); + WGPUTextureDescriptor dummy_desc = { .size = {1, 1, 1}, .mipLevelCount = 1, @@ -320,21 +325,25 @@ void gpu_begin_internal(gpu_clear_t flags, unsigned color, float depth) { create_swapchain(); } - WGPUSurfaceTexture surface_texture; - wgpuSurfaceGetCurrentTexture(surface, &surface_texture); - framebuffers[0].impl.texture = surface_texture.texture; - WGPUTextureViewDescriptor view_info = { - .dimension = WGPUTextureViewDimension_2D, - .format = WGPUTextureFormat_RGBA8Unorm, - .mipLevelCount = 1, - .arrayLayerCount = 1, - }; - framebuffers[0].impl.view = wgpuTextureCreateView(surface_texture.texture, &view_info); - framebuffers[0].width = width; - framebuffers[0].height = height; - framebuffer_acquired = true; + if (!framebuffer_acquired) { + WGPUSurfaceTexture surface_texture; + wgpuSurfaceGetCurrentTexture(surface, &surface_texture); + framebuffers[0].impl.texture = surface_texture.texture; + WGPUTextureViewDescriptor view_info = { + .dimension = WGPUTextureViewDimension_2D, + .format = WGPUTextureFormat_RGBA8Unorm, + .mipLevelCount = 1, + .arrayLayerCount = 1, + }; + framebuffers[0].impl.view = wgpuTextureCreateView(surface_texture.texture, &view_info); + framebuffers[0].width = width; + framebuffers[0].height = height; + framebuffer_acquired = true; + } - command_encoder = wgpuDeviceCreateCommandEncoder(device, NULL); + if (command_encoder == NULL) { + command_encoder = wgpuDeviceCreateCommandEncoder(device, NULL); + } gpu_texture_t *target = current_render_targets[0]; WGPUColor clear_value = { @@ -394,6 +403,9 @@ void gpu_present_internal() { } void gpu_draw_internal() { + if (current_textures[0] != NULL && current_textures[0]->format == GPU_TEXTURE_FORMAT_D32) { + wgpuRenderPassEncoderSetPipeline(render_pass_encoder, current_pipeline->impl.pipeline_depth); + } wgpuRenderPassEncoderDrawIndexed(render_pass_encoder, current_ib->count, 1, 0, 0, 0); } @@ -472,7 +484,7 @@ static WGPUBindGroup get_descriptor_set(WGPUBuffer buffer) { entry_count++; entries[entry_count].binding = 1; - entries[entry_count].sampler = linear_sampling ? linear_sampler : point_sampler; + entries[entry_count].sampler = (linear_sampling && current_textures[0]->format != GPU_TEXTURE_FORMAT_D32) ? linear_sampler : point_sampler; entry_count++; for (int i = 0; i < GPU_MAX_TEXTURES; ++i) { @@ -482,7 +494,7 @@ static WGPUBindGroup get_descriptor_set(WGPUBuffer buffer) { } WGPUBindGroupDescriptor desc = { - .layout = descriptor_layout, + .layout = current_textures[0]->format == GPU_TEXTURE_FORMAT_D32 ? descriptor_layout_depth : descriptor_layout, .entryCount = entry_count, .entries = entries, }; @@ -506,7 +518,9 @@ void gpu_use_linear_sampling(bool b) { void gpu_pipeline_destroy_internal(gpu_pipeline_t *pipeline) { wgpuRenderPipelineRelease(pipeline->impl.pipeline); + wgpuRenderPipelineRelease(pipeline->impl.pipeline_depth); wgpuPipelineLayoutRelease(pipeline->impl.pipeline_layout); + wgpuPipelineLayoutRelease(pipeline->impl.pipeline_layout_depth); } static WGPUShaderModule create_shader_module(const void *code, size_t size) { @@ -525,6 +539,9 @@ void gpu_pipeline_compile(gpu_pipeline_t *pipeline) { }; pipeline->impl.pipeline_layout = wgpuDeviceCreatePipelineLayout(device, &pipeline_layout_create_info); + pipeline_layout_create_info.bindGroupLayouts = &descriptor_layout_depth; + pipeline->impl.pipeline_layout_depth = wgpuDeviceCreatePipelineLayout(device, &pipeline_layout_create_info); + WGPURenderPipelineDescriptor pipeline_desc = {0}; pipeline_desc.layout = pipeline->impl.pipeline_layout; pipeline_desc.primitive.topology = WGPUPrimitiveTopology_TriangleList; @@ -538,9 +555,10 @@ void gpu_pipeline_compile(gpu_pipeline_t *pipeline) { .depthWriteEnabled = pipeline->depth_write, .depthCompare = convert_compare_mode(pipeline->depth_mode), }; - pipeline_desc.depthStencil = &ds_state; + pipeline_desc.depthStencil = pipeline->depth_attachment_bits > 0 ? &ds_state : NULL; WGPUColorTargetState color_targets[8]; + WGPUBlendState blend_states[8]; for (int i = 0; i < pipeline->color_attachment_count; ++i) { color_targets[i].format = convert_image_format(pipeline->color_attachment[i]); color_targets[i].writeMask = @@ -549,7 +567,7 @@ void gpu_pipeline_compile(gpu_pipeline_t *pipeline) { if (pipeline->blend_source != GPU_BLEND_ONE || pipeline->blend_destination != GPU_BLEND_ZERO || pipeline->alpha_blend_source != GPU_BLEND_ONE || pipeline->alpha_blend_destination != GPU_BLEND_ZERO) { - color_targets[i].blend = &(WGPUBlendState){ + blend_states[i] = (WGPUBlendState){ .color = {.srcFactor = convert_blend_factor(pipeline->blend_source), .dstFactor = convert_blend_factor(pipeline->blend_destination), .operation = WGPUBlendOperation_Add}, @@ -557,6 +575,10 @@ void gpu_pipeline_compile(gpu_pipeline_t *pipeline) { .dstFactor = convert_blend_factor(pipeline->alpha_blend_destination), .operation = WGPUBlendOperation_Add}, }; + color_targets[i].blend = &blend_states[i]; + } + else { + color_targets[i].blend = NULL; } } @@ -611,6 +633,10 @@ void gpu_pipeline_compile(gpu_pipeline_t *pipeline) { }; pipeline->impl.pipeline = wgpuDeviceCreateRenderPipeline(device, &pipeline_desc); + + pipeline_desc.layout = pipeline->impl.pipeline_layout_depth; + pipeline->impl.pipeline_depth = wgpuDeviceCreateRenderPipeline(device, &pipeline_desc); + wgpuShaderModuleRelease(pipeline_desc.vertex.module); wgpuShaderModuleRelease(pipeline_desc.fragment->module); } diff --git a/base/sources/backends/webgpu_gpu.h b/base/sources/backends/webgpu_gpu.h index 1d68c3b2..4ddd5c19 100644 --- a/base/sources/backends/webgpu_gpu.h +++ b/base/sources/backends/webgpu_gpu.h @@ -14,7 +14,9 @@ typedef struct { typedef struct { WGPURenderPipeline pipeline; + WGPURenderPipeline pipeline_depth; WGPUPipelineLayout pipeline_layout; + WGPUPipelineLayout pipeline_layout_depth; } gpu_pipeline_impl_t; typedef struct { diff --git a/base/sources/libs/miniclib/math.c b/base/sources/libs/miniclib/math.c index 63f9ddf6..e8d2f654 100644 --- a/base/sources/libs/miniclib/math.c +++ b/base/sources/libs/miniclib/math.c @@ -85,7 +85,8 @@ double round(double x) { } float roundf(float x) { - return (float)round(x); + // return (float)round(x); // __builtin_roundf + return x >= 0.0 ? floor(x + 0.5) : ceil(x - 0.5); } double sin(double x) { diff --git a/base/sources/libs/miniclib/stdlib.c b/base/sources/libs/miniclib/stdlib.c index 3e9467fc..1751989e 100644 --- a/base/sources/libs/miniclib/stdlib.c +++ b/base/sources/libs/miniclib/stdlib.c @@ -92,7 +92,7 @@ void qsort(void *base, size_t num, size_t size, int (*compar)(const void *, cons while (compar(b + i * size, tmp) < 0) { i++; } - while (compar(b + j * size, tmp) > 0) { + while (j > 0 && compar(b + j * size, tmp) > 0) { j--; } if (i <= j) { @@ -103,6 +103,9 @@ void qsort(void *base, size_t num, size_t size, int (*compar)(const void *, cons memcpy(b + j * size, t, size); } i++; + if (j == 0) { + break; + } j--; } } diff --git a/base/sources/ts/render_path.ts b/base/sources/ts/render_path.ts index 4eba22e7..bfdedc85 100644 --- a/base/sources/ts/render_path.ts +++ b/base/sources/ts/render_path.ts @@ -32,7 +32,7 @@ let _render_path_paused: bool = false; let _render_path_last_w: i32 = 0; let _render_path_last_h: i32 = 0; let _render_path_bind_params: string[]; -let _render_path_meshes_sorted: bool; +// let _render_path_meshes_sorted: bool; let _render_path_last_frame_time: f32 = 0.0; let _render_path_loading: i32 = 0; let _render_path_cached_shader_contexts: map_t = map_create(); @@ -57,7 +57,7 @@ function render_path_render_frame() { render_path_current_w = sys_w(); render_path_current_h = sys_h(); - _render_path_meshes_sorted = false; + // _render_path_meshes_sorted = false; render_path_commands(); @@ -134,22 +134,22 @@ function render_path_submit_draw(context: string) { let meshes: mesh_object_t[] = scene_meshes; _mesh_object_last_pipeline = null; - if (!_render_path_meshes_sorted && camera != null) { // Order max once per frame for now - let cam_x: f32 = transform_world_x(camera.base.transform); - let cam_y: f32 = transform_world_y(camera.base.transform); - let cam_z: f32 = transform_world_z(camera.base.transform); - for (let i: i32 = 0; i < meshes.length; ++i) { - let mesh: mesh_object_t = meshes[i]; - mesh_object_compute_camera_dist(mesh, cam_x, cam_y, cam_z); - } - if (_render_path_draw_order == draw_order_t.SHADER) { - render_path_sort_meshes_shader(meshes); - } - else { - render_path_sort_meshes_dist(meshes); - } - _render_path_meshes_sorted = true; - } + // if (!_render_path_meshes_sorted && camera != null) { // Order max once per frame for now + // let cam_x: f32 = transform_world_x(camera.base.transform); + // let cam_y: f32 = transform_world_y(camera.base.transform); + // let cam_z: f32 = transform_world_z(camera.base.transform); + // for (let i: i32 = 0; i < meshes.length; ++i) { + // let mesh: mesh_object_t = meshes[i]; + // mesh_object_compute_camera_dist(mesh, cam_x, cam_y, cam_z); + // } + // if (_render_path_draw_order == draw_order_t.SHADER) { + // render_path_sort_meshes_shader(meshes); + // } + // else { + // render_path_sort_meshes_dist(meshes); + // } + // _render_path_meshes_sorted = true; + // } for (let i: i32 = 0; i < meshes.length; ++i) { let mesh: mesh_object_t = meshes[i]; diff --git a/base/sources/ts/tween.ts b/base/sources/ts/tween.ts index 1155268f..4952ec84 100644 --- a/base/sources/ts/tween.ts +++ b/base/sources/ts/tween.ts @@ -32,7 +32,7 @@ function tween_reset() { _tween_anims = []; } -function tween_update() { +function tween_update(_: any) { let d: f32 = sys_delta(); let i: i32 = _tween_anims.length; while (i-- > 0 && _tween_anims.length > 0) { diff --git a/base/tools/make.js b/base/tools/make.js index 209dcf60..5231d052 100644 --- a/base/tools/make.js +++ b/base/tools/make.js @@ -947,7 +947,7 @@ class WasmExporter extends Exporter { let compilerFlags = ""; this.make = new MakeExporter(compiler, compiler, compilerFlags, compilerFlags, - '--target=wasm32 -nostdlib -matomics -mbulk-memory "-Wl,--import-memory,--shared-memory,--allow-undefined,--no-entry,--stack-first,--initial-memory=536870912,--max-memory=536870912,-z,stack-size=10000"', '.wasm'); + '--target=wasm32 -nostdlib -matomics -mbulk-memory "-Wl,--import-memory,--shared-memory,--allow-undefined,--no-entry,--initial-memory=671088640,--max-memory=671088640,-z,stack-size=256000"', '.wasm'); } export_solution(project) { diff --git a/paint/sources/args.ts b/paint/sources/args.ts index 11984875..7c8cd698 100644 --- a/paint/sources/args.ts +++ b/paint/sources/args.ts @@ -63,7 +63,7 @@ function args_parse() { function args_run() { if (args_use) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { if (project_filepath != "") { import_arm_run_project(project_filepath); } @@ -122,7 +122,7 @@ function args_run() { data_delete_blob("export_presets/" + file); // Export queue - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { export_texture_run(args_export_textures_path); }); } diff --git a/paint/sources/base.ts b/paint/sources/base.ts index a21973da..100750c3 100644 --- a/paint/sources/base.ts +++ b/paint/sources/base.ts @@ -308,7 +308,7 @@ function base_resize() { base_redraw_ui(); } -function base_update() { +function base_update(_: any) { if (mouse_movement_x != 0 || mouse_movement_y != 0) { iron_mouse_set_cursor(iron_cursor_t.ARROW); } @@ -532,7 +532,7 @@ function base_get_drag_image(): gpu_texture_t { return null; } -function base_render() { +function base_render(_: any) { if (context_raw.frame == 2) { util_render_make_material_preview(); ui_base_hwnds[tab_area_t.SIDEBAR1].redraws = 2; @@ -791,7 +791,7 @@ function ui_base_init() { project_new(false); if (project_filepath == "") { - sys_notify_on_next_frame(layers_init); + sys_notify_on_next_frame(function(_: any) { layers_init(); }); } context_raw.project_objects = []; @@ -803,7 +803,7 @@ function ui_base_init() { operator_register("view_top", ui_base_view_top); } -function ui_base_update() { +function ui_base_update(_: any) { ui_base_update_ui(); operator_update(); @@ -859,7 +859,7 @@ function ui_base_update() { box_export_show_textures(); } else { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { export_texture_run(context_raw.texture_export_path); }); } @@ -1531,7 +1531,7 @@ function ui_base_update_ui() { // New color id picked, update fill layer if (context_raw.tool == tool_type_t.COLORID && context_raw.layer.fill_layer != null) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { layers_update_fill_layer(); make_material_parse_paint_material(false); }); @@ -1615,7 +1615,7 @@ function ui_base_update_ui() { gizmo_update(); } -function ui_base_render() { +function ui_base_render(_: any) { if (!ui_base_show && config_raw.touch_ui) { ui.input_enabled = true; ui_begin(ui); @@ -1666,7 +1666,7 @@ function ui_base_render() { ui.input_enabled = true; } -function ui_base_render_cursor() { +function ui_base_render_cursor(_: any) { if (!base_ui_enabled) { return; } diff --git a/paint/sources/box_export.ts b/paint/sources/box_export.ts index 13366cb1..3c308a27 100644 --- a/paint/sources/box_export.ts +++ b/paint/sources/box_export.ts @@ -75,7 +75,7 @@ function box_export_tab_export_textures(title: string, bake_material: bool = fal ui_combo(base_bits_handle, base_bits_combo, tr("Color"), true); if (base_bits_handle.changed) { - sys_notify_on_next_frame(layers_set_bits); + sys_notify_on_next_frame(function(_: any) { layers_set_bits(); }); } ui_row2(); @@ -136,7 +136,7 @@ function box_export_tab_export_textures(title: string, bake_material: bool = fal if (context_raw.layers_destination == export_destination_t.PACK_INTO_PROJECT) { _box_export_bake_material = bake_material; context_raw.texture_export_path = "/"; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { export_texture_run(context_raw.texture_export_path, _box_export_bake_material); }); } @@ -148,7 +148,7 @@ function box_export_tab_export_textures(title: string, bake_material: bool = fal /// if (arm_android || arm_ios) console_toast(tr("Exporting textures")); /// end - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { export_texture_run(context_raw.texture_export_path, _box_export_bake_material); }); }); diff --git a/paint/sources/box_preferences.ts b/paint/sources/box_preferences.ts index 72f5c1ce..7c47e5c7 100644 --- a/paint/sources/box_preferences.ts +++ b/paint/sources/box_preferences.ts @@ -125,7 +125,7 @@ function box_preferences_interface_tab() { if (ui_icon_button(tr("Restore"), icon_t.REPLAY) && !ui_menu_show) { ui_menu_draw(function() { if (ui_menu_button(tr("Confirm"), "", icon_t.CHECK)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { ui.ops.theme.ELEMENT_H = base_default_element_h; config_restore(); box_preferences_set_scale(); diff --git a/paint/sources/box_projects.ts b/paint/sources/box_projects.ts index 0225b5e7..8087e6c2 100644 --- a/paint/sources/box_projects.ts +++ b/paint/sources/box_projects.ts @@ -146,7 +146,7 @@ function box_projects_tab() { ui_menu_draw(function() { // if (ui_menu_button(tr("Duplicate"), "", icon_t.DUPLICATE)) {} if (ui_menu_button(tr("Delete"), "", icon_t.DELETE)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { iron_delete_file(_box_projects_path); iron_delete_file(_box_projects_icon_path); let data_path: string = substring(_box_projects_path, 0, _box_projects_path.length - 4); diff --git a/paint/sources/camera.ts b/paint/sources/camera.ts index 7498c5cc..84de53c2 100644 --- a/paint/sources/camera.ts +++ b/paint/sources/camera.ts @@ -10,7 +10,7 @@ function camera_init() { camera_reset(); } -function camera_update() { +function camera_update(_: any) { let camera: camera_object_t = scene_camera; if (mouse_view_x() < 0 || mouse_view_x() > sys_w() || mouse_view_y() < 0 || mouse_view_y() > sys_h()) { diff --git a/paint/sources/console.ts b/paint/sources/console.ts index 0e01ae7c..fd940b45 100644 --- a/paint/sources/console.ts +++ b/paint/sources/console.ts @@ -31,7 +31,7 @@ function console_toast(s: string) { draw_begin(current); } -function console_draw_progress() { +function console_draw_progress(_: any) { console_draw_toast(console_progress_text); } diff --git a/paint/sources/context.ts b/paint/sources/context.ts index f5518bc9..313d0e41 100644 --- a/paint/sources/context.ts +++ b/paint/sources/context.ts @@ -436,7 +436,7 @@ function context_set_material(m: slot_material_t) { let decal: bool = context_is_decal(); if (decal) { - sys_notify_on_next_frame(util_render_make_decal_preview); + sys_notify_on_next_frame(function(_: any) { util_render_make_decal_preview(); }); } } @@ -724,7 +724,7 @@ function context_set_render_path() { else { render_path_commands = render_path_deferred_commands; } - sys_notify_on_next_frame(make_material_parse_mesh_material); + sys_notify_on_next_frame(function(_: any) { make_material_parse_mesh_material(); }); } function context_enable_import_plugin(file: string): bool { diff --git a/paint/sources/history.ts b/paint/sources/history.ts index 29831b1e..375a3e5e 100644 --- a/paint/sources/history.ts +++ b/paint/sources/history.ts @@ -41,7 +41,7 @@ function history_undo() { // Undo at least second time in order to avoid empty groups if (step.layer_type == layer_slot_type_t.GROUP) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let active: i32 = history_steps.length - 1 - history_redos; // 1. Undo deleting group masks let n: i32 = 1; @@ -277,7 +277,7 @@ function history_redo() { // Redo deleting all group masks + the group itself if (step.layer_type == layer_slot_type_t.LAYER && history_steps.length >= active + 2 && (history_steps[active + 1].layer_type == layer_slot_type_t.GROUP || history_steps[active + 1].layer_type == layer_slot_type_t.MASK)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let active: i32 = history_steps.length - history_redos; let n: i32 = 1; while (history_steps[active + n].layer_type == layer_slot_type_t.MASK) { @@ -298,7 +298,7 @@ function history_redo() { } else if (step.name == tr("Duplicate Layer")) { context_raw.layer = project_layers[step.layer]; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { layers_duplicate_layer(context_raw.layer); }); } @@ -309,8 +309,8 @@ function history_redo() { } else if (step.name == tr("Merge Layers")) { context_raw.layer = project_layers[step.layer + 1]; - sys_notify_on_next_frame(history_redo_merge_layers); - sys_notify_on_next_frame(layers_merge_down); + sys_notify_on_next_frame(function(_: any) { history_redo_merge_layers(); }); + sys_notify_on_next_frame(function(_: any) { layers_merge_down(); }); } else if (step.name == tr("Apply Mask")) { context_raw.layer = project_layers[step.layer]; @@ -325,7 +325,7 @@ function history_redo() { history_copy_merging_layers2(layers); } - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { slot_layer_apply_mask(context_raw.layer); context_set_layer(context_raw.layer); context_raw.layers_preview_dirty = true; diff --git a/paint/sources/import_arm.ts b/paint/sources/import_arm.ts index 86fb3da2..b4efcc71 100644 --- a/paint/sources/import_arm.ts +++ b/paint/sources/import_arm.ts @@ -341,7 +341,7 @@ function import_arm_run_project(path: string) { } } - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { // Once envmap is imported scene_world.strength = project_raw.envmap_strength; context_raw.envmap_angle = project_raw.envmap_angle; @@ -381,7 +381,7 @@ function import_arm_run_mesh(raw: project_format_t) { util_mesh_merge(); viewport_scale_to_bounds(); } - sys_notify_on_next_frame(layers_init); + sys_notify_on_next_frame(function(_: any) { layers_init(); }); history_reset(); } diff --git a/paint/sources/import_blend_material.ts b/paint/sources/import_blend_material.ts index ab93ed5b..7100653d 100644 --- a/paint/sources/import_blend_material.ts +++ b/paint/sources/import_blend_material.ts @@ -31,7 +31,7 @@ function import_blend_material_run(path: string) { function _import_blend_material() { console_toast(tr("Baking material")); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let save: string; if (path_is_protected()) { save = iron_internal_save_path(); diff --git a/paint/sources/import_mesh.ts b/paint/sources/import_mesh.ts index 19ba3157..10c2dd86 100644 --- a/paint/sources/import_mesh.ts +++ b/paint/sources/import_mesh.ts @@ -139,16 +139,16 @@ function _import_mesh_make_mesh(mesh: raw_mesh_t) { slot_layer_unload(l); } layers_new_layer(false); - sys_notify_on_next_frame(layers_init); + sys_notify_on_next_frame(function(_: any) { layers_init(); }); history_reset(); } // Wait for add_mesh calls to finish if (import_mesh_meshes_to_unwrap != null) { - sys_notify_on_next_frame(import_mesh_finish_import); + sys_notify_on_next_frame( function(_: any) { import_mesh_finish_import(); }); } else { - sys_notify_on_next_frame(import_mesh_finish_import); + sys_notify_on_next_frame( function(_: any) { import_mesh_finish_import(); }); } } diff --git a/paint/sources/neural_nodes/image_to_pbr_node.ts b/paint/sources/neural_nodes/image_to_pbr_node.ts index 39c4ddf0..552f7b95 100644 --- a/paint/sources/neural_nodes/image_to_pbr_node.ts +++ b/paint/sources/neural_nodes/image_to_pbr_node.ts @@ -114,7 +114,7 @@ function image_to_pbr_node_button(node_id: i32) { // image_to_pbr_node_run_sd("marigold-iid-lighting-v1-1.q8_0.gguf", "_diffuse_shading", function(tex: gpu_texture_t) { image_to_pbr_node_result_roughness = tex; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let occmap: render_target_t; { let t: render_target_t = render_target_create(); diff --git a/paint/sources/neural_nodes/neural_node.ts b/paint/sources/neural_nodes/neural_node.ts index 264ce560..bdfcadf7 100644 --- a/paint/sources/neural_nodes/neural_node.ts +++ b/paint/sources/neural_nodes/neural_node.ts @@ -54,7 +54,7 @@ function neural_node_button(node: ui_node_t, model: string): bool { } } else if (!found && ui_button(tr("Setup"))) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { box_preferences_htab.i = preference_tab_t.NEURAL; box_preferences_show(); }); @@ -139,7 +139,7 @@ function neural_node_download(url: string) { /// if WITH_COMPRESS if (ends_with(url, "Hunyuan3D_win64.tar")) { console_toast(tr("Unpacking Hunyuan3D_win64.tar")); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let tar: string = neural_node_dir() + "/Hunyuan3D_win64.tar"; untar_here(tar); }); diff --git a/paint/sources/node_shader.ts b/paint/sources/node_shader.ts index 61623f69..6ab93efd 100644 --- a/paint/sources/node_shader.ts +++ b/paint/sources/node_shader.ts @@ -99,6 +99,15 @@ function node_shader_add_texture(raw: node_shader_t, name: string, link: string array_push(raw.textures, name); node_shader_context_add_texture_unit(raw.context, name, link); } + +/// if IRON_WASM + if (name == "gbufferD") { // webgpu - depth texture first + let t: string = array_pop(raw.textures); + array_insert(raw.textures, 0, t); + let c: tex_unit_t = array_pop(raw.context.data.texture_units); + array_insert(raw.context.data.texture_units, 0, c); + } +/// end } function node_shader_add_function(raw: node_shader_t, s: string) { diff --git a/paint/sources/project.ts b/paint/sources/project.ts index a999152f..27e8eb1b 100644 --- a/paint/sources/project.ts +++ b/paint/sources/project.ts @@ -70,7 +70,7 @@ function project_save(save_and_quit: bool = false) { _project_save_and_quit = save_and_quit; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { export_arm_run_project(); if (_project_save_and_quit) { iron_stop(); @@ -276,9 +276,9 @@ function project_new(reset_layers: bool = true) { array_push(project_layers, layer); context_set_layer(layer); if (aspect_ratio_changed) { - sys_notify_on_next_frame(layers_resize); + sys_notify_on_next_frame(function(_: any) { layers_resize(); }); } - sys_notify_on_next_frame(layers_init); + sys_notify_on_next_frame(function(_: any) { layers_init(); }); } if (in_use) @@ -290,7 +290,7 @@ function project_new(reset_layers: bool = true) { viewport_scale_to_bounds(1.8); render_path_raytrace_ready = false; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { // Once layers and meshes are populated on project open util_render_make_material_preview(); context_raw.ddirty = 4; @@ -354,7 +354,7 @@ function project_import_brush() { // Parse brush make_material_parse_brush(); ui_nodes_hwnd.redraws = 2; - sys_notify_on_next_frame(util_render_make_brush_preview); + sys_notify_on_next_frame(function(_: any) { util_render_make_brush_preview(); }); } // Import from project file else { @@ -552,7 +552,7 @@ function project_reimport_texture_load(path: string, asset: asset_t) { context_raw.texture = project_assets[i]; } - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { make_material_parse_paint_material(); util_render_make_material_preview(); diff --git a/paint/sources/render_path_paint.ts b/paint/sources/render_path_paint.ts index 9b2bf76a..2dec3302 100644 --- a/paint/sources/render_path_paint.ts +++ b/paint/sources/render_path_paint.ts @@ -574,7 +574,7 @@ function _render_path_paint_deriv() { if (render_path_paint_push_undo_last) { history_paint(); } - sys_notify_on_next_frame(_render_path_paint_final); + sys_notify_on_next_frame(function(_: any) { _render_path_paint_final(); }); } function render_path_paint_is_rt_bake(): bool { @@ -632,10 +632,10 @@ function render_path_paint_draw() { context_select_paint_object(_paint_object); if (context_raw.bake_type == bake_type_t.DERIVATIVE) { - sys_notify_on_next_frame(_render_path_paint_deriv); + sys_notify_on_next_frame(function(_: any) { _render_path_paint_deriv(); }); } else { - sys_notify_on_next_frame(_render_path_paint_final); + sys_notify_on_next_frame(function(_: any) { _render_path_paint_final(); }); } } } diff --git a/paint/sources/render_path_raytrace_bake.ts b/paint/sources/render_path_raytrace_bake.ts index 6f73cedb..dc5e7160 100644 --- a/paint/sources/render_path_raytrace_bake.ts +++ b/paint/sources/render_path_raytrace_bake.ts @@ -62,7 +62,7 @@ function render_path_raytrace_bake_commands(parse_paint_material: (b?: bool) => render_path_set_target("baketex0", additional); render_path_draw_meshes("paint"); context_raw.bake_type = _bake_type; - sys_notify_on_next_frame(parse_paint_material); + sys_notify_on_next_frame(function(parse_paint_material: (b?: bool) => void) { parse_paint_material(true); }, parse_paint_material); render_path_raytrace_init_shader = true; render_path_raytrace_raytrace_init(render_path_raytrace_bake_get_bake_shader_name(), rebuild); diff --git a/paint/sources/slot_layer.ts b/paint/sources/slot_layer.ts index 55883baa..086e1e39 100644 --- a/paint/sources/slot_layer.ts +++ b/paint/sources/slot_layer.ts @@ -441,7 +441,7 @@ function slot_layer_to_fill_layer(raw: slot_layer_t) { context_set_layer(raw); raw.fill_layer = context_raw.material; layers_update_fill_layer(); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { make_material_parse_paint_material(); context_raw.layer_preview_dirty = true; ui_base_hwnds[tab_area_t.SIDEBAR0].redraws = 2; @@ -1252,7 +1252,7 @@ function layers_create_fill_layer(uv_type: uv_type_t = uv_type_t.UVMAP, decal_ma _layers_uv_type = uv_type; _layers_decal_mat = decal_mat; _layers_position = position; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = layers_new_layer(false, _layers_position); history_new_layer(); l.uv_type = _layers_uv_type; @@ -1284,7 +1284,7 @@ function layers_create_color_layer(base_color: i32, occlusion: f32 = 1.0, roughn _layers_metallic = metallic; _layers_position = position; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = layers_new_layer(false, _layers_position); history_new_layer(); l.uv_type = uv_type_t.UVMAP; @@ -1682,7 +1682,7 @@ function layers_flatten(height_to_normal: bool = false, layers: slot_layer_t[] = } function layers_on_resized() { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { layers_resize(); let _layer: slot_layer_t = context_raw.layer; let _material: slot_material_t = context_raw.material; diff --git a/paint/sources/tab_browser.ts b/paint/sources/tab_browser.ts index 44b8c104..504cee06 100644 --- a/paint/sources/tab_browser.ts +++ b/paint/sources/tab_browser.ts @@ -161,7 +161,7 @@ function tab_browser_draw(htab: ui_handle_t) { if (ui_menu_button(tr("Set as Envmap"), "", icon_t.LANDSCAPE)) { import_asset_run(file, -1.0, -1.0, true, true, function() { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let file: string = _tab_browser_draw_file; let asset_index: i32 = -1; @@ -180,7 +180,7 @@ function tab_browser_draw(htab: ui_handle_t) { if (ui_menu_button(tr("Set as Mask"), "", icon_t.MASK)) { import_asset_run(file, -1.0, -1.0, true, true, function() { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let file: string = _tab_browser_draw_file; let asset_index: i32 = -1; @@ -199,7 +199,7 @@ function tab_browser_draw(htab: ui_handle_t) { if (ui_menu_button(tr("Set as Color ID Map"), "", icon_t.COLOR_ID)) { import_asset_run(file, -1.0, -1.0, true, true, function() { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let file: string = _tab_browser_draw_file; let asset_index: i32 = -1; diff --git a/paint/sources/tab_brushes.ts b/paint/sources/tab_brushes.ts index 6fe8c044..ad713882 100644 --- a/paint/sources/tab_brushes.ts +++ b/paint/sources/tab_brushes.ts @@ -100,7 +100,7 @@ function tab_brushes_draw(htab: ui_handle_t) { } if (ui_menu_button(tr("Duplicate"), "", icon_t.DUPLICATE)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let i: i32 = _tab_brushes_draw_i; context_raw.brush = slot_brush_create(); @@ -122,7 +122,7 @@ function tab_brushes_draw(htab: ui_handle_t) { if (img_full == null) { _tab_brushes_draw_i = i; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let i: i32 = _tab_brushes_draw_i; let _brush: slot_brush_t = context_raw.brush; diff --git a/paint/sources/tab_fonts.ts b/paint/sources/tab_fonts.ts index 592eaf48..50f5d870 100644 --- a/paint/sources/tab_fonts.ts +++ b/paint/sources/tab_fonts.ts @@ -83,7 +83,7 @@ function tab_fonts_draw(htab: ui_handle_t) { if (context_raw.font != project_fonts[i]) { _tab_fonts_draw_i = i; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let i: i32 = _tab_fonts_draw_i; context_select_font(i); }); @@ -95,7 +95,7 @@ function tab_fonts_draw(htab: ui_handle_t) { } if (ui.is_hovered && ui.input_released_r) { _tab_fonts_draw_i = i; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { context_select_font(_tab_fonts_draw_i); ui_menu_draw(function() { let i: i32 = _tab_fonts_draw_i; @@ -109,7 +109,7 @@ function tab_fonts_draw(htab: ui_handle_t) { if (img == null) { _tab_fonts_draw_i = i; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let i: i32 = _tab_fonts_draw_i; let _font: slot_font_t = context_raw.font; diff --git a/paint/sources/tab_layers.ts b/paint/sources/tab_layers.ts index e6d856a9..39ea5bde 100644 --- a/paint/sources/tab_layers.ts +++ b/paint/sources/tab_layers.ts @@ -86,7 +86,7 @@ function tab_layers_button_new(text: string) { let l: slot_layer_t = context_raw.layer; if (context_raw.workspace == workspace_t.SCULPT) { if (ui_menu_button(tr("Sculpt Layer"), "", icon_t.PAINT)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { sculpt_layers_create_sculpt_layer(); }); } @@ -115,7 +115,7 @@ function tab_layers_button_new(text: string) { }, m); context_raw.layer_preview_dirty = true; history_new_black_mask(); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { layers_update_fill_layers(); }); } @@ -131,7 +131,7 @@ function tab_layers_button_new(text: string) { }, m); context_raw.layer_preview_dirty = true; history_new_white_mask(); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { layers_update_fill_layers(); }); } @@ -147,7 +147,7 @@ function tab_layers_button_new(text: string) { }, m); context_raw.layer_preview_dirty = true; history_new_fill_mask(); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { layers_update_fill_layers(); }); } @@ -413,7 +413,7 @@ function tab_layers_draw_layer_slot_full(l: slot_layer_t, i: i32) { ui.input_x > ui._window_x && ui.input_x < ui._window_x + ui._window_w && ui.input_y > ui._window_y && ui.input_y < ui._window_y + ui._window_h; if (in_focus && ui.is_delete_down && tab_layers_can_delete(context_raw.layer)) { ui.is_delete_down = false; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { tab_layers_delete_layer(context_raw.layer); }); } @@ -740,14 +740,14 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { let to_paint_string: string = slot_layer_is_layer(l) ? tr("To Paint Layer") : tr("To Paint Mask"); if (l.fill_layer == null && ui_menu_button(to_fill_string, "", icon_t.SPHERE)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = tab_layers_l; slot_layer_is_layer(l) ? history_to_fill_layer() : history_to_fill_mask(); slot_layer_to_fill_layer(l); }); } if (l.fill_layer != null && ui_menu_button(to_paint_string, "", icon_t.PAINT)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = tab_layers_l; slot_layer_is_layer(l) ? history_to_paint_layer() : history_to_paint_mask(); slot_layer_to_paint_layer(l); @@ -757,7 +757,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { ui.enabled = tab_layers_can_delete(l); if (ui_menu_button(tr("Delete"), "delete", icon_t.DELETE)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { tab_layers_delete_layer(context_raw.layer); }); } @@ -765,7 +765,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { if (l.fill_layer == null && ui_menu_button(tr("Clear"), "", icon_t.ERASE)) { context_set_layer(l); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = tab_layers_l; if (!slot_layer_is_group(l)) { history_clear_layer(); @@ -784,7 +784,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { }); } if (slot_layer_is_mask(l) && l.fill_layer == null && ui_menu_button(tr("Invert"), "", icon_t.INVERT)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = tab_layers_l; context_set_layer(l); history_invert_mask(); @@ -792,7 +792,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { }); } if (slot_layer_is_mask(l) && ui_menu_button(tr("Apply"), "", icon_t.CHECK)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = tab_layers_l; context_raw.layer = l; history_apply_mask(); @@ -803,14 +803,14 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { }); } if (slot_layer_is_group(l) && ui_menu_button(tr("Merge Group"))) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = tab_layers_l; layers_merge_group(l); }); } ui.enabled = tab_layers_can_merge_down(l); if (ui_menu_button(tr("Merge Down"), "", icon_t.ARROW_DOWN)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = tab_layers_l; context_set_layer(l); history_merge_layers(); @@ -821,7 +821,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { } ui.enabled = true; if (ui_menu_button(tr("Duplicate"), "", icon_t.DUPLICATE)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = tab_layers_l; context_set_layer(l); history_duplicate_layer(); @@ -887,7 +887,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { ui_inline_radio(base_bits_handle, bits_items, ui_align_t.LEFT); /// end if (base_bits_handle.changed) { - sys_notify_on_next_frame(layers_set_bits); + sys_notify_on_next_frame(function(_: any) {layers_set_bits(); }); make_material_parse_paint_material(); ui_menu_keep_open = true; } @@ -901,7 +901,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { if (scale_handle.changed) { context_set_material(l.fill_layer); context_set_layer(l); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { layers_update_fill_layers(); }); ui_menu_keep_open = true; @@ -915,7 +915,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { context_set_material(l.fill_layer); context_set_layer(l); make_material_parse_paint_material(); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { layers_update_fill_layers(); }); ui_menu_keep_open = true; @@ -930,7 +930,7 @@ function tab_layers_draw_layer_context_menu(l: slot_layer_t, mini: bool) { context_set_material(l.fill_layer); context_set_layer(l); make_material_parse_paint_material(); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { layers_update_fill_layers(); }); ui_menu_keep_open = true; @@ -998,7 +998,7 @@ function tab_layers_make_mask_preview_rgba32(l: slot_layer_t) { if (context_raw.mask_preview_last != l) { context_raw.mask_preview_last = l; tab_layers_l = l; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let l: slot_layer_t = tab_layers_l; draw_begin(context_raw.mask_preview_rgba32); draw_set_pipeline(ui_view2d_pipe); diff --git a/paint/sources/tab_materials.ts b/paint/sources/tab_materials.ts index e0fae9d2..c20e861f 100644 --- a/paint/sources/tab_materials.ts +++ b/paint/sources/tab_materials.ts @@ -124,7 +124,7 @@ function tab_materials_draw_slots(mini: bool) { if (context_raw.material != project_materials[i]) { context_select_material(i); if (context_raw.tool == tool_type_t.MATERIAL) { - sys_notify_on_next_frame(layers_update_fill_layers); + sys_notify_on_next_frame(function(_: any) { layers_update_fill_layers(); }); } } base_drag_off_x = -(mouse_x - uix - ui._window_x - 3); @@ -164,7 +164,7 @@ function tab_materials_draw_slots(mini: bool) { } if (ui_menu_button(tr("Duplicate"), "", icon_t.DUPLICATE)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let i: i32 = _tab_materials_draw_slots; context_raw.material = slot_material_create(project_materials[0].data); @@ -293,7 +293,7 @@ function tab_materials_draw_slots(mini: bool) { function tab_materials_button_new(text: string) { if (ui_icon_button(text, icon_t.PLUS)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { context_raw.material = slot_material_create(project_materials[0].data); array_push(project_materials, context_raw.material); tab_materials_update_material(); diff --git a/paint/sources/tab_meshes.ts b/paint/sources/tab_meshes.ts index 4c1904ae..6321b74e 100644 --- a/paint/sources/tab_meshes.ts +++ b/paint/sources/tab_meshes.ts @@ -432,7 +432,7 @@ function tab_scene_import_mesh_done() { tab_scene_select_object(mo); } - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { util_mesh_merge(); tab_scene_select_object(context_raw.selected_object.ext); tab_scene_sort(); diff --git a/paint/sources/tab_textures.ts b/paint/sources/tab_textures.ts index 357f5a21..3b97b214 100644 --- a/paint/sources/tab_textures.ts +++ b/paint/sources/tab_textures.ts @@ -125,7 +125,7 @@ function tab_textures_draw(htab: ui_handle_t) { ui_files_show("png", true, false, function(path: string) { _tab_textures_draw_path = path; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let img: gpu_texture_t = _tab_textures_draw_img; let target: gpu_texture_t = gpu_create_render_target(img.width, img.height); draw_begin(target); @@ -155,13 +155,13 @@ function tab_textures_draw(htab: ui_handle_t) { } if (ui_menu_button(tr("To Mask"), "", icon_t.MASK)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { layers_create_image_mask(_tab_textures_draw_asset); }); } if (ui_menu_button(tr("Set as Envmap"), "", icon_t.LANDSCAPE)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { import_envmap_run(_tab_textures_draw_asset.file, _tab_textures_draw_img); }); } @@ -268,7 +268,7 @@ function tab_textures_delete_texture(asset: asset_t) { map_delete(project_asset_map, asset.id); array_splice(project_assets, index, 1); array_splice(project_asset_names, index, 1); - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { make_material_parse_paint_material(); util_render_make_material_preview(); ui_base_hwnds[tab_area_t.SIDEBAR1].redraws = 2; diff --git a/paint/sources/translator.ts b/paint/sources/translator.ts index b4db9754..09209a22 100644 --- a/paint/sources/translator.ts +++ b/paint/sources/translator.ts @@ -148,7 +148,7 @@ function translator_init_font(cjk: bool, font_path: string, font_scale: f32) { _translator_init_font_font_scale = font_scale; // Load and assign font with cjk characters - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let cjk: bool = _translator_init_font_cjk; let font_path: string = _translator_init_font_font_path; let font_scale: f32 = _translator_init_font_font_scale; diff --git a/paint/sources/ui_header.ts b/paint/sources/ui_header.ts index a2b5acd2..fbe97a81 100644 --- a/paint/sources/ui_header.ts +++ b/paint/sources/ui_header.ts @@ -207,7 +207,7 @@ function ui_header_draw_tool_properties() { if (!baking && ui_button(tr("Bake"))) { context_raw.pdirty = rt_bake ? context_raw.bake_samples : 1; context_raw.rdirty = 3; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { context_raw.layer_preview_dirty = true; }); ui_base_hwnds[0].redraws = 2; diff --git a/paint/sources/ui_menubar.ts b/paint/sources/ui_menubar.ts index 3fae026e..87af1539 100644 --- a/paint/sources/ui_menubar.ts +++ b/paint/sources/ui_menubar.ts @@ -89,8 +89,8 @@ function ui_menubar_render_ui() { // Save project icon in lit mode context_set_viewport_mode(viewport_mode_t.LIT); console_toast(tr("Saving project")); - sys_notify_on_next_frame(function() { - sys_notify_on_end_frame(function() { + sys_notify_on_next_frame(function(_: any) { + sys_notify_on_end_frame(function(_: any) { project_save(); box_projects_show(); }); @@ -430,7 +430,7 @@ function ui_menubar_draw_category_items() { } if (ui_menu_button(tr("Capture Screenshot"), "", icon_t.PHOTO)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { viewport_capture_screenshot(); }); ui.changed = false; // Close menu diff --git a/paint/sources/ui_nodes.ts b/paint/sources/ui_nodes.ts index f8a9410a..2d6a897b 100644 --- a/paint/sources/ui_nodes.ts +++ b/paint/sources/ui_nodes.ts @@ -151,7 +151,7 @@ function ui_viewnodes_on_socket_released(socket_id: i32) { _ui_nodes_on_socket_released_socket = socket; _ui_nodes_on_socket_released_node = node; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { ui_menu_draw(function() { let socket: ui_node_socket_t = _ui_nodes_on_socket_released_socket; let node: ui_node_t = _ui_nodes_on_socket_released_node; @@ -173,7 +173,7 @@ function ui_viewnodes_on_socket_released(socket_id: i32) { _ui_nodes_hval0.f = socket.default_value[0]; } - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { ui_end_input(); ui_box_show_custom(function() { @@ -292,7 +292,7 @@ function ui_viewnodes_on_canvas_released() { selected.type == "GROUP_OUTPUT" || selected.type == "brush_output_node"; ui.enabled = !is_protected; if (ui_menu_button(tr("Cut"), "ctrl+x", icon_t.CUT)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { ui_nodes_hwnd.redraws = 2; ui_is_copy = true; ui_is_cut = true; @@ -300,14 +300,14 @@ function ui_viewnodes_on_canvas_released() { }); } if (ui_menu_button(tr("Copy"), "ctrl+c", icon_t.COPY)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { ui_is_copy = true; ui_nodes_is_node_menu_op = true; }); } ui.enabled = ui_clipboard != ""; if (ui_menu_button(tr("Paste"), "ctrl+v", icon_t.PASTE)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { ui_nodes_hwnd.redraws = 2; ui_is_paste = true; ui_nodes_is_node_menu_op = true; @@ -315,8 +315,8 @@ function ui_viewnodes_on_canvas_released() { } ui.enabled = !is_protected; if (ui_menu_button(tr("Delete"), "delete", icon_t.DELETE)) { - sys_notify_on_next_frame(function() { - sys_notify_on_end_frame(function() { + sys_notify_on_next_frame(function(_: any) { + sys_notify_on_end_frame(function(_: any) { ui_nodes_hwnd.redraws = 2; ui.is_delete_down = true; ui_nodes_is_node_menu_op = true; @@ -324,7 +324,7 @@ function ui_viewnodes_on_canvas_released() { }); } if (ui_menu_button(tr("Duplicate"), "", icon_t.DUPLICATE)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { ui_nodes_hwnd.redraws = 2; ui_is_copy = true; ui_is_paste = true; @@ -342,7 +342,7 @@ function ui_viewnodes_on_canvas_released() { } if (ui_menu_button(tr("Capture Output"), "", icon_t.PHOTO)) { - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { ui_nodes_capture_output(); }); } @@ -485,7 +485,7 @@ function ui_nodes_get_nodes(): ui_nodes_t { } } -function ui_nodes_update() { +function ui_nodes_update(_: any) { if (!ui_nodes_show || !base_ui_enabled) { return; } @@ -779,7 +779,7 @@ function ui_nodes_get_linked_nodes(linked_nodes: ui_node_t[], n: ui_node_t, c: u } } -function ui_nodes_render() { +function ui_nodes_render(_: any) { ui_nodes_recompile(); let ui_nodes: ui_nodes_t = ui_nodes_get_nodes(); @@ -1267,7 +1267,7 @@ function ui_nodes_draw_menubar() { ui_nodes_node_search_x = ui._window_x + ui._x; ui_nodes_node_search_y = ui._window_y + ui._y; // Allow for node menu to be closed first - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { ui_nodes_node_search(math_floor(ui_nodes_node_search_x), math_floor(ui_nodes_node_search_y)); }); } diff --git a/paint/sources/ui_toolbar.ts b/paint/sources/ui_toolbar.ts index a0e4eb42..8706742e 100644 --- a/paint/sources/ui_toolbar.ts +++ b/paint/sources/ui_toolbar.ts @@ -60,7 +60,7 @@ function ui_toolbar_draw_tool(tool: i32, img: gpu_texture_t, icon_accent: i32) { 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 && visible) { _ui_toolbar_i = tool; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { context_select_tool(_ui_toolbar_i); }); } diff --git a/paint/sources/ui_view2d.ts b/paint/sources/ui_view2d.ts index f5002cd5..f05a8fcd 100644 --- a/paint/sources/ui_view2d.ts +++ b/paint/sources/ui_view2d.ts @@ -52,7 +52,7 @@ function ui_view2d_draw_image(image: gpu_texture_t, dx: f32, dy: f32, dw: f32, d draw_scaled_image(image, dx, dy, dw, dh); } -function ui_view2d_render() { +function ui_view2d_render(_: any) { ui_view2d_ww = config_raw.layout[layout_size_t.NODES_W]; ui_view2d_wx = math_floor(sys_w()) + ui_toolbar_w(true); ui_view2d_wy = 0; @@ -240,7 +240,7 @@ function ui_view2d_render() { _ui_view2d_render_tw = tw; _ui_view2d_render_th = th; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { let rt: render_target_t = map_get(render_path_render_targets, "texpaint_picker"); let texpaint_picker: gpu_texture_t = rt._image; draw_begin(texpaint_picker); @@ -421,7 +421,7 @@ function ui_view2d_render() { ui_end(); } -function ui_view2d_update() { +function ui_view2d_update(_: any) { let headerh: f32 = UI_ELEMENT_H() * 1.4; context_raw.paint2d = false; diff --git a/paint/sources/uniforms_ext.ts b/paint/sources/uniforms_ext.ts index 0960b955..9020d9a6 100644 --- a/paint/sources/uniforms_ext.ts +++ b/paint/sources/uniforms_ext.ts @@ -345,18 +345,18 @@ function uniforms_ext_tex_link(object: object_t, mat: material_data_t, link: str else if (link == "_texuvmap") { if (!util_uv_uvmap_cached) { - sys_notify_on_next_frame(util_uv_cache_uv_map); + sys_notify_on_next_frame(function(_: any) { util_uv_cache_uv_map(); }); } return util_uv_uvmap; } else if (link == "_textrianglemap") { if (!util_uv_trianglemap_cached) { - sys_notify_on_next_frame(util_uv_cache_triangle_map); + sys_notify_on_next_frame(function(_: any) { util_uv_cache_triangle_map(); }); } return util_uv_trianglemap; } else if (link == "_texuvislandmap") { - sys_notify_on_next_frame(util_uv_cache_uv_island_map); + sys_notify_on_next_frame(function(_: any) { util_uv_cache_uv_island_map(); }); if (util_uv_uvislandmap_cached) { return util_uv_uvislandmap; } diff --git a/paint/sources/util_render.ts b/paint/sources/util_render.ts index 833936e0..e2537e75 100644 --- a/paint/sources/util_render.ts +++ b/paint/sources/util_render.ts @@ -325,7 +325,7 @@ function util_render_make_brush_preview() { context_raw.layer = _layer; context_raw.material = _material; context_raw.tool = _tool; - sys_notify_on_next_frame(function() { + sys_notify_on_next_frame(function(_: any) { make_material_parse_paint_material(false); });