diff --git a/armorlab/sources/nodes/inpaint_node.ts b/armorlab/sources/nodes/inpaint_node.ts index 59f83ec0..f9150619 100644 --- a/armorlab/sources/nodes/inpaint_node.ts +++ b/armorlab/sources/nodes/inpaint_node.ts @@ -73,7 +73,7 @@ function inpaint_node_get_as_image(self: inpaint_node_t, from: i32): image_t { console_progress(tr("Processing") + " - " + tr("Inpaint")); g2_begin(inpaint_node_image); - g2_draw_scaled_image(source, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(source, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); g2_end(); if (inpaint_node_auto) { @@ -146,7 +146,7 @@ function inpaint_node_sd_inpaint(image: image_t, mask: image_t): image_t { g2_begin(inpaint_node_temp); // g2_drawImage(image, -x * 512, -y * 512); - g2_draw_scaled_image(image, 0, 0, 512, 512); + draw_scaled_image(image, 0, 0, 512, 512); g2_end(); bytes_img = image_get_pixels(inpaint_node_temp); diff --git a/armorlab/sources/nodes/photo_to_pbr_node.ts b/armorlab/sources/nodes/photo_to_pbr_node.ts index e5360dc1..c7ee32d0 100644 --- a/armorlab/sources/nodes/photo_to_pbr_node.ts +++ b/armorlab/sources/nodes/photo_to_pbr_node.ts @@ -58,13 +58,13 @@ function photo_to_pbr_node_get_as_image(self: photo_to_pbr_node_t, from: i32): i let y: i32 = math_floor(i / tiles_x); g2_begin(photo_to_pbr_node_temp); - g2_draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w, -config_get_texture_res_x(), config_get_texture_res_y()); - g2_draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w, config_get_texture_res_x(), -config_get_texture_res_y()); - g2_draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w, -config_get_texture_res_x(), -config_get_texture_res_y()); - g2_draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, config_get_texture_res_x(), config_get_texture_res_y()); - g2_draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, -config_get_texture_res_x(), config_get_texture_res_y()); - g2_draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, config_get_texture_res_x(), -config_get_texture_res_y()); - g2_draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w, config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w, -config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w, config_get_texture_res_x(), -config_get_texture_res_y()); + draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w, -config_get_texture_res_x(), -config_get_texture_res_y()); + draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, -config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w + photo_to_pbr_node_tile_w, config_get_texture_res_x(), -config_get_texture_res_y()); + draw_scaled_image(source, photo_to_pbr_node_border_w - x * photo_to_pbr_node_tile_w, photo_to_pbr_node_border_w - y * photo_to_pbr_node_tile_w, config_get_texture_res_x(), config_get_texture_res_y()); g2_end(); let bytes_img: buffer_t = image_get_pixels(photo_to_pbr_node_temp); @@ -155,7 +155,7 @@ function photo_to_pbr_node_get_as_image(self: photo_to_pbr_node_t, from: i32): i let temp2: image_t = image_from_bytes(u8a, photo_to_pbr_node_tile_w, photo_to_pbr_node_tile_w); g2_begin(photo_to_pbr_node_images[from]); - g2_draw_image(temp2, x * photo_to_pbr_node_tile_w, y * photo_to_pbr_node_tile_w); + draw_image(temp2, x * photo_to_pbr_node_tile_w, y * photo_to_pbr_node_tile_w); g2_end(); app_notify_on_next_frame(function(temp2: image_t) { image_unload(temp2); diff --git a/armorlab/sources/nodes/tiling_node.ts b/armorlab/sources/nodes/tiling_node.ts index a7f9390b..9ab898f9 100644 --- a/armorlab/sources/nodes/tiling_node.ts +++ b/armorlab/sources/nodes/tiling_node.ts @@ -46,7 +46,7 @@ function tiling_node_button(node_id: i32) { function tiling_node_get_as_image(self: tiling_node_t, from: i32): image_t { let source: image_t = logic_node_input_get_as_image(self.base.inputs[0]); g2_begin(tiling_node_image); - g2_draw_scaled_image(source, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(source, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); g2_end(); console_progress(tr("Processing") + " - " + tr("Tiling")); @@ -68,10 +68,10 @@ function tiling_node_sd_tiling(image: image_t, seed: i32): image_t { text_to_photo_node_tiling = false; let tile: image_t = image_create_render_target(512, 512); g2_begin(tile); - g2_draw_scaled_image(image, -256, -256, 512, 512); - g2_draw_scaled_image(image, 256, -256, 512, 512); - g2_draw_scaled_image(image, -256, 256, 512, 512); - g2_draw_scaled_image(image, 256, 256, 512, 512); + draw_scaled_image(image, -256, -256, 512, 512); + draw_scaled_image(image, 256, -256, 512, 512); + draw_scaled_image(image, -256, 256, 512, 512); + draw_scaled_image(image, 256, 256, 512, 512); g2_end(); let u8a: u8_array_t = u8_array_create(512 * 512); diff --git a/armorlab/sources/nodes/upscale_node.ts b/armorlab/sources/nodes/upscale_node.ts index b5ce8ef8..e19e206c 100644 --- a/armorlab/sources/nodes/upscale_node.ts +++ b/armorlab/sources/nodes/upscale_node.ts @@ -51,7 +51,7 @@ function upscale_node_do_tile(source: image_t): image_t { } upscale_node_temp = image_create_render_target(size1w, size1h); g2_begin(upscale_node_temp); - g2_draw_scaled_image(source, 0, 0, size1w, size1h); + draw_scaled_image(source, 0, 0, size1w, size1h); g2_end(); let bytes_img: buffer_t = image_get_pixels(upscale_node_temp); @@ -106,17 +106,17 @@ function upscale_node_esrgan(source: image_t): image_t { for (let x: i32 = 0; x < math_floor(size1w / tile_size); ++x) { for (let y: i32 = 0; y < math_floor(size1h / tile_size); ++y) { g2_begin(tile_source); - g2_draw_scaled_image(source, 32 - x * tile_size, 32 - y * tile_size, -source.width, source.height); - g2_draw_scaled_image(source, 32 - x * tile_size, 32 - y * tile_size, source.width, -source.height); - g2_draw_scaled_image(source, 32 - x * tile_size, 32 - y * tile_size, -source.width, -source.height); - g2_draw_scaled_image(source, 32 - x * tile_size + tile_size, 32 - y * tile_size + tile_size, source.width, source.height); - g2_draw_scaled_image(source, 32 - x * tile_size + tile_size, 32 - y * tile_size + tile_size, -source.width, source.height); - g2_draw_scaled_image(source, 32 - x * tile_size + tile_size, 32 - y * tile_size + tile_size, source.width, -source.height); - g2_draw_scaled_image(source, 32 - x * tile_size, 32 - y * tile_size, source.width, source.height); + draw_scaled_image(source, 32 - x * tile_size, 32 - y * tile_size, -source.width, source.height); + draw_scaled_image(source, 32 - x * tile_size, 32 - y * tile_size, source.width, -source.height); + draw_scaled_image(source, 32 - x * tile_size, 32 - y * tile_size, -source.width, -source.height); + draw_scaled_image(source, 32 - x * tile_size + tile_size, 32 - y * tile_size + tile_size, source.width, source.height); + draw_scaled_image(source, 32 - x * tile_size + tile_size, 32 - y * tile_size + tile_size, -source.width, source.height); + draw_scaled_image(source, 32 - x * tile_size + tile_size, 32 - y * tile_size + tile_size, source.width, -source.height); + draw_scaled_image(source, 32 - x * tile_size, 32 - y * tile_size, source.width, source.height); g2_end(); let tile_result: image_t = upscale_node_do_tile(tile_source); g2_begin(result); - g2_draw_sub_image(tile_result, x * tile_size2x, y * tile_size2x, 64, 64, tile_size2x, tile_size2x); + draw_sub_image(tile_result, x * tile_size2x, y * tile_size2x, 64, 64, tile_size2x, tile_size2x); g2_end(); image_unload(tile_result); } diff --git a/armorlab/sources/nodes/variance_node.ts b/armorlab/sources/nodes/variance_node.ts index 73ee249b..169e7396 100644 --- a/armorlab/sources/nodes/variance_node.ts +++ b/armorlab/sources/nodes/variance_node.ts @@ -39,7 +39,7 @@ function variance_node_get_as_image(self: variance_node_t, from: i32): image_t { let source: image_t = logic_node_input_get_as_image(variance_node_inst.base.inputs[0]); g2_begin(variance_node_temp); - g2_draw_scaled_image(source, 0, 0, 512, 512); + draw_scaled_image(source, 0, 0, 512, 512); g2_end(); let bytes_img: buffer_t = image_get_pixels(variance_node_temp); diff --git a/armorlab/sources/ui_nodes_ext.ts b/armorlab/sources/ui_nodes_ext.ts index 9e055827..5072fb8e 100644 --- a/armorlab/sources/ui_nodes_ext.ts +++ b/armorlab/sources/ui_nodes_ext.ts @@ -48,14 +48,14 @@ function ui_nodes_ext_run() { if (texbase != null) { let texpaint: render_target_t = map_get(render_path_render_targets, "texpaint"); g2_begin(texpaint._image); - g2_draw_scaled_image(texbase, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(texbase, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); g2_end(); } if (texnor != null) { let texpaint_nor: render_target_t = map_get(render_path_render_targets, "texpaint_nor"); g2_begin(texpaint_nor._image); - g2_draw_scaled_image(texnor, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(texnor, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); g2_end(); } @@ -64,7 +64,7 @@ function ui_nodes_ext_run() { if (texocc != null) { g2_begin(texpaint_pack._image); g2_set_pipeline(pipes_copy_r); - g2_draw_scaled_image(texocc, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(texocc, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); g2_set_pipeline(null); g2_end(); } @@ -72,7 +72,7 @@ function ui_nodes_ext_run() { if (texrough != null) { g2_begin(texpaint_pack._image); g2_set_pipeline(pipes_copy_g); - g2_draw_scaled_image(texrough, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(texrough, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); g2_set_pipeline(null); g2_end(); } diff --git a/armorpaint/sources/layers_ext.ts b/armorpaint/sources/layers_ext.ts index 08354e1b..9acbce0f 100644 --- a/armorpaint/sources/layers_ext.ts +++ b/armorpaint/sources/layers_ext.ts @@ -52,7 +52,7 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t if (l1.paint_base) { g2_begin(layers_temp_image); // Copy to temp g2_set_pipeline(pipes_copy); - g2_draw_image(layers_expa, 0, 0); + draw_image(layers_expa, 0, 0); g2_set_pipeline(null); g2_end(); @@ -60,7 +60,7 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t // Do not multiply basecol by alpha g2_begin(layers_expa); // Copy to temp g2_set_pipeline(pipes_copy); - g2_draw_image(l1.texpaint, 0, 0); + draw_image(l1.texpaint, 0, 0); g2_set_pipeline(null); g2_end(); ///else @@ -82,7 +82,7 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t if (l1.paint_nor) { g2_begin(layers_temp_image); g2_set_pipeline(pipes_copy); - g2_draw_image(layers_expb, 0, 0); + draw_image(layers_expb, 0, 0); g2_set_pipeline(null); g2_end(); @@ -103,7 +103,7 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t if (l1.paint_occ || l1.paint_rough || l1.paint_met || l1.paint_height) { g2_begin(layers_temp_image); g2_set_pipeline(pipes_copy); - g2_draw_image(layers_expc, 0, 0); + draw_image(layers_expc, 0, 0); g2_set_pipeline(null); g2_end(); @@ -145,7 +145,7 @@ function layers_ext_flatten(height_to_normal: bool = false, layers: slot_layer_t g2_begin(layers_temp_image); g2_set_pipeline(pipes_copy); - g2_draw_image(l0.texpaint_nor, 0, 0); + draw_image(l0.texpaint_nor, 0, 0); g2_set_pipeline(null); g2_end(); diff --git a/armorpaint/sources/make_material.ts b/armorpaint/sources/make_material.ts index 2566cfa0..f36cbe4d 100644 --- a/armorpaint/sources/make_material.ts +++ b/armorpaint/sources/make_material.ts @@ -368,7 +368,7 @@ function make_material_bake_node_preview(node: ui_node_t, group: ui_node_canvas_ let texpaint_live: render_target_t = map_get(rts, "texpaint_live"); g2_begin(image); - g2_draw_image(texpaint_live._image, 0, 0); + draw_image(texpaint_live._image, 0, 0); g2_end(); } } diff --git a/armorpaint/sources/ui_header_ext.ts b/armorpaint/sources/ui_header_ext.ts index 947075fd..acd8c98c 100644 --- a/armorpaint/sources/ui_header_ext.ts +++ b/armorpaint/sources/ui_header_ext.ts @@ -178,7 +178,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { tr("Object ID"), tr("Vertex Color"), ]; - if (iron_raytrace_supported()) { + if (kinc_g5_raytrace_supported()) { array_push(bakes, tr("Lightmap")); array_push(bakes, tr("Bent Normal")); array_push(bakes, tr("Thickness")); @@ -189,7 +189,7 @@ function ui_header_draw_tool_properties(ui: ui_t) { context_raw.bake_type = ui_combo(bake_handle, bakes, tr("Bake")); - if (!iron_raytrace_supported()) { + if (!kinc_g5_raytrace_supported()) { context_raw.bake_type += 1; // Offset for removed AO } diff --git a/armorsculpt/sources/import_mesh.ts b/armorsculpt/sources/import_mesh.ts index 974657fe..9c3a594e 100644 --- a/armorsculpt/sources/import_mesh.ts +++ b/armorsculpt/sources/import_mesh.ts @@ -234,7 +234,7 @@ function import_mesh_pack_to_texture(mesh: raw_mesh_t) { let texpaint: image_t = project_layers[0].texpaint; g2_begin(texpaint); g2_set_pipeline(pipes_copy128); - g2_draw_scaled_image(imgmesh, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); + draw_scaled_image(imgmesh, 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); g2_set_pipeline(null); g2_end(); } diff --git a/base/sources/backends/direct3d12_gpu.c b/base/sources/backends/direct3d12_gpu.c index b1f5d6ca..379feaed 100644 --- a/base/sources/backends/direct3d12_gpu.c +++ b/base/sources/backends/direct3d12_gpu.c @@ -545,7 +545,7 @@ bool kinc_g5_swap_buffers() { void kinc_g5_flush() {} -bool kinc_g5_supports_raytracing() { +bool kinc_g5_raytrace_supported() { D3D12_FEATURE_DATA_D3D12_OPTIONS5 options; if (device->lpVtbl->CheckFeatureSupport(device, D3D12_FEATURE_D3D12_OPTIONS5, &options, sizeof(options)) == S_OK) { return options.RaytracingTier >= D3D12_RAYTRACING_TIER_1_0; diff --git a/base/sources/backends/metal_gpu.m b/base/sources/backends/metal_gpu.m index 3e792dda..7b37d49a 100644 --- a/base/sources/backends/metal_gpu.m +++ b/base/sources/backends/metal_gpu.m @@ -225,8 +225,8 @@ void kinc_g5_internal_new_render_pass(kinc_g5_render_target_t **renderTargets, i render_command_encoder = [command_buffer renderCommandEncoderWithDescriptor:renderPassDescriptor]; } -bool kinc_g5_supports_raytracing(void) { - return false; +bool kinc_g5_raytrace_supported(void) { + return true; } int kinc_g5_max_bound_textures(void) { diff --git a/base/sources/backends/vulkan_gpu.c b/base/sources/backends/vulkan_gpu.c index c76eaff3..e1d076a5 100644 --- a/base/sources/backends/vulkan_gpu.c +++ b/base/sources/backends/vulkan_gpu.c @@ -806,7 +806,7 @@ void kinc_g5_internal_init() { // Allows negative viewport height to flip viewport wanted_device_extensions[wanted_device_extension_count++] = VK_KHR_MAINTENANCE1_EXTENSION_NAME; - if (kinc_g5_supports_raytracing()) { + if (kinc_g5_raytrace_supported()) { wanted_device_extensions[wanted_device_extension_count++] = VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME; wanted_device_extensions[wanted_device_extension_count++] = VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME; wanted_device_extensions[wanted_device_extension_count++] = VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME; @@ -941,7 +941,7 @@ void kinc_g5_internal_init() { VkPhysicalDeviceRayTracingPipelineFeaturesKHR rayTracingPipelineExt = {0}; VkPhysicalDeviceAccelerationStructureFeaturesKHR rayTracingAccelerationStructureExt = {0}; VkPhysicalDeviceBufferDeviceAddressFeatures bufferDeviceAddressExt = {0}; - if (kinc_g5_supports_raytracing()) { + if (kinc_g5_raytrace_supported()) { rayTracingPipelineExt.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR; rayTracingPipelineExt.pNext = NULL; rayTracingPipelineExt.rayTracingPipeline = VK_TRUE; @@ -1146,7 +1146,7 @@ bool kinc_vulkan_internal_get_size(int *width, int *height) { } } -bool kinc_g5_supports_raytracing() { +bool kinc_g5_raytrace_supported() { #ifdef KINC_ANDROID return false; #else @@ -4433,7 +4433,7 @@ void kinc_g5_vertex_buffer_init(kinc_g5_vertex_buffer_t *buffer, int vertexCount buf_info.size = vertexCount * buffer->impl.myStride; buf_info.usage = VK_BUFFER_USAGE_VERTEX_BUFFER_BIT; - if (kinc_g5_supports_raytracing()) { + if (kinc_g5_raytrace_supported()) { buf_info.usage |= VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT; buf_info.usage |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; buf_info.usage |= VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR; @@ -4465,7 +4465,7 @@ void kinc_g5_vertex_buffer_init(kinc_g5_vertex_buffer_t *buffer, int vertexCount assert(pass); VkMemoryAllocateFlagsInfo memory_allocate_flags_info = {0}; - if (kinc_g5_supports_raytracing()) { + if (kinc_g5_raytrace_supported()) { memory_allocate_flags_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO; memory_allocate_flags_info.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR; buffer->impl.mem_alloc.pNext = &memory_allocate_flags_info; @@ -4527,7 +4527,7 @@ static void createUniformBuffer(VkBuffer *buf, VkMemoryAllocateInfo *mem_alloc, buf_info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; buf_info.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; - if (kinc_g5_supports_raytracing()) { + if (kinc_g5_raytrace_supported()) { buf_info.usage |= VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; } @@ -4616,7 +4616,7 @@ void kinc_g5_index_buffer_init(kinc_g5_index_buffer_t *buffer, int indexCount, b buf_info.size = indexCount * sizeof(uint32_t); buf_info.usage = VK_BUFFER_USAGE_INDEX_BUFFER_BIT; - if (kinc_g5_supports_raytracing()) { + if (kinc_g5_raytrace_supported()) { buf_info.usage |= VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT; buf_info.usage |= VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; buf_info.usage |= VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR; @@ -4644,7 +4644,7 @@ void kinc_g5_index_buffer_init(kinc_g5_index_buffer_t *buffer, int indexCount, b assert(pass); VkMemoryAllocateFlagsInfo memory_allocate_flags_info = {0}; - if (kinc_g5_supports_raytracing()) { + if (kinc_g5_raytrace_supported()) { memory_allocate_flags_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO; memory_allocate_flags_info.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR; buffer->impl.mem_alloc.pNext = &memory_allocate_flags_info; diff --git a/base/sources/backends/webgpu_gpu.c b/base/sources/backends/webgpu_gpu.c index 0a131db8..d147b64f 100644 --- a/base/sources/backends/webgpu_gpu.c +++ b/base/sources/backends/webgpu_gpu.c @@ -59,7 +59,7 @@ bool kinc_g5_swap_buffers() { void kinc_g5_flush() {} -bool kinc_g5_supports_raytracing() { +bool kinc_g5_raytrace_supported() { return false; } @@ -69,9 +69,6 @@ bool kinc_g5_supports_raytracing() { - - - #include #include #include diff --git a/base/sources/iron.h b/base/sources/iron.h index bff3b798..2fa0f0ff 100644 --- a/base/sources/iron.h +++ b/base/sources/iron.h @@ -6,10 +6,10 @@ #include #include #include -#include -#include -#include -#include +#include "iron_system.h" +#include "iron_thread.h" +#include "iron_gpu.h" +#include "iron_file.h" #include "iron_string.h" #include "iron_array.h" #include "iron_map.h" @@ -25,16 +25,13 @@ #include "iron_mat4.h" #include "iron_ui.h" #include "iron_ui_nodes.h" +#include "iron_draw.h" #ifdef KINC_WINDOWS #include #endif -#if defined(IDLE_SLEEP) && !defined(KINC_WINDOWS) -#include -#endif #ifdef WITH_AUDIO -#include +#include "iron_audio.h" #endif -#include "iron_draw.h" #ifdef WITH_EMBED #include EMBED_H_PATH #endif @@ -199,7 +196,7 @@ int last_window_height = 0; char temp_string[1024 * 32]; char temp_string_vs[1024 * 128]; char temp_string_fs[1024 * 128]; -char temp_string_vstruct[32][32]; +char temp_string_vstruct[8][32]; #ifdef KINC_WINDOWS wchar_t temp_wstring[1024 * 32]; struct HWND__ *kinc_windows_window_handle(); @@ -256,14 +253,11 @@ int kickstart(int argc, char **argv) { HMODULE hmodule = GetModuleHandleW(NULL); GetModuleFileNameW(hmodule, temp_wstring, 1024); WideCharToMultiByte(CP_UTF8, 0, temp_wstring, -1, temp_string, 4096, NULL, NULL); - bindir = temp_string; -#endif - -#ifdef KINC_WINDOWS - bindir = _substring(bindir, 0, string_last_index_of(bindir, "\\")); + bindir = _substring(temp_string, 0, string_last_index_of(temp_string, "\\")); #else bindir = _substring(bindir, 0, string_last_index_of(bindir, "/")); #endif + char *assetsdir = argc > 1 ? argv[1] : bindir; // Opening a file @@ -284,14 +278,6 @@ int kickstart(int argc, char **argv) { kinc_internal_set_files_location(assetsdir); #endif -#ifdef KINC_MACOS - // Handle loading assets located outside of '.app/Contents/Resources/Deployment' folder - // when assets and shaders dir is passed as an argument - if (argc > 2) { - kinc_internal_set_files_location(&assetsdir[0u]); - } -#endif - kinc_threads_init(); kinc_display_init(); @@ -329,13 +315,13 @@ string_t *iron_get_arg(i32 index) { #ifndef NO_IRON_API #include -#include -#include +#include "iron_math.h" +#include "iron_net.h" #include +#include "dir.h" #ifdef WITH_AUDIO -#include +#include "iron_audio.h" #endif -int LZ4_decompress_safe(const char *source, char *dest, int compressed_size, int maxOutputSize); #define STB_IMAGE_IMPLEMENTATION #include #ifdef KINC_DIRECT3D12 @@ -355,7 +341,6 @@ extern bool waitAfterNextDraw; #include #include #endif -#include "dir.h" #ifdef WITH_IMAGE_WRITE #ifdef WITH_COMPRESS unsigned char *iron_deflate_raw(unsigned char *data, int data_len, int *out_len, int quality); @@ -799,13 +784,6 @@ i32 color_set_ab(i32 c, u8 i) { return (i << 24) | (color_get_rb(c) << 16) | (color_get_gb(c) << 8) | color_get_bb(c); } -// ██╗ ██╗ ██████╗ ██████╗ ███╗ ███╗ -// ██║ ██╔╝ ██╔══██╗ ██╔═══██╗ ████╗ ████║ -// █████╔╝ ██████╔╝ ██║ ██║ ██╔████╔██║ -// ██╔═██╗ ██╔══██╗ ██║ ██║ ██║╚██╔╝██║ -// ██║ ██╗ ██║ ██║ ╚██████╔╝ ██║ ╚═╝ ██║ -// ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ - void iron_init(string_t *title, i32 width, i32 height, bool vsync, i32 window_mode, i32 window_features, i32 x, i32 y, i32 frequency, bool use_depth) { kinc_window_options_t win; kinc_framebuffer_options_t frame; @@ -1314,24 +1292,7 @@ typedef struct vertex_struct { any_array_t *elements; // kinc_vertex_elem_t } vertex_struct_t; -typedef struct iron_pipeline_state { - int cull_mode; // cull_mode_t; - bool depth_write; - int depth_mode; // compare_mode_t; - int blend_source; // blend_factor_t; - int blend_dest; // blend_factor_t; - int alpha_blend_source; // blend_factor_t; - int alpha_blend_dest; // blend_factor_t; - u8_array_t *color_write_masks_red; - u8_array_t *color_write_masks_green; - u8_array_t *color_write_masks_blue; - u8_array_t *color_write_masks_alpha; - int color_attachment_count; - i32_array_t *color_attachments; // tex_format_t - int depth_attachment_bits; -} iron_pipeline_state_t; - -void iron_g4_compile_pipeline(kinc_g5_pipeline_t *pipeline, vertex_struct_t *structure0, kinc_g5_shader_t *vertex_shader, kinc_g5_shader_t *fragment_shader, iron_pipeline_state_t *state) { +void iron_g4_compile_pipeline(kinc_g5_pipeline_t *pipeline, vertex_struct_t *structure0) { kinc_g5_vertex_structure_t s0; kinc_g5_vertex_structure_init(&s0); @@ -1341,38 +1302,8 @@ void iron_g4_compile_pipeline(kinc_g5_pipeline_t *pipeline, vertex_struct_t *str strcpy(temp_string_vstruct[i], element->name); kinc_g5_vertex_structure_add(&s0, temp_string_vstruct[i], (kinc_g5_vertex_data_t)element->data); } - - pipeline->vertex_shader = vertex_shader; - pipeline->fragment_shader = fragment_shader; pipeline->input_layout = &s0; - pipeline->cull_mode = (kinc_g5_cull_mode_t)state->cull_mode; - pipeline->depth_write = state->depth_write; - pipeline->depth_mode = (kinc_g5_compare_mode_t)state->depth_mode; - pipeline->blend_source = (kinc_g5_blending_factor_t)state->blend_source; - pipeline->blend_destination = (kinc_g5_blending_factor_t)state->blend_dest; - pipeline->alpha_blend_source = (kinc_g5_blending_factor_t)state->alpha_blend_source; - pipeline->alpha_blend_destination = (kinc_g5_blending_factor_t)state->alpha_blend_dest; - - u8_array_t *mask_red_array = state->color_write_masks_red; - u8_array_t *mask_green_array = state->color_write_masks_green; - u8_array_t *mask_blue_array = state->color_write_masks_blue; - u8_array_t *mask_alpha_array = state->color_write_masks_alpha; - - for (int i = 0; i < 8; ++i) { - pipeline->color_write_mask_red[i] = mask_red_array->buffer[i]; - pipeline->color_write_mask_green[i] = mask_green_array->buffer[i]; - pipeline->color_write_mask_blue[i] = mask_blue_array->buffer[i]; - pipeline->color_write_mask_alpha[i] = mask_alpha_array->buffer[i]; - } - - pipeline->color_attachment_count = state->color_attachment_count; - i32_array_t *color_attachment_array = state->color_attachments; - for (int i = 0; i < 8; ++i) { - pipeline->color_attachment[i] = (kinc_image_format_t)color_attachment_array->buffer[i]; - } - pipeline->depth_attachment_bits = state->depth_attachment_bits; - kinc_g5_pipeline_compile(pipeline); } @@ -1603,14 +1534,6 @@ i32 iron_screen_dpi() { return kinc_display_current_mode(kinc_primary_display()).pixels_per_inch; } -void iron_request_shutdown() { - kinc_stop(); - - #ifdef KINC_LINUX - exit(1); - #endif -} - i32 iron_display_width(i32 index) { return kinc_display_current_mode(index).width; } @@ -1632,11 +1555,7 @@ i32 iron_display_frequency(i32 index) { } bool iron_display_is_primary(i32 index) { - #ifdef KINC_LINUX // TODO: Primary display detection broken in Kinc - return true; - #else return index == kinc_primary_display(); - #endif } kinc_g5_render_target_t *iron_g4_create_render_target(i32 width, i32 height, i32 format, i32 depth_buffer_bits) { @@ -1780,18 +1699,6 @@ void iron_g4_set_mipmaps(kinc_g5_texture_t *texture, any_array_t *mipmaps) { } } -void iron_g4_viewport(i32 x, i32 y, i32 width, i32 height) { - kinc_g4_viewport(x, y, width, height); -} - -void iron_g4_scissor(i32 x, i32 y, i32 width, i32 height) { - kinc_g4_scissor(x, y, width, height); -} - -void iron_g4_disable_scissor() { - kinc_g4_disable_scissor(); -} - void iron_g4_begin(image_t *render_target, any_array_t *additional) { if (render_target == NULL) { kinc_g4_restore_render_target(); @@ -1816,7 +1723,6 @@ void iron_g4_begin(image_t *render_target, any_array_t *additional) { } void iron_g4_end() { - } void iron_g4_swap_buffers() { @@ -1859,10 +1765,6 @@ i32 iron_sys_command(string_t *cmd) { return result; } -string_t *iron_save_path() { - return kinc_internal_save_path(); -} - string_t *iron_get_files_location() { #ifdef KINC_MACOS char path[1024]; @@ -2514,10 +2416,6 @@ void iron_ml_unload() { } #endif -bool iron_raytrace_supported() { - return kinc_g5_raytrace_supported(); -} - void iron_raytrace_init(buffer_t *shader) { if (raytrace_created) { kinc_g5_constant_buffer_destroy(&constant_buffer); @@ -2660,21 +2558,4 @@ void iron_raytrace_dispatch_rays(kinc_g5_render_target_t *render_target, buffer_ kinc_g5_raytrace_dispatch_rays(&commandList); } -i32 iron_window_x() { - return kinc_window_x(); -} - -i32 iron_window_y() { - return kinc_window_y(); -} - -char *iron_language() { - return kinc_language(); -} - -raw_mesh_t *iron_obj_parse(buffer_t *file_bytes, i32 split_code, u64 start_pos, bool udim) { - raw_mesh_t *part = obj_parse(file_bytes, split_code, start_pos, udim); - return part; -} - #endif diff --git a/base/sources/iron_draw.c b/base/sources/iron_draw.c index 2101d021..b61b6f2a 100644 --- a/base/sources/iron_draw.c +++ b/base/sources/iron_draw.c @@ -373,15 +373,15 @@ void draw_scaled_sub_texture(kinc_g5_texture_t *tex, float sx, float sy, float s image_last_render_target = NULL; } -void draw_scaled_image(kinc_g5_texture_t *tex, float dx, float dy, float dw, float dh) { +void draw_scaled_texture(kinc_g5_texture_t *tex, float dx, float dy, float dw, float dh) { draw_scaled_sub_texture(tex, 0, 0, (float)tex->width, (float)tex->height, dx, dy, dw, dh); } -void draw_sub_image(kinc_g5_texture_t *tex, float sx, float sy, float sw, float sh, float x, float y) { +void draw_sub_texture(kinc_g5_texture_t *tex, float sx, float sy, float sw, float sh, float x, float y) { draw_scaled_sub_texture(tex, sx, sy, sw, sh, x, y, sw, sh); } -void draw_image(kinc_g5_texture_t *tex, float x, float y) { +void draw_texture(kinc_g5_texture_t *tex, float x, float y) { draw_scaled_sub_texture(tex, 0, 0, (float)tex->width, (float)tex->height, x, y, (float)tex->width, (float)tex->height); } @@ -432,6 +432,18 @@ void draw_scaled_sub_image(image_t *image, float sx, float sy, float sw, float s } } +void draw_scaled_image(image_t *tex, float dx, float dy, float dw, float dh) { + draw_scaled_sub_image(tex, 0, 0, (float)tex->width, (float)tex->height, dx, dy, dw, dh); +} + +void draw_sub_image(image_t *tex, float sx, float sy, float sw, float sh, float x, float y) { + draw_scaled_sub_image(tex, sx, sy, sw, sh, x, y, sw, sh); +} + +void draw_image(image_t *tex, float x, float y) { + draw_scaled_sub_image(tex, 0, 0, (float)tex->width, (float)tex->height, x, y, (float)tex->width, (float)tex->height); +} + void draw_colored_rect_set_verts(float btlx, float btly, float tplx, float tply, float tprx, float tpry, float btrx, float btry) { int base_idx = (colored_rect_buffer_index - colored_rect_buffer_start) * 4 * 4; colored_rect_verts[base_idx + 0] = btlx; diff --git a/base/sources/iron_draw.h b/base/sources/iron_draw.h index 47c83ca8..f33f7079 100644 --- a/base/sources/iron_draw.h +++ b/base/sources/iron_draw.h @@ -43,9 +43,12 @@ void draw_init(buffer_t *image_vert, buffer_t *image_frag, buffer_t *colored_ver void draw_begin(void); void draw_scaled_sub_image(image_t *img, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh); void draw_scaled_sub_texture(kinc_g5_texture_t *tex, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh); -void draw_scaled_image(kinc_g5_texture_t *tex, float dx, float dy, float dw, float dh); -void draw_sub_image(kinc_g5_texture_t *tex, float sx, float sy, float sw, float sh, float x, float y); -void draw_image(kinc_g5_texture_t *tex, float x, float y); +void draw_scaled_image(image_t *tex, float dx, float dy, float dw, float dh); +void draw_sub_image(image_t *tex, float sx, float sy, float sw, float sh, float x, float y); +void draw_image(image_t *tex, float x, float y); +void draw_scaled_texture(kinc_g5_texture_t *tex, float dx, float dy, float dw, float dh); +void draw_sub_texture(kinc_g5_texture_t *tex, float sx, float sy, float sw, float sh, float x, float y); +void draw_texture(kinc_g5_texture_t *tex, float x, float y); void draw_scaled_sub_render_target(kinc_g5_render_target_t *rt, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh); void draw_scaled_render_target(kinc_g5_render_target_t *rt, float dx, float dy, float dw, float dh); void draw_sub_render_target(kinc_g5_render_target_t *rt, float sx, float sy, float sw, float sh, float x, float y); diff --git a/base/sources/iron_gpu.h b/base/sources/iron_gpu.h index 8c5d2b37..6ddafd17 100644 --- a/base/sources/iron_gpu.h +++ b/base/sources/iron_gpu.h @@ -25,7 +25,6 @@ typedef struct kinc_g5_render_target { RenderTarget5Impl impl; } kinc_g5_render_target_t; -bool kinc_g5_supports_raytracing(void); int kinc_g5_max_bound_textures(void); void kinc_g5_flush(void); void kinc_g5_begin(kinc_g5_render_target_t *renderTarget); @@ -450,8 +449,8 @@ typedef struct kinc_g5_pipeline { bool color_write_mask_blue[8]; bool color_write_mask_alpha[8]; - int color_attachment_count; kinc_image_format_t color_attachment[8]; + int color_attachment_count; int depth_attachment_bits; PipelineState5Impl impl; diff --git a/base/sources/iron_ui.c b/base/sources/iron_ui.c index 7f92bb3b..37df1774 100644 --- a/base/sources/iron_ui.c +++ b/base/sources/iron_ui.c @@ -630,8 +630,8 @@ void ui_draw_tooltip_image(bool bind_global_g) { draw_filled_rect(current->tooltip_x, current->tooltip_y, w, h); draw_set_color(0xffffffff); current->tooltip_invert_y ? - draw_scaled_image(current->tooltip_img, current->tooltip_x, current->tooltip_y + h, w, -h) : - draw_scaled_image(current->tooltip_img, current->tooltip_x, current->tooltip_y, w, h); + draw_scaled_texture(current->tooltip_img, current->tooltip_x, current->tooltip_y + h, w, -h) : + draw_scaled_texture(current->tooltip_img, current->tooltip_x, current->tooltip_y, w, h); } void ui_draw_tooltip_rt(bool bind_global_g) { @@ -1896,7 +1896,7 @@ static void _draw_scaled_image(void *image, bool is_rt, float dx, float dy, floa draw_scaled_render_target((kinc_g5_render_target_t *)image, dx, dy, dw, dh); } else { - draw_scaled_image((kinc_g5_texture_t *)image, dx, dy, dw, dh); + draw_scaled_texture((kinc_g5_texture_t *)image, dx, dy, dw, dh); } } diff --git a/base/sources/ts/base.ts b/base/sources/ts/base.ts index 2a6498cf..16b42a86 100644 --- a/base/sources/ts/base.ts +++ b/base/sources/ts/base.ts @@ -596,12 +596,12 @@ function base_render() { let bg_rect: rect_t = base_get_drag_background(); if (bg_rect != null) { - g2_draw_scaled_sub_image(resource_get("icons.k"), bg_rect.x, bg_rect.y, bg_rect.w, bg_rect.h, mouse_x + base_drag_off_x, mouse_y + base_drag_off_y + inv, size, h - inv * 2); + draw_scaled_sub_image(resource_get("icons.k"), bg_rect.x, bg_rect.y, bg_rect.w, bg_rect.h, mouse_x + base_drag_off_x, mouse_y + base_drag_off_y + inv, size, h - inv * 2); } base_drag_rect == null ? - g2_draw_scaled_image(img, mouse_x + base_drag_off_x, mouse_y + base_drag_off_y + inv, size, h - inv * 2) : - g2_draw_scaled_sub_image(img, base_drag_rect.x, base_drag_rect.y, base_drag_rect.w, base_drag_rect.h, mouse_x + base_drag_off_x, mouse_y + base_drag_off_y + inv, size, h - inv * 2); + draw_scaled_image(img, mouse_x + base_drag_off_x, mouse_y + base_drag_off_y + inv, size, h - inv * 2) : + draw_scaled_sub_image(img, base_drag_rect.x, base_drag_rect.y, base_drag_rect.w, base_drag_rect.h, mouse_x + base_drag_off_x, mouse_y + base_drag_off_y + inv, size, h - inv * 2); g2_set_color(0xffffffff); } diff --git a/base/sources/ts/config.ts b/base/sources/ts/config.ts index f7d75cc7..34cb863e 100644 --- a/base/sources/ts/config.ts +++ b/base/sources/ts/config.ts @@ -9,14 +9,14 @@ let config_button_spacing: string = config_default_button_spacing; function config_load() { let path: string = ""; if (path_is_protected()) { - path += iron_save_path(); + path += kinc_internal_save_path(); } path += "config.json"; let blob: buffer_t = data_get_blob(path); ///if arm_linux if (blob == null) { // Protected directory - blob = data_get_blob(iron_save_path() + "config.json"); + blob = data_get_blob(kinc_internal_save_path() + "config.json"); } ///end @@ -31,7 +31,7 @@ function config_save() { // when running from protected path like "Program Files" let path: string = ""; if (path_is_protected()) { - path += iron_save_path(); + path += kinc_internal_save_path(); } else { path += path_data(); @@ -108,7 +108,7 @@ function config_save() { ///if arm_linux // Protected directory if (!file_exists(path)) { - iron_file_save_bytes(iron_save_path() + "config.json", buffer, 0); + iron_file_save_bytes(kinc_internal_save_path() + "config.json", buffer, 0); } ///end } diff --git a/base/sources/ts/console.ts b/base/sources/ts/console.ts index 7cc76b95..8166d2b7 100644 --- a/base/sources/ts/console.ts +++ b/base/sources/ts/console.ts @@ -7,15 +7,15 @@ let console_progress_text: string = null; function console_draw_toast(s: string) { g2_set_color(0x55000000); - g2_fill_rect(0, 0, sys_width(), sys_height()); + draw_filled_rect(0, 0, sys_width(), sys_height()); let scale: f32 = ui_SCALE(base_get_uis()[0]); let x: f32 = sys_width() / 2; let y: f32 = sys_height() - 200 * scale; - g2_fill_rect(x - 200 * scale, y, 400 * scale, 80 * scale); + draw_filled_rect(x - 200 * scale, y, 400 * scale, 80 * scale); g2_set_font(base_font); g2_set_font_size(math_floor(22 * scale)); g2_set_color(0xffffffff); - g2_draw_string(s, x - g2_font_width(_g2_font, _g2_font_size, s) / 2, y + 40 * scale - g2_font_height(_g2_font, _g2_font_size) / 2); + draw_string(s, x - g2_font_width(_g2_font, _g2_font_size, s) / 2, y + 40 * scale - g2_font_height(_g2_font, _g2_font_size) / 2); } function _console_toast_render(s: string) { diff --git a/base/sources/ts/export_arm.ts b/base/sources/ts/export_arm.ts index bfac7def..cf1b5cb3 100644 --- a/base/sources/ts/export_arm.ts +++ b/base/sources/ts/export_arm.ts @@ -178,7 +178,7 @@ function export_arm_run_project() { let mesh_icon: image_t = image_create_render_target(256, 256); let r: f32 = app_w() / app_h(); g2_begin(mesh_icon); - g2_draw_scaled_image(tex, -(256 * r - 256) / 2, 0, 256 * r, 256); + draw_scaled_image(tex, -(256 * r - 256) / 2, 0, 256 * r, 256); g2_end(); ///if arm_metal @@ -489,7 +489,7 @@ function export_arm_pack_assets(raw: project_format_t, assets: asset_t[]) { let image: image_t = project_get_image(assets[i]); let temp: image_t = image_create_render_target(image.width, image.height); g2_begin(temp); - g2_draw_image(image, 0, 0); + draw_image(image, 0, 0); g2_end(); array_push(temp_images, temp); let pa: packed_asset_t = { diff --git a/base/sources/ts/export_texture.ts b/base/sources/ts/export_texture.ts index 87acb3ef..614e7cd0 100644 --- a/base/sources/ts/export_texture.ts +++ b/base/sources/ts/export_texture.ts @@ -244,7 +244,7 @@ function export_texture_run_layers(path: string, layers: slot_layer_t[], object_ if (l1.paint_base) { g2_begin(layers_temp_image); // Copy to temp g2_set_pipeline(pipes_copy); - g2_draw_image(layers_expa, 0, 0); + draw_image(layers_expa, 0, 0); g2_set_pipeline(null); g2_end(); @@ -265,7 +265,7 @@ function export_texture_run_layers(path: string, layers: slot_layer_t[], object_ if (l1.paint_nor) { g2_begin(layers_temp_image); g2_set_pipeline(pipes_copy); - g2_draw_image(layers_expb, 0, 0); + draw_image(layers_expb, 0, 0); g2_set_pipeline(null); g2_end(); @@ -286,7 +286,7 @@ function export_texture_run_layers(path: string, layers: slot_layer_t[], object_ if (l1.paint_occ || l1.paint_rough || l1.paint_met || l1.paint_height) { g2_begin(layers_temp_image); g2_set_pipeline(pipes_copy); - g2_draw_image(layers_expc, 0, 0); + draw_image(layers_expc, 0, 0); g2_set_pipeline(null); g2_end(); diff --git a/base/sources/ts/file.ts b/base/sources/ts/file.ts index 74b9c0d4..3d14c372 100644 --- a/base/sources/ts/file.ts +++ b/base/sources/ts/file.ts @@ -131,7 +131,7 @@ function file_download(url: string, dst_path: string, done: (url: string)=>void, function file_download_bytes(url: string, done: (url: string, ab: buffer_t)=>void) { let save: string; if (path_is_protected()) { - save = iron_save_path(); + save = kinc_internal_save_path(); } else { save = path_data() + path_sep; @@ -155,7 +155,7 @@ function file_cache_cloud(path: string, done: (s: string)=>void) { ///end let dest: string; if (path_is_protected()) { - dest = iron_save_path(); + dest = kinc_internal_save_path(); } else { dest = iron_get_files_location() + path_sep; @@ -168,7 +168,7 @@ function file_cache_cloud(path: string, done: (s: string)=>void) { ///else let p: string; if (path_is_protected()) { - p = iron_save_path(); + p = kinc_internal_save_path(); } else { p = path_working_dir() + path_sep; @@ -203,7 +203,7 @@ function file_cache_cloud(path: string, done: (s: string)=>void) { ///else let p: string; if (path_is_protected()) { - p = iron_save_path(); + p = kinc_internal_save_path(); } else { p = path_working_dir() + path_sep; diff --git a/base/sources/ts/import_arm.ts b/base/sources/ts/import_arm.ts index 61ae2452..b2d4130d 100644 --- a/base/sources/ts/import_arm.ts +++ b/base/sources/ts/import_arm.ts @@ -247,7 +247,7 @@ function import_arm_run_project(path: string) { g2_begin(l.texpaint); // g2_set_pipeline(pipes_copy8); g2_set_pipeline(project.is_bgra ? pipes_copy_bgra : pipes_copy); // Full bits for undo support, R8 is used - g2_draw_image(_texpaint, 0, 0); + draw_image(_texpaint, 0, 0); g2_set_pipeline(null); g2_end(); } @@ -256,7 +256,7 @@ function import_arm_run_project(path: string) { _texpaint = image_from_bytes(lz4_decode(ld.texpaint, ld.res * ld.res * 4 * bytes_per_pixel), ld.res, ld.res, format); g2_begin(l.texpaint); g2_set_pipeline(project.is_bgra ? pipes_copy_bgra : pipes_copy); - g2_draw_image(_texpaint, 0, 0); + draw_image(_texpaint, 0, 0); g2_set_pipeline(null); g2_end(); @@ -264,14 +264,14 @@ function import_arm_run_project(path: string) { _texpaint_nor = image_from_bytes(lz4_decode(ld.texpaint_nor, ld.res * ld.res * 4 * bytes_per_pixel), ld.res, ld.res, format); g2_begin(l.texpaint_nor); g2_set_pipeline(project.is_bgra ? pipes_copy_bgra : pipes_copy); - g2_draw_image(_texpaint_nor, 0, 0); + draw_image(_texpaint_nor, 0, 0); g2_set_pipeline(null); g2_end(); _texpaint_pack = image_from_bytes(lz4_decode(ld.texpaint_pack, ld.res * ld.res * 4 * bytes_per_pixel), ld.res, ld.res, format); g2_begin(l.texpaint_pack); g2_set_pipeline(project.is_bgra ? pipes_copy_bgra : pipes_copy); - g2_draw_image(_texpaint_pack, 0, 0); + draw_image(_texpaint_pack, 0, 0); g2_set_pipeline(null); g2_end(); ///end diff --git a/base/sources/ts/import_blend_material.ts b/base/sources/ts/import_blend_material.ts index e5b4aaf1..e1f9a174 100644 --- a/base/sources/ts/import_blend_material.ts +++ b/base/sources/ts/import_blend_material.ts @@ -42,7 +42,7 @@ function _import_blend_material() { let save: string; if (path_is_protected()) { - save = iron_save_path(); + save = kinc_internal_save_path(); } else { save = path_data(); diff --git a/base/sources/ts/import_blend_mesh.ts b/base/sources/ts/import_blend_mesh.ts index 6935fb3d..1d3dbe4d 100644 --- a/base/sources/ts/import_blend_mesh.ts +++ b/base/sources/ts/import_blend_mesh.ts @@ -33,7 +33,7 @@ function import_blend_mesh_run(path: string, replace_existing: bool = true) { let save: string; if (path_is_protected()) { - save = iron_save_path(); + save = kinc_internal_save_path(); } else { save = path_data(); diff --git a/base/sources/ts/import_envmap.ts b/base/sources/ts/import_envmap.ts index b19e2ee3..65166122 100644 --- a/base/sources/ts/import_envmap.ts +++ b/base/sources/ts/import_envmap.ts @@ -37,7 +37,7 @@ function import_envmap_run(path: string, image: image_t) { // Down-scale to 1024x512 g2_begin(import_envmap_radiance); g2_set_pipeline(pipes_copy128); - g2_draw_scaled_image(image, 0, 0, 1024, 512); + draw_scaled_image(image, 0, 0, 1024, 512); g2_set_pipeline(null); g2_end(); diff --git a/base/sources/ts/import_obj.ts b/base/sources/ts/import_obj.ts index e0b64317..dfe82a84 100644 --- a/base/sources/ts/import_obj.ts +++ b/base/sources/ts/import_obj.ts @@ -10,7 +10,7 @@ function import_obj_run(path: string, replace_existing: bool = true) { let b: buffer_t = data_get_blob(path); if (is_udim) { - let part: raw_mesh_t = iron_obj_parse(b, split_code, 0, is_udim); + let part: raw_mesh_t = obj_parse(b, split_code, 0, is_udim); let name: string = part.name; for (let i: i32 = 0; i < part.udims.length; ++i) { let a: u32_array_t = part.udims[i]; @@ -37,10 +37,10 @@ function import_obj_run(path: string, replace_existing: bool = true) { } else { let parts: raw_mesh_t[] = []; - let part: raw_mesh_t = iron_obj_parse(b, split_code, 0, false); + let part: raw_mesh_t = obj_parse(b, split_code, 0, false); array_push(parts, part); while (part.has_next) { - part = iron_obj_parse(b, split_code, part.pos, false); + part = obj_parse(b, split_code, part.pos, false); // This part does not contain faces (may contain lines only) if (part.inda.length == 0) { continue; diff --git a/base/sources/ts/iron/g2.ts b/base/sources/ts/iron/g2.ts index 32eb9928..ef207b0d 100644 --- a/base/sources/ts/iron/g2.ts +++ b/base/sources/ts/iron/g2.ts @@ -1,4 +1,11 @@ +declare type g2_font_t = { + font_?: any; // draw_font_t + blob?: buffer_t; + glyphs?: i32[]; + index?: i32; +}; + let _g2_color: color_t; let _g2_font: g2_font_t; let _g2_font_size: i32 = 0; @@ -43,10 +50,6 @@ function g2_set_pipeline(p: pipeline_t) { _g2_pipeline = p; } -function g2_set_bilinear_filter(bilinear: bool) { - draw_set_bilinear_filter(bilinear); -} - function g2_set_transformation(m: mat3_t) { if (mat3_isnan(m)) { draw_set_transform(null); @@ -87,46 +90,6 @@ function g2_init() { } } -function g2_draw_scaled_sub_image(img: image_t, sx: f32, sy: f32, sw: f32, sh: f32, dx: f32, dy: f32, dw: f32, dh: f32) { - draw_scaled_sub_image(img, sx, sy, sw, sh, dx, dy, dw, dh); -} - -function g2_draw_sub_image(img: image_t, x: f32, y: f32, sx: f32, sy: f32, sw: f32, sh: f32) { - g2_draw_scaled_sub_image(img, sx, sy, sw, sh, x, y, sw, sh); -} - -function g2_draw_scaled_image(img: image_t, dx: f32, dy: f32, dw: f32, dh: f32) { - g2_draw_scaled_sub_image(img, 0, 0, img.width, img.height, dx, dy, dw, dh); -} - -function g2_draw_image(img: image_t, x: f32, y: f32) { - g2_draw_scaled_sub_image(img, 0, 0, img.width, img.height, x, y, img.width, img.height); -} - -function g2_draw_rect(x: f32, y: f32, width: f32, height: f32, strength: f32 = 1.0) { - draw_rect(x, y, width, height, strength); -} - -function g2_fill_rect(x: f32, y: f32, width: f32, height: f32) { - draw_filled_rect(x, y, width, height); -} - -function g2_draw_string(text: string, x: f32, y: f32) { - draw_string(text, x, y); -} - -function g2_draw_line(x0: f32, y0: f32, x1: f32, y1: f32, strength: f32 = 1.0) { - draw_line(x0, y0, x1, y1, strength); -} - -function g2_draw_line_aa(x0: f32, y0: f32, x1: f32, y1: f32, strength: f32 = 1.0) { - draw_line_aa(x0, y0, x1, y1, strength); -} - -function g2_fill_triangle(x0: f32, y0: f32, x1: f32, y1: f32, x2: f32, y2: f32) { - draw_filled_triangle(x0, y0, x1, y1, x2, y2); -} - function g2_scissor(x: i32, y: i32, width: i32, height: i32) { draw_end(); // flush g4_scissor(x, y, width, height); @@ -170,18 +133,6 @@ function g2_clear(color: color_t = 0x00000000) { g4_clear(color); } -function g2_fill_circle(cx: f32, cy: f32, radius: f32, segments: i32 = 0) { - draw_filled_circle(cx, cy, radius, segments); -} - -function g2_draw_circle(cx: f32, cy: f32, radius: f32, segments: i32 = 0, strength: f32 = 1.0) { - draw_circle(cx, cy, radius, segments, strength); -} - -function g2_draw_cubic_bezier(x: f32[], y: f32[], segments: i32 = 20, strength: f32 = 1.0) { - draw_cubic_bezier(x, y, segments, strength); -} - function g2_font_init(raw: g2_font_t) { if (_g2_font_glyphs_last != _g2_font_glyphs) { _g2_font_glyphs_last = _g2_font_glyphs; @@ -222,10 +173,3 @@ function g2_font_set_font_index(raw: g2_font_t, index: i32) { function g2_font_clone(raw: g2_font_t): g2_font_t { return g2_font_create(raw.blob, raw.index); } - -declare type g2_font_t = { - font_?: any; // draw_font_t - blob?: buffer_t; - glyphs?: i32[]; - index?: i32; -}; diff --git a/base/sources/ts/iron/g4.ts b/base/sources/ts/iron/g4.ts index 4e209624..363f1158 100644 --- a/base/sources/ts/iron/g4.ts +++ b/base/sources/ts/iron/g4.ts @@ -78,36 +78,35 @@ function g4_pipeline_delete(raw: pipeline_t) { function g4_pipeline_compile(raw: pipeline_t) { let structure0: vertex_struct_t = raw.input_layout; - for (let i: i32 = raw.color_write_masks_red.length; i < 8; ++i) { - array_push(raw.color_write_masks_red, true); + for (let i: i32 = 0; i < raw.color_write_masks_red.length; ++i) { + ARRAY_ACCESS(raw.pipeline_.color_write_mask_red, i) = raw.color_write_masks_red[i]; } - for (let i: i32 = raw.color_write_masks_green.length; i < 8; ++i) { - array_push(raw.color_write_masks_green, true); + for (let i: i32 = 0; i < raw.color_write_masks_green.length; ++i) { + ARRAY_ACCESS(raw.pipeline_.color_write_mask_green, i) = raw.color_write_masks_green[i]; } - for (let i: i32 = raw.color_write_masks_blue.length; i < 8; ++i) { - array_push(raw.color_write_masks_blue, true); + for (let i: i32 = 0; i < raw.color_write_masks_blue.length; ++i) { + ARRAY_ACCESS(raw.pipeline_.color_write_mask_blue, i) = raw.color_write_masks_blue[i]; } - for (let i: i32 = raw.color_write_masks_alpha.length; i < 8; ++i) { - array_push(raw.color_write_masks_alpha, true); + for (let i: i32 = 0; i < raw.color_write_masks_alpha.length; ++i) { + ARRAY_ACCESS(raw.pipeline_.color_write_mask_alpha, i) = raw.color_write_masks_alpha[i]; + } + for (let i: i32 = 0; i < raw.color_attachment_count; ++i) { + ARRAY_ACCESS(raw.pipeline_.color_attachment, i) = raw.color_attachments[i]; } - let state: iron_pipeline_state_t = {}; - state.cull_mode = raw.cull_mode; - state.depth_write = raw.depth_write; - state.depth_mode = raw.depth_mode; - state.blend_source = raw.blend_source; - state.blend_dest = raw.blend_dest; - state.alpha_blend_source = raw.alpha_blend_source; - state.alpha_blend_dest = raw.alpha_blend_dest; - state.color_write_masks_red = raw.color_write_masks_red; - state.color_write_masks_green = raw.color_write_masks_green; - state.color_write_masks_blue = raw.color_write_masks_blue; - state.color_write_masks_alpha = raw.color_write_masks_alpha; - state.color_attachment_count = raw.color_attachment_count; - state.color_attachments = raw.color_attachments; - state.depth_attachment_bits = g4_pipeline_get_depth_buffer_bits(raw.depth_attachment); + raw.pipeline_.cull_mode = raw.cull_mode; + raw.pipeline_.depth_write = raw.depth_write; + raw.pipeline_.depth_mode = raw.depth_mode; + raw.pipeline_.blend_source = raw.blend_source; + raw.pipeline_.blend_destination = raw.blend_dest; + raw.pipeline_.alpha_blend_source = raw.alpha_blend_source; + raw.pipeline_.alpha_blend_destination = raw.alpha_blend_dest; + raw.pipeline_.color_attachment_count = raw.color_attachment_count; + raw.pipeline_.depth_attachment_bits = g4_pipeline_get_depth_buffer_bits(raw.depth_attachment); + raw.pipeline_.vertex_shader = raw.vertex_shader.shader_; + raw.pipeline_.fragment_shader = raw.fragment_shader.shader_; - iron_g4_compile_pipeline(raw.pipeline_, structure0, raw.vertex_shader.shader_, raw.fragment_shader.shader_, state); + iron_g4_compile_pipeline(raw.pipeline_, structure0); } function g4_pipeline_set(raw: pipeline_t) { @@ -227,7 +226,7 @@ function g4_clear(color: color_t = 0x00000000, depth: f32 = 0.0, flags: i32 = cl } function g4_viewport(x: i32, y: i32, width: i32, height: i32) { - iron_g4_viewport(x, y, width, height); + kinc_g4_viewport(x, y, width, height); } function g4_set_vertex_buffer(vb: vertex_buffer_t) { @@ -317,11 +316,11 @@ function g4_draw(start: i32 = 0, count: i32 = -1) { } function g4_scissor(x: i32, y: i32, width: i32, height: i32) { - iron_g4_scissor(x, y, width, height); + kinc_g4_scissor(x, y, width, height); } function g4_disable_scissor() { - iron_g4_disable_scissor(); + kinc_g4_disable_scissor(); } function _image_create(tex: any): image_t { @@ -462,7 +461,7 @@ declare type image_t = { }; type pipeline_t = { - pipeline_?: any; + pipeline_?: kinc_g5_pipeline_t; input_layout?: vertex_struct_t; vertex_shader?: shader_t; fragment_shader?: shader_t; @@ -507,21 +506,30 @@ declare type kinc_vertex_elem_t = { type kinc_const_loc_t = any; type kinc_tex_unit_t = any; -declare type iron_pipeline_state_t = { +declare type kinc_g5_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_dest?: blend_factor_t; + blend_destination?: blend_factor_t; alpha_blend_source?: blend_factor_t; - alpha_blend_dest?: blend_factor_t; - color_write_masks_red?: bool[]; - color_write_masks_green?: bool[]; - color_write_masks_blue?: bool[]; - color_write_masks_alpha?: bool[]; + 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; - color_attachments?: tex_format_t[]; depth_attachment_bits?: i32; + + impl?: any; }; type iron_texture_t = { diff --git a/base/sources/ts/iron/iron.ts b/base/sources/ts/iron/iron.ts index aaf4aa7c..633c6104 100644 --- a/base/sources/ts/iron/iron.ts +++ b/base/sources/ts/iron/iron.ts @@ -228,7 +228,7 @@ declare function iron_g4_create_fragment_shader_from_source(source: string): any declare function kinc_g5_shader_destroy(shader: any): void; declare function iron_g4_create_pipeline(): any; declare function iron_g4_delete_pipeline(pipeline: any): void; -declare function iron_g4_compile_pipeline(pipeline: any, structure0: any, vertex_shader: any, fragment_shader: any, state: any): void; +declare function iron_g4_compile_pipeline(pipeline: any, structure0: any, vertex_shader: any, fragment_shader: any): void; declare function kinc_g5_set_pipeline(pipeline: any): void; declare function iron_load_image(file: string, readable: bool): any; declare function iron_unload_image(image: image_t): void; @@ -267,7 +267,7 @@ declare function kinc_window_resize(width: i32, height: i32): void; declare function kinc_window_move(x: i32, y: i32): void; declare function iron_screen_dpi(): i32; declare function kinc_system_id(): string; -declare function iron_request_shutdown(): void; +declare function kinc_stop(): void; declare function kinc_count_displays(): i32; declare function iron_display_width(index: i32): i32; declare function iron_display_height(index: i32): i32; @@ -288,15 +288,15 @@ declare function kinc_g5_texture_generate_mipmaps(texture: any, levels: i32): vo declare function kinc_g5_render_target_generate_mipmaps(render_target: any, levels: i32): void; declare function iron_g4_set_mipmaps(texture: any, mipmaps: image_t[]): void; declare function kinc_g5_render_target_set_depth_from(target: any, source: any): void; -declare function iron_g4_viewport(x: i32, y: i32, width: i32, height: i32): void; -declare function iron_g4_scissor(x: i32, y: i32, width: i32, height: i32): void; -declare function iron_g4_disable_scissor(): void; +declare function kinc_g4_viewport(x: i32, y: i32, width: i32, height: i32): void; +declare function kinc_g4_scissor(x: i32, y: i32, width: i32, height: i32): void; +declare function kinc_g4_disable_scissor(): void; declare function iron_g4_begin(render_target: image_t, additional: image_t[]): void; declare function iron_g4_end(): void; declare function iron_g4_swap_buffers(): void; declare function iron_file_save_bytes(path: string, bytes: buffer_t, length?: i32): void; declare function iron_sys_command(cmd: string): i32; -declare function iron_save_path(): string; +declare function kinc_internal_save_path(): string; declare function iron_get_arg_count(): i32; declare function iron_get_arg(index: i32): string; declare function iron_get_files_location(): string; @@ -306,11 +306,14 @@ declare function draw_init(image_vert: buffer_t, image_frag: buffer_t, colored_v declare function draw_begin(): void; declare function draw_end(): void; declare function draw_scaled_sub_image(image: image_t, sx: f32, sy: f32, sw: f32, sh: f32, dx: f32, dy: f32, dw: f32, dh: f32): void; +declare function draw_sub_image(image: image_t, x: f32, y: f32, sx: f32, sy: f32, sw: f32, sh: f32): void; +declare function draw_scaled_image(image: image_t, dx: f32, dy: f32, dw: f32, dh: f32): void; +declare function draw_image(image: image_t, x: f32, y: f32): void; declare function draw_filled_triangle(x0: f32, y0: f32, x1: f32, y1: f32, x2: f32, y2: f32): void; declare function draw_filled_rect(x: f32, y: f32, width: f32, height: f32): void; -declare function draw_rect(x: f32, y: f32, width: f32, height: f32, strength: f32): void; -declare function draw_line(x0: f32, y0: f32, x1: f32, y1: f32, strength: f32): void; -declare function draw_line_aa(x0: f32, y0: f32, x1: f32, y1: f32, strength: f32): void; +declare function draw_rect(x: f32, y: f32, width: f32, height: f32, strength: f32 = 1.0): void; +declare function draw_line(x0: f32, y0: f32, x1: f32, y1: f32, strength: f32 = 1.0): void; +declare function draw_line_aa(x0: f32, y0: f32, x1: f32, y1: f32, strength: f32 = 1.0): void; declare function draw_string(text: string, x: f32, y: f32): void; declare function draw_set_font(font: any, size: i32): bool; declare function draw_font_init(blob: buffer_t, font_index: i32): any; @@ -325,9 +328,9 @@ declare function draw_set_render_target(render_target: any): void; declare function draw_set_color(color: i32): void; declare function draw_set_pipeline(pipeline: any): void; declare function draw_set_transform(matrix: buffer_t): void; -declare function draw_filled_circle(cx: f32, cy: f32, radius: f32, segments: i32): void; -declare function draw_circle(cx: f32, cy: f32, radius: f32, segments: i32, strength: f32): void; -declare function draw_cubic_bezier(x: f32[], y: f32[], segments: i32, strength: f32): void; +declare function draw_filled_circle(cx: f32, cy: f32, radius: f32, segments: i32 = 0): void; +declare function draw_circle(cx: f32, cy: f32, radius: f32, segments: i32 = 0, strength: f32 = 1.0): void; +declare function draw_cubic_bezier(x: f32[], y: f32[], segments: i32 = 20, strength: f32 = 1.0): void; declare function iron_set_save_and_quit_callback(callback: (save: bool)=>void): void; declare function iron_set_mouse_cursor(id: i32): void; @@ -349,7 +352,7 @@ declare function iron_mp4_encode(pixels: buffer_t): void; declare function iron_ml_inference(model: buffer_t, tensors: buffer_t[], input_shape?: i32[][], output_shape?: i32[], use_gpu?: bool): buffer_t; declare function iron_ml_unload(): void; -declare function iron_raytrace_supported(): bool; +declare function kinc_g5_raytrace_supported(): bool; declare function iron_raytrace_init(shader: buffer_t): void; declare function iron_raytrace_as_init(): void; declare function iron_raytrace_as_add(vb: any, ib: any, transform: mat4_t): void; @@ -358,10 +361,10 @@ declare function iron_raytrace_as_build(vb_full: any, ib_full: any): void; declare function iron_raytrace_set_textures(tex0: image_t, tex1: image_t, tex2: image_t, texenv: any, tex_sobol: any, tex_scramble: any, tex_rank: any): void; declare function iron_raytrace_dispatch_rays(target: any, cb: buffer_t): void; -declare function iron_window_x(): i32; -declare function iron_window_y(): i32; -declare function iron_language(): string; -declare function iron_obj_parse(file_bytes: buffer_t, split_code: i32, start_pos: i32, udim: bool): any; +declare function kinc_window_x(): i32; +declare function kinc_window_y(): i32; +declare function kinc_language(): string; +declare function obj_parse(file_bytes: buffer_t, split_code: i32, start_pos: i32, udim: bool): any; declare function armpack_decode(b: buffer_t): any; declare function armpack_encode_start(encoded: any): void; diff --git a/base/sources/ts/iron/sys.ts b/base/sources/ts/iron/sys.ts index e2d575cc..77c4d0e7 100644 --- a/base/sources/ts/iron/sys.ts +++ b/base/sources/ts/iron/sys.ts @@ -134,11 +134,11 @@ function sys_system_id(): string { } function sys_language(): string { - return iron_language(); + return kinc_language(); } function sys_stop() { - iron_request_shutdown(); + kinc_stop(); } function sys_load_url(url: string) { @@ -298,11 +298,11 @@ function sys_move(x: i32, y: i32) { } function sys_x(): i32 { - return iron_window_x(); + return kinc_window_x(); } function sys_y(): i32 { - return iron_window_y(); + return kinc_window_y(); } function sys_width(): i32 { diff --git a/base/sources/ts/layers.ts b/base/sources/ts/layers.ts index 1b0a5e80..4a498cd5 100644 --- a/base/sources/ts/layers.ts +++ b/base/sources/ts/layers.ts @@ -30,7 +30,7 @@ function layers_init() { let texpaint_nor: render_target_t = map_get(render_path_render_targets, "texpaint_nor"); let texpaint_pack: render_target_t = map_get(render_path_render_targets, "texpaint_pack"); g2_begin(texpaint._image); - g2_draw_scaled_image(resource_get("placeholder.k"), 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); // Base + draw_scaled_image(resource_get("placeholder.k"), 0, 0, config_get_texture_res_x(), config_get_texture_res_y()); // Base g2_end(); g4_begin(texpaint_nor._image); g4_clear(color_from_floats(0.5, 0.5, 1.0, 0.0)); // Nor @@ -250,7 +250,7 @@ function layers_apply_mask(l: slot_layer_t, m: slot_layer_t) { // Copy layer to temp g2_begin(layers_temp_image); g2_set_pipeline(pipes_copy); - g2_draw_image(l.texpaint, 0, 0); + draw_image(l.texpaint, 0, 0); g2_set_pipeline(null); g2_end(); @@ -713,7 +713,7 @@ function layers_merge_layer(l0 : slot_layer_t, l1: slot_layer_t, use_mask: bool g2_begin(layers_temp_image); // Copy to temp g2_set_pipeline(pipes_copy); - g2_draw_image(l0.texpaint, 0, 0); + draw_image(l0.texpaint, 0, 0); g2_set_pipeline(null); g2_end(); @@ -760,7 +760,7 @@ function layers_merge_layer(l0 : slot_layer_t, l1: slot_layer_t, use_mask: bool if (l0.texpaint_nor != null) { g2_begin(layers_temp_image); g2_set_pipeline(pipes_copy); - g2_draw_image(l0.texpaint_nor, 0, 0); + draw_image(l0.texpaint_nor, 0, 0); g2_set_pipeline(null); g2_end(); @@ -783,7 +783,7 @@ function layers_merge_layer(l0 : slot_layer_t, l1: slot_layer_t, use_mask: bool if (l0.texpaint_pack != null) { g2_begin(layers_temp_image); g2_set_pipeline(pipes_copy); - g2_draw_image(l0.texpaint_pack, 0, 0); + draw_image(l0.texpaint_pack, 0, 0); g2_set_pipeline(null); g2_end(); diff --git a/base/sources/ts/path.ts b/base/sources/ts/path.ts index 08fa15c8..7df9bf58 100644 --- a/base/sources/ts/path.ts +++ b/base/sources/ts/path.ts @@ -80,7 +80,7 @@ function path_working_dir(): string { let cmd: string = path_pwd; let save: string; if (path_is_protected()) { - save = iron_save_path(); + save = kinc_internal_save_path(); } else { save = path_data() + path_sep; diff --git a/base/sources/ts/project.ts b/base/sources/ts/project.ts index 933e734a..8433b1bf 100644 --- a/base/sources/ts/project.ts +++ b/base/sources/ts/project.ts @@ -62,7 +62,7 @@ function project_save(save_and_quit: bool = false) { document_directory = substring(document_directory, 0, document_directory.length - 8); // Strip /"untitled" project_filepath = document_directory + "/" + sys_title() + ".arm"; ///elseif arm_android - project_filepath = iron_save_path() + "/" + sys_title() + ".arm"; + project_filepath = kinc_internal_save_path() + "/" + sys_title() + ".arm"; ///else project_save_as(save_and_quit); return; diff --git a/base/sources/ts/slot_layer.ts b/base/sources/ts/slot_layer.ts index b9122dd9..9ea5905a 100644 --- a/base/sources/ts/slot_layer.ts +++ b/base/sources/ts/slot_layer.ts @@ -249,7 +249,7 @@ function slot_layer_clear(raw: slot_layer_t, base_color: i32 = 0x00000000, base_ g4_end(); if (base_image != null) { g2_begin(raw.texpaint); - g2_draw_scaled_image(base_image, 0, 0, raw.texpaint.width, raw.texpaint.height); + draw_scaled_image(base_image, 0, 0, raw.texpaint.width, raw.texpaint.height); g2_end(); } @@ -270,7 +270,7 @@ function slot_layer_invert_mask(raw: slot_layer_t) { let inverted: image_t = image_create_render_target(raw.texpaint.width, raw.texpaint.height, tex_format_t.RGBA32); g2_begin(inverted); g2_set_pipeline(pipes_invert8); - g2_draw_image(raw.texpaint, 0, 0); + draw_image(raw.texpaint, 0, 0); g2_set_pipeline(null); g2_end(); let _texpaint: image_t = raw.texpaint; @@ -308,14 +308,14 @@ function slot_layer_duplicate(raw: slot_layer_t): slot_layer_t { if (slot_layer_is_layer(raw)) { g2_begin(l.texpaint); g2_set_pipeline(pipes_copy); - g2_draw_image(raw.texpaint, 0, 0); + draw_image(raw.texpaint, 0, 0); g2_set_pipeline(null); g2_end(); if (l.texpaint_nor != null) { g2_begin(l.texpaint_nor); g2_set_pipeline(pipes_copy); - g2_draw_image(raw.texpaint_nor, 0, 0); + draw_image(raw.texpaint_nor, 0, 0); g2_set_pipeline(null); g2_end(); } @@ -323,7 +323,7 @@ function slot_layer_duplicate(raw: slot_layer_t): slot_layer_t { if (l.texpaint_pack != null) { g2_begin(l.texpaint_pack); g2_set_pipeline(pipes_copy); - g2_draw_image(raw.texpaint_pack, 0, 0); + draw_image(raw.texpaint_pack, 0, 0); g2_set_pipeline(null); g2_end(); } @@ -331,7 +331,7 @@ function slot_layer_duplicate(raw: slot_layer_t): slot_layer_t { else if (slot_layer_is_mask(raw)) { g2_begin(l.texpaint); g2_set_pipeline(pipes_copy8); - g2_draw_image(raw.texpaint, 0, 0); + draw_image(raw.texpaint, 0, 0); g2_set_pipeline(null); g2_end(); } @@ -340,7 +340,7 @@ function slot_layer_duplicate(raw: slot_layer_t): slot_layer_t { g2_begin(l.texpaint_preview); g2_clear(0x00000000); g2_set_pipeline(pipes_copy); - g2_draw_scaled_image(raw.texpaint_preview, 0, 0, raw.texpaint_preview.width, raw.texpaint_preview.height); + draw_scaled_image(raw.texpaint_preview, 0, 0, raw.texpaint_preview.width, raw.texpaint_preview.height); g2_set_pipeline(null); g2_end(); } @@ -387,7 +387,7 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { raw.texpaint = image_create_render_target(res_x, res_y, format); g2_begin(raw.texpaint); g2_set_pipeline(pipes_copy); - g2_draw_scaled_image(_texpaint, 0, 0, res_x, res_y); + draw_scaled_image(_texpaint, 0, 0, res_x, res_y); g2_set_pipeline(null); g2_end(); @@ -397,7 +397,7 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { g2_begin(raw.texpaint_nor); g2_set_pipeline(pipes_copy); - g2_draw_scaled_image(_texpaint_nor, 0, 0, res_x, res_y); + draw_scaled_image(_texpaint_nor, 0, 0, res_x, res_y); g2_set_pipeline(null); g2_end(); } @@ -408,7 +408,7 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { g2_begin(raw.texpaint_pack); g2_set_pipeline(pipes_copy); - g2_draw_scaled_image(_texpaint_pack, 0, 0, res_x, res_y); + draw_scaled_image(_texpaint_pack, 0, 0, res_x, res_y); g2_set_pipeline(null); g2_end(); } @@ -448,7 +448,7 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { g2_begin(raw.texpaint); g2_set_pipeline(pipes_copy8); - g2_draw_scaled_image(_texpaint, 0, 0, res_x, res_y); + draw_scaled_image(_texpaint, 0, 0, res_x, res_y); g2_set_pipeline(null); g2_end(); diff --git a/base/sources/ts/tab_browser.ts b/base/sources/ts/tab_browser.ts index f87c1e3a..1032c3c5 100644 --- a/base/sources/ts/tab_browser.ts +++ b/base/sources/ts/tab_browser.ts @@ -246,7 +246,7 @@ function tab_browser_draw(htab: ui_handle_t) { tab_browser_hpath.text = "/storage/emulated/0/DCIM/Camera"; } if (ui_menu_button(tr("Projects"))) { - tab_browser_hpath.text = iron_save_path(); + tab_browser_hpath.text = kinc_internal_save_path(); } }); ///else diff --git a/base/sources/ts/tab_layers.ts b/base/sources/ts/tab_layers.ts index ba0282d7..5d5847d9 100644 --- a/base/sources/ts/tab_layers.ts +++ b/base/sources/ts/tab_layers.ts @@ -671,9 +671,9 @@ function tab_layers_draw_layer_icon(l: slot_layer_t, i: i32, uix: f32, uiy: f32, let width: i32 = g2_font_width(ui.ops.font, ui.font_size, number) + 10; let height: i32 = g2_font_height(ui.ops.font, ui.font_size); g2_set_color(ui.ops.theme.TEXT_COL); - g2_fill_rect(uix, uiy, width, height); + draw_filled_rect(uix, uiy, width, height); g2_set_color(ui.ops.theme.BUTTON_COL); - g2_draw_string(number, uix + 5, uiy); + draw_string(number, uix + 5, uiy); } } @@ -1009,7 +1009,7 @@ function tab_layers_make_mask_preview_rgba32(l: slot_layer_t) { g2_begin(context_raw.mask_preview_rgba32); g2_set_pipeline(ui_view2d_pipe); g4_set_int(ui_view2d_channel_loc, 1); - g2_draw_image(l.texpaint_preview, 0, 0); + draw_image(l.texpaint_preview, 0, 0); g2_end(); g2_set_pipeline(null); }); diff --git a/base/sources/ts/tab_materials.ts b/base/sources/ts/tab_materials.ts index c0bf4496..7786a7aa 100644 --- a/base/sources/ts/tab_materials.ts +++ b/base/sources/ts/tab_materials.ts @@ -119,9 +119,9 @@ function tab_materials_draw_slots(mini: bool) { let width: i32 = g2_font_width(ui.ops.font, ui.font_size, number) + 10; let height: i32 = g2_font_height(ui.ops.font, ui.font_size); g2_set_color(ui.ops.theme.TEXT_COL); - g2_fill_rect(uix, uiy, width, height); + draw_filled_rect(uix, uiy, width, height); g2_set_color(ui.ops.theme.BUTTON_COL); - g2_draw_string(number, uix + 5, uiy); + draw_string(number, uix + 5, uiy); } } diff --git a/base/sources/ts/tab_textures.ts b/base/sources/ts/tab_textures.ts index 38c3e59f..d970d919 100644 --- a/base/sources/ts/tab_textures.ts +++ b/base/sources/ts/tab_textures.ts @@ -144,7 +144,7 @@ function tab_textures_draw(htab: ui_handle_t) { let target: image_t = image_create_render_target(tab_textures_to_pow2(img.width), tab_textures_to_pow2(img.height)); g2_begin(target); g2_set_pipeline(pipes_copy); - g2_draw_scaled_image(img, 0, 0, target.width, target.height); + draw_scaled_image(img, 0, 0, target.width, target.height); g2_set_pipeline(null); g2_end(); app_notify_on_next_frame(function (target: image_t) { diff --git a/base/sources/ts/ui_base.ts b/base/sources/ts/ui_base.ts index f433de28..23526574 100644 --- a/base/sources/ts/ui_base.ts +++ b/base/sources/ts/ui_base.ts @@ -591,7 +591,7 @@ function ui_base_update() { let shortcuts: string[] = ["l", "b", "n", "o", "r", "m", "a", "h", "e", "s", "t", "1", "2", "3", "4"]; - if (iron_raytrace_supported()) { + if (kinc_g5_raytrace_supported()) { array_push(modes, tr("Path Traced")); array_push(shortcuts, "p"); } @@ -1092,7 +1092,7 @@ function ui_base_update_ui() { g2_clear(0x00000000); // g2_set_pipeline(l.is_mask() ? pipes_copy8 : pipes_copy); g2_set_pipeline(pipes_copy); // texpaint_preview is always RGBA32 for now - g2_draw_scaled_image(source, 0, 0, target.width, target.height); + draw_scaled_image(source, 0, 0, target.width, target.height); g2_set_pipeline(null); g2_end(); } @@ -1112,7 +1112,7 @@ function ui_base_update_ui() { g2_clear(0x00000000); // g2_set_pipeline(raw.layer.is_mask() ? pipes_copy8 : pipes_copy); g2_set_pipeline(pipes_copy); // texpaint_preview is always RGBA32 for now - g2_draw_scaled_image(source, 0, 0, target.width, target.height); + draw_scaled_image(source, 0, 0, target.width, target.height); g2_set_pipeline(null); g2_end(); ui_base_hwnds[tab_area_t.SIDEBAR0].redraws = 2; @@ -1313,25 +1313,25 @@ function ui_base_render_cursor() { let cx: f32 = r.x + r.w / 2; let cy: f32 = r.y + r.h / 2; g2_set_transformation(mat3_multmat(mat3_multmat(mat3_translation(cx, cy), mat3_rotation(-angle)), mat3_translation(-cx, -cy))); - g2_draw_scaled_image(context_raw.brush_stencil_image, r.x, r.y, r.w, r.h); + draw_scaled_image(context_raw.brush_stencil_image, r.x, r.y, r.w, r.h); g2_set_transformation(mat3_nan()); g2_set_color(0xffffffff); } let transform: bool = operator_shortcut(map_get(config_keymap, "stencil_transform"), shortcut_type_t.DOWN); if (transform) { // Outline - g2_draw_rect(r.x, r.y, r.w, r.h); + draw_rect(r.x, r.y, r.w, r.h); // Scale - g2_draw_rect(r.x - 8, r.y - 8, 16, 16); - g2_draw_rect(r.x - 8 + r.w, r.y - 8, 16, 16); - g2_draw_rect(r.x - 8, r.y - 8 + r.h, 16, 16); - g2_draw_rect(r.x - 8 + r.w, r.y - 8 + r.h, 16, 16); + draw_rect(r.x - 8, r.y - 8, 16, 16); + draw_rect(r.x - 8 + r.w, r.y - 8, 16, 16); + draw_rect(r.x - 8, r.y - 8 + r.h, 16, 16); + draw_rect(r.x - 8 + r.w, r.y - 8 + r.h, 16, 16); // Rotate let angle: f32 = context_raw.brush_stencil_angle; let cx: f32 = r.x + r.w / 2; let cy: f32 = r.y + r.h / 2; g2_set_transformation(mat3_multmat(mat3_multmat(mat3_translation(cx, cy), mat3_rotation(-angle)), mat3_translation(-cx, -cy))); - g2_fill_circle(r.x + r.w / 2, r.y - 4, 8); + draw_filled_circle(r.x + r.w / 2, r.y - 4, 8); g2_set_transformation(mat3_nan()); } } @@ -1339,12 +1339,12 @@ function ui_base_render_cursor() { // Show picked material next to cursor if (context_raw.tool == workspace_tool_t.PICKER && context_raw.picker_select_material && context_raw.color_picker_callback == null) { let img: image_t = context_raw.material.image_icon; - g2_draw_image(img, mx + 10, my + 10); + draw_image(img, mx + 10, my + 10); } if (context_raw.tool == workspace_tool_t.PICKER && context_raw.color_picker_callback != null) { let img: image_t = resource_get("icons.k"); let rect: rect_t = resource_tile50(img, workspace_tool_t.PICKER, 0); - g2_draw_sub_image(img, mx + 10, my + 10, rect.x, rect.y, rect.w, rect.h); + draw_sub_image(img, mx + 10, my + 10, rect.x, rect.y, rect.w, rect.h); } let cursor_img: image_t = resource_get("cursor.k"); @@ -1353,7 +1353,7 @@ function ui_base_render_cursor() { // Clone source cursor if (context_raw.tool == workspace_tool_t.CLONE && !keyboard_down("alt") && (mouse_down() || pen_down())) { g2_set_color(0x66ffffff); - g2_draw_scaled_image(cursor_img, mx + context_raw.clone_delta_x * app_w() - psize / 2, my + context_raw.clone_delta_y * app_h() - psize / 2, psize, psize); + draw_scaled_image(cursor_img, mx + context_raw.clone_delta_x * app_w() - psize / 2, my + context_raw.clone_delta_y * app_h() - psize / 2, psize, psize); g2_set_color(0xffffffff); } @@ -1389,7 +1389,7 @@ function ui_base_render_cursor() { let cx: f32 = decalx + psizex / 2; let cy: f32 = decaly + psizey / 2; g2_set_transformation(mat3_multmat(mat3_multmat(mat3_translation(cx, cy), mat3_rotation(angle)), mat3_translation(-cx, -cy))); - g2_draw_scaled_image(context_raw.decal_image, decalx, decaly, psizex, psizey); + draw_scaled_image(context_raw.decal_image, decalx, decaly, psizex, psizey); g2_set_transformation(mat3_nan()); g2_set_color(0xffffffff); } @@ -1408,7 +1408,7 @@ function ui_base_render_cursor() { if (config_raw.brush_3d && context_in_2d_view()) { psize = math_floor(psize * ui_view2d_pan_scale); } - g2_draw_scaled_image(cursor_img, mx - psize / 2, my - psize / 2, psize, psize); + draw_scaled_image(cursor_img, mx - psize / 2, my - psize / 2, psize, psize); } } @@ -1421,12 +1421,12 @@ function ui_base_render_cursor() { context_raw.tool == workspace_tool_t.BLUR || context_raw.tool == workspace_tool_t.SMUDGE || context_raw.tool == workspace_tool_t.PARTICLE)) { - g2_fill_rect(mx - 1, my - 1, 2, 2); + draw_filled_rect(mx - 1, my - 1, 2, 2); mx = context_raw.brush_lazy_x * base_w() + base_x(); my = context_raw.brush_lazy_y * base_h() + base_y(); let radius: f32 = context_raw.brush_lazy_radius * 180; g2_set_color(0xff666666); - g2_draw_scaled_image(cursor_img, mx - radius / 2, my - radius / 2, radius, radius); + draw_scaled_image(cursor_img, mx - radius / 2, my - radius / 2, radius, radius); g2_set_color(0xffffffff); } } diff --git a/base/sources/ts/ui_box.ts b/base/sources/ts/ui_box.ts index 827fda27..6683f1e8 100644 --- a/base/sources/ts/ui_box.ts +++ b/base/sources/ts/ui_box.ts @@ -50,7 +50,7 @@ function ui_box_render() { ///else g2_set_color(color_from_floats(0, 0, 0, 0.5)); ///end - g2_fill_rect(0, 0, sys_width(), sys_height()); + draw_filled_rect(0, 0, sys_width(), sys_height()); } g2_end(); @@ -200,7 +200,7 @@ function ui_box_window_border(ui: ui_t) { } // Border g2_set_color(ui.ops.theme.SEPARATOR_COL); - g2_fill_rect(0, 0, 1, ui._window_h); - g2_fill_rect(0 + ui._window_w - 1, 0, 1, ui._window_h); - g2_fill_rect(0, 0 + ui._window_h - 1, ui._window_w, 1); + draw_filled_rect(0, 0, 1, ui._window_h); + draw_filled_rect(0 + ui._window_w - 1, 0, 1, ui._window_h); + draw_filled_rect(0, 0 + ui._window_h - 1, ui._window_w, 1); } diff --git a/base/sources/ts/ui_files.ts b/base/sources/ts/ui_files.ts index 8ff52b97..92122116 100644 --- a/base/sources/ts/ui_files.ts +++ b/base/sources/ts/ui_files.ts @@ -210,7 +210,7 @@ function ui_files_file_browser(ui: ui_t, handle: ui_handle_t, drag_files: bool = g2_begin(icon); ///if (is_paint || is_sculpt) - g2_draw_image(project_materials[0].image, 0, 0); + draw_image(project_materials[0].image, 0, 0); ///end } else { @@ -218,7 +218,7 @@ function ui_files_file_browser(ui: ui_t, handle: ui_handle_t, drag_files: bool = g2_clear(0xffffffff); } g2_set_pipeline(pipes_copy_rgb); - g2_draw_image(data.image, 0, 0); + draw_image(data.image, 0, 0); g2_set_pipeline(null); g2_end(); @@ -435,7 +435,7 @@ function ui_files_make_icon (args: ui_files_make_icon_t) { g2_begin(icon); g2_clear(0xffffffff); g2_set_pipeline(pipes_copy_rgb); - g2_draw_scaled_image(image, 0, 0, sw, sh); + draw_scaled_image(image, 0, 0, sw, sh); g2_set_pipeline(null); g2_end(); map_set(ui_files_icon_map, args.shandle, icon); diff --git a/base/sources/ts/ui_menu.ts b/base/sources/ts/ui_menu.ts index 562a776e..9ff0a9d7 100644 --- a/base/sources/ts/ui_menu.ts +++ b/base/sources/ts/ui_menu.ts @@ -312,7 +312,7 @@ function ui_menu_render() { ]; let shortcuts: string[] = ["l", "b", "n", "o", "r", "m", "a", "h", "e", "s", "t", "1", "2", "3", "4"]; - if (iron_raytrace_supported()) { + if (kinc_g5_raytrace_supported()) { array_push(modes, tr("Path Traced")); array_push(shortcuts, "p"); } @@ -494,7 +494,7 @@ function ui_menu_render() { ///if arm_windows let save: string; if (path_is_protected()) { - save = iron_save_path(); + save = kinc_internal_save_path(); } else { save = path_data(); diff --git a/base/sources/ts/ui_nodes.ts b/base/sources/ts/ui_nodes.ts index 031e1af6..7917de56 100644 --- a/base/sources/ts/ui_nodes.ts +++ b/base/sources/ts/ui_nodes.ts @@ -754,19 +754,19 @@ function ui_nodes_draw_grid(zoom: f32): image_t { g2_set_color(line_primary); step = ui_nodes_grid_small_cell_w * zoom; for (let i: i32 = 0; i < math_floor(h / step) + 1; ++i) { - g2_draw_line(0, i * step, w, i * step); + draw_line(0, i * step, w, i * step); } for (let i: i32 = 0; i < math_floor(w / step) + 1; ++i) { - g2_draw_line(i * step, 0, i * step, h); + draw_line(i * step, 0, i * step, h); } g2_set_color(line_secondary); step = ui_nodes_grid_cell_w * zoom; for (let i: i32 = 0; i < math_floor(h / step) + 1; ++i) { - g2_draw_line(0, i * step, w, i * step); + draw_line(0, i * step, w, i * step); } for (let i: i32 = 0; i < math_floor(w / step) + 1; ++i) { - g2_draw_line(i * step, 0, i * step, h); + draw_line(i * step, 0, i * step, h); } g2_end(); @@ -950,7 +950,7 @@ function ui_nodes_render() { let step: f32 = ui_nodes_grid_cell_w * nodes.zoom; let x: f32 = math_fmod(ui_nodes_PAN_X(), step) - step; let y: f32 = math_fmod(ui_nodes_PAN_Y(), step) - step; - g2_draw_image(ui_nodes_grid, x, y); + draw_image(ui_nodes_grid, x, y); // Undo if (ui_nodes_ui.input_started || ui_nodes_ui.is_key_pressed) { @@ -1112,8 +1112,8 @@ function ui_nodes_render() { g2_set_color(0xffffffff); invert_y ? - g2_draw_scaled_image(img, tx, ty + th, tw, -th) : - g2_draw_scaled_image(img, tx, ty, tw, th); + draw_scaled_image(img, tx, ty + th, tw, -th) : + draw_scaled_image(img, tx, ty, tw, th); ///if (is_paint || is_sculpt) if (single_channel) { @@ -1125,7 +1125,7 @@ function ui_nodes_render() { // Menu g2_set_color(ui_nodes_ui.ops.theme.SEPARATOR_COL); - g2_fill_rect(0, ui_ELEMENT_H(ui_nodes_ui), ui_nodes_ww, ui_ELEMENT_H(ui_nodes_ui) + ui_ELEMENT_OFFSET(ui_nodes_ui) * 2); + draw_filled_rect(0, ui_ELEMENT_H(ui_nodes_ui), ui_nodes_ww, ui_ELEMENT_H(ui_nodes_ui) + ui_ELEMENT_OFFSET(ui_nodes_ui) * 2); g2_set_color(0xffffffff); let start_y: i32 = ui_ELEMENT_H(ui_nodes_ui) + ui_ELEMENT_OFFSET(ui_nodes_ui); diff --git a/base/sources/ts/ui_status.ts b/base/sources/ts/ui_status.ts index c52b9753..f9eab756 100644 --- a/base/sources/ts/ui_status.ts +++ b/base/sources/ts/ui_status.ts @@ -23,8 +23,8 @@ function ui_status_render_ui() { // Border g2_set_color(ui.ops.theme.SEPARATOR_COL); - g2_fill_rect(0, 0, 1, ui._window_h); - g2_fill_rect(ui._window_w - 1, 0, 1, ui._window_h); + draw_filled_rect(0, 0, 1, ui._window_h); + draw_filled_rect(ui._window_w - 1, 0, 1, ui._window_h); // Draw tabs let hwnd_draws: tab_draw_t[] = ui_base_hwnd_tabs[tab_area_t.STATUS]; diff --git a/base/sources/ts/ui_toolbar.ts b/base/sources/ts/ui_toolbar.ts index e5ecccb0..2636db4d 100644 --- a/base/sources/ts/ui_toolbar.ts +++ b/base/sources/ts/ui_toolbar.ts @@ -57,7 +57,7 @@ function ui_toolbar_draw_tool(i: i32, ui: ui_t, img: image_t, icon_accent: i32, ///if is_paint if (i == workspace_tool_t.COLORID && context_raw.colorid_picked) { let rt: render_target_t = map_get(render_path_render_targets, "texpaint_colorid"); - g2_draw_scaled_sub_image(rt._image, 0, 0, 1, 1, 0, _y + 1.5 * ui_SCALE(ui), 5 * ui_SCALE(ui), 34 * ui_SCALE(ui)); + draw_scaled_sub_image(rt._image, 0, 0, 1, 1, 0, _y + 1.5 * ui_SCALE(ui), 5 * ui_SCALE(ui), 34 * ui_SCALE(ui)); } ///end diff --git a/base/sources/ts/ui_view2d.ts b/base/sources/ts/ui_view2d.ts index ddd62979..f2937615 100644 --- a/base/sources/ts/ui_view2d.ts +++ b/base/sources/ts/ui_view2d.ts @@ -136,7 +136,7 @@ function ui_view2d_render() { let step: f32 = ui_nodes_grid_cell_w * ui_view2d_pan_scale; let x: f32 = math_fmod(ui_view2d_pan_x, step) - step; let y: f32 = math_fmod(ui_view2d_pan_y, step) - step; - g2_draw_image(ui_view2d_grid, x, y); + draw_image(ui_view2d_grid, x, y); // Texture let tex: image_t = null; @@ -221,30 +221,30 @@ function ui_view2d_render() { if (ui_view2d_type == view_2d_type_t.LAYER) { g2_set_pipeline(ui_view2d_pipe); if (!context_raw.texture_filter) { - g2_set_bilinear_filter(false); + draw_set_bilinear_filter(false); } iron_g4_set_int(ui_view2d_channel_loc, channel); } ///end - g2_draw_scaled_image(tex, tx, ty, tw, th); + draw_scaled_image(tex, tx, ty, tw, th); if (ui_view2d_tiled_show) { - g2_draw_scaled_image(tex, tx - tw, ty, tw, th); - g2_draw_scaled_image(tex, tx - tw, ty - th, tw, th); - g2_draw_scaled_image(tex, tx - tw, ty + th, tw, th); - g2_draw_scaled_image(tex, tx + tw, ty, tw, th); - g2_draw_scaled_image(tex, tx + tw, ty - th, tw, th); - g2_draw_scaled_image(tex, tx + tw, ty + th, tw, th); - g2_draw_scaled_image(tex, tx, ty - th, tw, th); - g2_draw_scaled_image(tex, tx, ty + th, tw, th); + draw_scaled_image(tex, tx - tw, ty, tw, th); + draw_scaled_image(tex, tx - tw, ty - th, tw, th); + draw_scaled_image(tex, tx - tw, ty + th, tw, th); + draw_scaled_image(tex, tx + tw, ty, tw, th); + draw_scaled_image(tex, tx + tw, ty - th, tw, th); + draw_scaled_image(tex, tx + tw, ty + th, tw, th); + draw_scaled_image(tex, tx, ty - th, tw, th); + draw_scaled_image(tex, tx, ty + th, tw, th); } ///if (is_paint || is_sculpt) if (ui_view2d_type == view_2d_type_t.LAYER) { g2_set_pipeline(null); if (!context_raw.texture_filter) { - g2_set_bilinear_filter(true); + draw_set_bilinear_filter(true); } } @@ -260,7 +260,7 @@ function ui_view2d_render() { let rt: render_target_t = map_get(render_path_render_targets, "texpaint_picker"); let texpaint_picker: image_t = rt._image; g2_begin(texpaint_picker); - g2_draw_scaled_image(_ui_view2d_render_tex, -_ui_view2d_render_x, -_ui_view2d_render_y, _ui_view2d_render_tw, _ui_view2d_render_th); + draw_scaled_image(_ui_view2d_render_tex, -_ui_view2d_render_x, -_ui_view2d_render_y, _ui_view2d_render_tw, _ui_view2d_render_th); g2_end(); let a: buffer_t = image_get_pixels(texpaint_picker); ///if (arm_metal || arm_vulkan) @@ -285,14 +285,14 @@ function ui_view2d_render() { ///if (is_paint || is_sculpt) // UV map if (ui_view2d_type == view_2d_type_t.LAYER && ui_view2d_uvmap_show) { - g2_draw_scaled_image(util_uv_uvmap, tx, ty, tw, th); + draw_scaled_image(util_uv_uvmap, tx, ty, tw, th); } ///end // Menu let ew: i32 = math_floor(ui_ELEMENT_W(ui_view2d_ui)); g2_set_color(ui_view2d_ui.ops.theme.SEPARATOR_COL); - g2_fill_rect(0, ui_ELEMENT_H(ui_view2d_ui), ui_view2d_ww, ui_ELEMENT_H(ui_view2d_ui) + ui_ELEMENT_OFFSET(ui_view2d_ui) * 2); + draw_filled_rect(0, ui_ELEMENT_H(ui_view2d_ui), ui_view2d_ww, ui_ELEMENT_H(ui_view2d_ui) + ui_ELEMENT_OFFSET(ui_view2d_ui) * 2); g2_set_color(0xffffffff); let start_y: f32 = ui_ELEMENT_H(ui_view2d_ui) + ui_ELEMENT_OFFSET(ui_view2d_ui); @@ -413,7 +413,7 @@ function ui_view2d_render() { let cursor_img: image_t = resource_get("cursor.k"); let hsize: f32 = 16 * ui_SCALE(ui_view2d_ui); let size: f32 = hsize * 2; - g2_draw_scaled_image(cursor_img, tx + tw * context_raw.uvx_picked - hsize, ty + th * context_raw.uvy_picked - hsize, size, size); + draw_scaled_image(cursor_img, tx + tw * context_raw.uvx_picked - hsize, ty + th * context_raw.uvy_picked - hsize, size, size); } ///end } diff --git a/base/sources/ts/util_render.ts b/base/sources/ts/util_render.ts index 65455424..e3a4abe6 100644 --- a/base/sources/ts/util_render.ts +++ b/base/sources/ts/util_render.ts @@ -172,7 +172,7 @@ function util_render_make_text_preview() { g2_set_font(font); g2_set_font_size(font_size); g2_set_color(0xffffffff); - g2_draw_string(text, tex_w / 2 - text_w / 2, tex_w / 2 - text_h / 2); + draw_string(text, tex_w / 2 - text_w / 2, tex_w / 2 - text_h / 2); g2_end(); if (g2_in_use) g2_begin(current); @@ -197,7 +197,7 @@ function util_render_make_font_preview() { g2_set_font(font); g2_set_font_size(font_size); g2_set_color(0xffffffff); - g2_draw_string(text, tex_w / 2 - text_w / 2, tex_w / 2 - text_h / 2); + draw_string(text, tex_w / 2 - text_w / 2, tex_w / 2 - text_h / 2); g2_end(); context_raw.font.preview_ready = true; @@ -371,7 +371,7 @@ function util_render_make_brush_preview() { g2_begin(target); g2_clear(0x00000000); g2_set_pipeline(pipes_copy); - g2_draw_scaled_image(l.texpaint, 0, 0, target.width, target.height); + draw_scaled_image(l.texpaint, 0, 0, target.width, target.height); g2_set_pipeline(null); g2_end(); diff --git a/base/sources/ts/util_uv.ts b/base/sources/ts/util_uv.ts index 2cfe2310..1f9c46e1 100644 --- a/base/sources/ts/util_uv.ts +++ b/base/sources/ts/util_uv.ts @@ -46,9 +46,9 @@ function util_uv_cache_uv_map() { let y1: f32 = (texa[inda[i * 3 ] * 2 + 1]) * f; let y2: f32 = (texa[inda[i * 3 + 1] * 2 + 1]) * f; let y3: f32 = (texa[inda[i * 3 + 2] * 2 + 1]) * f; - g2_draw_line_aa(x1, y1, x2, y2, strength); - g2_draw_line_aa(x2, y2, x3, y3, strength); - g2_draw_line_aa(x3, y3, x1, y1, strength); + draw_line_aa(x1, y1, x2, y2, strength); + draw_line_aa(x2, y2, x3, y3, strength); + draw_line_aa(x3, y3, x1, y1, strength); } g2_end(); } @@ -87,7 +87,7 @@ function util_uv_cache_triangle_map() { let y1: f32 = (texa[inda[i * 3 ] * 2 + 1]) * f; let y2: f32 = (texa[inda[i * 3 + 1] * 2 + 1]) * f; let y3: f32 = (texa[inda[i * 3 + 2] * 2 + 1]) * f; - g2_fill_triangle(x1, y1, x2, y2, x3, y3); + draw_filled_triangle(x1, y1, x2, y2, x3, y3); } g2_end(); } diff --git a/base/tests/triangle/main.ts b/base/tests/triangle/main.ts index 8e8a0098..51e8edda 100644 --- a/base/tests/triangle/main.ts +++ b/base/tests/triangle/main.ts @@ -2,7 +2,7 @@ // Red triangle test // ../../../make --graphics vulkan --run -let pipeline: any; +let pipeline: kinc_g5_pipeline_t; let vb: any; let ib: any; @@ -44,24 +44,24 @@ function main() { let masks: bool[] = [true, true, true, true, true, true, true, true]; let attachments: i32[] = [0]; - let state: iron_pipeline_state_t = { - cull_mode: 0, - depth_write: false, - depth_mode: 0, - blend_source: 0, - blend_dest: 0, - alpha_blend_source: 0, - alpha_blend_dest: 0, - color_write_masks_red: masks, - color_write_masks_green: masks, - color_write_masks_blue: masks, - color_write_masks_alpha: masks, - color_attachment_count: 1, - color_attachments: attachments, - depth_attachment_bits: 0 - }; + pipeline.cull_mode = 0; + pipeline.depth_write = false; + pipeline.depth_mode = 0; + pipeline.blend_source = 0; + pipeline.blend_dest = 0; + pipeline.alpha_blend_source = 0; + pipeline.alpha_blend_dest = 0; + pipeline.color_write_masks_red = masks; + pipeline.color_write_masks_green = masks; + pipeline.color_write_masks_blue = masks; + pipeline.color_write_masks_alpha = masks; + pipeline.color_attachment_count = 1; + pipeline.color_attachments = attachments; + pipeline.depth_attachment_bits = 0; + pipeline.vertex_shader = vert; + pipeline.fragment_shader = frag; - iron_g4_compile_pipeline(pipeline, structure0, vert, frag, state); + iron_g4_compile_pipeline(pipeline, structure0); let vertices: f32[] = [ -1.0, -1.0, 0.0, diff --git a/base/tools/pad/sources/main.ts b/base/tools/pad/sources/main.ts index bfccc47d..6e907de5 100644 --- a/base/tools/pad/sources/main.ts +++ b/base/tools/pad/sources/main.ts @@ -50,13 +50,13 @@ function encode_storage(): string { function shutdown() { let storage_string: string = sys_string_to_buffer(encode_storage()); - iron_file_save_bytes(iron_save_path() + "/config.json", storage_string, 0); + iron_file_save_bytes(kinc_internal_save_path() + "/config.json", storage_string, 0); } function main() { kinc_set_app_name("ArmorPad"); - let blob_storage: buffer_t = iron_load_blob(iron_save_path() + "/config.json"); + let blob_storage: buffer_t = iron_load_blob(kinc_internal_save_path() + "/config.json"); if (blob_storage == null) { storage = {}; storage.project = ""; @@ -182,8 +182,8 @@ function list_folder(path: string) { function render() { storage.window_w = sys_width(); storage.window_h = sys_height(); - storage.window_x = iron_window_x(); - storage.window_y = iron_window_y(); + storage.window_x = kinc_window_x(); + storage.window_y = kinc_window_y(); if (ui.input_dx != 0 || ui.input_dy != 0) { iron_set_mouse_cursor(0); // Arrow } @@ -268,7 +268,7 @@ function render() { if (minimap != null) { g2_begin(); - g2_draw_image(minimap, minimap_x, minimap_y); + draw_image(minimap, minimap_x, minimap_y); g2_end(); }