diff --git a/base/sources/backends/android_file_dialog.c b/base/sources/backends/android_file_dialog.c index f6e5ad5c..bbf5cc5d 100644 --- a/base/sources/backends/android_file_dialog.c +++ b/base/sources/backends/android_file_dialog.c @@ -7,7 +7,7 @@ #include #include -extern char mobile_title[1024]; +extern char android_title[1024]; ANativeActivity *iron_android_get_activity(void); jclass iron_android_find_class(JNIEnv *env, const char *name); @@ -15,17 +15,12 @@ jclass iron_android_find_class(JNIEnv *env, const char *name); JNIEXPORT void JNICALL Java_org_armory3d_IronActivity_onAndroidFilePicked(JNIEnv *env, jobject jobj, jstring jstr) { if (jstr == NULL) return; const char *str = (*env)->GetStringUTFChars(env, jstr, 0); - size_t len = strlen(str); - wchar_t filePath[len + 1]; - mbstowcs(filePath, (char *)str, len); - filePath[len] = 0; - - iron_internal_drop_files_callback(filePath); + iron_internal_drop_files_callback(str); (*env)->ReleaseStringUTFChars(env, jstr, str); } JNIEXPORT jstring JNICALL Java_org_armory3d_IronActivity_getMobileTitle(JNIEnv *env, jobject jobj) { - jstring result = (*env)->NewStringUTF(env, mobile_title); + jstring result = (*env)->NewStringUTF(env, android_title); return result; } diff --git a/base/sources/backends/android_system.c b/base/sources/backends/android_system.c index 1a76b675..3513d4d2 100644 --- a/base/sources/backends/android_system.c +++ b/base/sources/backends/android_system.c @@ -47,6 +47,7 @@ static const char *videoFormats[] = {"ts", NULL}; static __kernel_time_t start_sec = 0; static void (*resizeCallback)(int x, int y, void *data) = NULL; static void *resizeCallbackData = NULL; +static char ios_title[1024]; #ifdef WITH_GAMEPAD static float last_x = 0.0f; static float last_y = 0.0f; @@ -1210,9 +1211,12 @@ void iron_window_change_mode(iron_window_mode_t mode) {} void iron_window_destroy() {} void iron_window_show() {} void iron_window_hide() {} -void iron_window_set_title(const char *title) {} void iron_window_create(iron_window_options_t *win) {} +void iron_window_set_title(const char *title) { + strcpy(android_title, title); +} + void iron_window_set_resize_callback(void (*callback)(int x, int y, void *data), void *data) { resizeCallback = callback; resizeCallbackData = data; diff --git a/base/sources/backends/ios_system.m b/base/sources/backends/ios_system.m index 02c55f60..99130f5e 100644 --- a/base/sources/backends/ios_system.m +++ b/base/sources/backends/ios_system.m @@ -10,7 +10,7 @@ #define MAX_TOUCH_COUNT 10 -extern char mobile_title[1024]; +static char ios_title[1024]; static void *touches[MAX_TOUCH_COUNT]; static int backing_width; static int backing_height; @@ -222,9 +222,12 @@ void iron_window_change_mode(iron_window_mode_t mode) {} void iron_window_destroy() {} void iron_window_show() {} void iron_window_hide() {} -void iron_window_set_title(const char *title) {} void iron_window_create(iron_window_options_t *win) {} +void iron_window_set_title(const char *title) { + strcpy(ios_title, title); +} + void iron_window_set_resize_callback(void (*callback)(int x, int y, void *data), void *data) { resize_callback = callback; resize_callback_data = data; @@ -477,7 +480,7 @@ int iron_window_display() { void importFile(NSURL *url) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *folderName = [NSString stringWithUTF8String:mobile_title]; + NSString *folderName = [NSString stringWithUTF8String:ios_title]; NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:folderName]; if (![[NSFileManager defaultManager] fileExistsAtPath:filePath]) { [[NSFileManager defaultManager] createDirectoryAtPath:filePath withIntermediateDirectories:NO attributes:nil error:nil]; @@ -488,8 +491,8 @@ void importFile(NSURL *url) { CFURLStartAccessingSecurityScopedResource(cfurl); [[NSFileManager defaultManager] copyItemAtPath:url.path toPath:filePath error:nil]; CFURLStopAccessingSecurityScopedResource(cfurl); - wchar_t *wpath = (wchar_t *)[filePath cStringUsingEncoding:NSUTF32LittleEndianStringEncoding]; - iron_internal_drop_files_callback(wpath); + const char *cpath = [filePath cStringUsingEncoding:NSUTF8StringEncoding]; + iron_internal_drop_files_callback(cpath); } - (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray *)urls { diff --git a/base/sources/backends/linux_system.c b/base/sources/backends/linux_system.c index edc1e150..dcad3fb8 100644 --- a/base/sources/backends/linux_system.c +++ b/base/sources/backends/linux_system.c @@ -614,6 +614,47 @@ static int xk_to_iron(KeySym symbol) { return IRON_KEY_UNKNOWN; } +void *gc_alloc(size_t size); + +static char *uri_decode(const char *src) { + char *res = gc_alloc(1024); + char *dst = res; + char a, b; + while (*src) { + if ((*src == '%') && ((a = src[1]) && (b = src[2])) && (isxdigit(a) && isxdigit(b))) { + if (a >= 'a') { + a -= 'a' - 'A'; + } + if (a >= 'A') { + a -= ('A' - 10); + } + else { + a -= '0'; + } + if (b >= 'a') { + b -= 'a' - 'A'; + } + if (b >= 'A') { + b -= ('A' - 10); + } + else { + b -= '0'; + } + *dst++ = 16 * a + b; + src += 3; + } + else if (*src == '+') { + *dst++ = ' '; + src++; + } + else { + *dst++ = *src++; + } + } + *dst++ = '\0'; + return res; +} + static bool _handle_messages() { static bool controlDown = false; static int ignoreKeycode = 0; @@ -853,12 +894,11 @@ static bool _handle_messages() { size_t len = 0; while (pos < numItems) { if (data[pos] == '\r') { // Found a file - wchar_t filePath[len + 1]; - mbstowcs(filePath, buffer, len); - filePath[len] = 0; - iron_internal_drop_files_callback(filePath + 7); // Strip file:// - pos += 2; // Avoid \n + buffer[len] = 0; len = 0; + pos += 2; // Avoid \n + char *res = uri_decode(buffer + 7); // + 7 -> strip file:// + iron_internal_drop_files_callback(res); } buffer[len++] = data[pos++]; } diff --git a/base/sources/backends/macos_system.m b/base/sources/backends/macos_system.m index 35612e63..4bbae862 100644 --- a/base/sources/backends/macos_system.m +++ b/base/sources/backends/macos_system.m @@ -402,7 +402,7 @@ static int getMouseY(NSEvent *event) { if ([[pboard types] containsObject:NSURLPboardType]) { NSArray *urls = [pboard readObjectsForClasses:@[[NSURL class]] options:nil]; for (NSURL *fileURL in urls) { - wchar_t *filePath = (wchar_t *)[fileURL.path cStringUsingEncoding:NSUTF32LittleEndianStringEncoding]; + const char *filePath = [fileURL.path cStringUsingEncoding:NSUTF8StringEncoding]; iron_internal_drop_files_callback(filePath); } } diff --git a/base/sources/backends/wasm_system.c b/base/sources/backends/wasm_system.c index 6cf02010..b4188c82 100644 --- a/base/sources/backends/wasm_system.c +++ b/base/sources/backends/wasm_system.c @@ -33,11 +33,8 @@ bool iron_mouse_can_lock(void) { } void iron_mouse_show() {} - void iron_mouse_hide() {} - void iron_mouse_set_position(int x, int y) {} - void iron_mouse_get_position(int *x, int *y) {} __attribute__((import_module("imports"), import_name("js_time"))) int js_time(); @@ -131,44 +128,32 @@ int iron_window_height() { } void iron_window_resize(int width, int height) {} - void iron_window_move(int x, int y) {} -// In HTML5 fullscreen is activable only from user input. void iron_window_change_mode(iron_window_mode_t mode) { if (mode == IRON_WINDOW_MODE_FULLSCREEN) { if (iron_internal_window_mode == IRON_WINDOW_MODE_FULLSCREEN) { iron_internal_window_mode = mode; return; } - // TODO: call js Fullscreen API iron_internal_window_mode = mode; } else { if (mode == iron_internal_window_mode) { return; } - // TODO: call js Fullscreen API iron_internal_window_mode = mode; } } void iron_window_destroy() {} - void iron_window_show() {} - void iron_window_hide() {} - -// TODO: change browser title. void iron_window_set_title(const char *title) {} - void iron_window_create(iron_window_options_t *win) {} - void iron_window_set_resize_callback(void (*callback)(int x, int y, void *data), void *data) {} - void iron_window_set_close_callback(bool (*callback)(void *), void *data) {} iron_window_mode_t iron_window_get_mode() { return iron_internal_window_mode; } - diff --git a/base/sources/backends/windows_system.c b/base/sources/backends/windows_system.c index 370172b1..8f4833a7 100644 --- a/base/sources/backends/windows_system.c +++ b/base/sources/backends/windows_system.c @@ -765,7 +765,9 @@ LRESULT WINAPI IronWindowsMessageProcedure(HWND hWnd, UINT msg, WPARAM wParam, L for (unsigned i = 0; i < count; ++i) { wchar_t filePath[260]; if (DragQueryFileW(hDrop, i, filePath, 260)) { - iron_internal_drop_files_callback(filePath); + char buffer[1024]; + WideCharToMultiByte(CP_UTF8, 0, filePath, wcslen(filePath) + 1, buffer, sizeof(buffer), NULL, NULL); + iron_internal_drop_files_callback(buffer); } } DragFinish(hDrop); @@ -1298,6 +1300,27 @@ bool iron_internal_call_close_callback() { return true; } +bool _save_and_quit_callback_internal() { + bool save = false; + wchar_t title[1024]; + GetWindowTextW(iron_windows_window_handle(), title, sizeof(title)); + bool dirty = wcsstr(title, L"* - ArmorPaint") != NULL; + if (dirty) { + int res = MessageBox(iron_windows_window_handle(), L"Project has been modified, save changes?", L"Save Changes?", MB_YESNOCANCEL | MB_ICONEXCLAMATION); + if (res == IDYES) { + save = true; + } + else if (res == IDNO) { + save = false; + } + else { // Cancel + return false; + } + } + iron_save_and_quit(save); + return false; +} + #ifdef WITH_GAMEPAD bool iron_gamepad_connected(int num) { diff --git a/base/sources/iron.h b/base/sources/iron.h index 54038a26..3286d13a 100644 --- a/base/sources/iron.h +++ b/base/sources/iron.h @@ -181,7 +181,6 @@ bool f32_isnan(f32 f) { } void _kickstart(); - bool enable_window = true; bool in_background = false; int paused_frames = 0; @@ -190,7 +189,6 @@ bool input_down = false; int last_window_width = 0; int last_window_height = 0; #endif - char temp_string[1024 * 128]; char temp_string_vs[1024 * 128]; char temp_string_fs[1024 * 128]; @@ -271,14 +269,12 @@ int kickstart(int argc, char **argv) { iron_threads_init(); iron_display_init(); - gc_start(&argc); _kickstart(); #ifdef WITH_AUDIO iron_a2_shutdown(); #endif - gc_stop(); return 0; } @@ -348,24 +344,6 @@ unsigned char *iron_deflate_raw(unsigned char *data, int data_len, int *out_len, #include #endif -#ifdef IRON_MACOS -const char *iron_get_resource_path(); -#endif -#ifdef IRON_IOS -const char *iron_get_resource_path(); -#endif - -#if defined(IRON_IOS) || defined(IRON_ANDROID) -char mobile_title[1024]; -#endif - -static gpu_buffer_t rt_constant_buffer; -static gpu_raytrace_pipeline_t rt_pipeline; -static gpu_raytrace_acceleration_structure_t rt_accel; -static bool rt_created = false; -static bool rt_accel_created = false; -const int rt_constant_buffer_size = 24; - void _update(void *data) { #ifdef IRON_WINDOWS if (in_background && ++paused_frames > 3) { @@ -580,68 +558,21 @@ void _pen_move(int x, int y, float pressure) { #endif } -void _drop_files(wchar_t *file_path, void *data) { -// Update mouse position -#ifdef IRON_WINDOWS +void _drop_files(char *file_path, void *data) { + // Update mouse position + #ifdef IRON_WINDOWS POINT p; GetCursorPos(&p); ScreenToClient(iron_windows_window_handle(), &p); _mouse_move(p.x, p.y, 0, 0, NULL); -#endif + #endif - char buffer[1024]; + iron_drop_files(file_path); -#ifdef IRON_WINDOWS - WideCharToMultiByte(CP_UTF8, 0, file_path, wcslen(file_path) + 1, buffer, sizeof(buffer), NULL, NULL); -#else - wcstombs(buffer, file_path, sizeof(buffer)); -#endif - - iron_drop_files(buffer); in_background = false; - -#ifdef IDLE_SLEEP + #ifdef IDLE_SLEEP paused_frames = 0; -#endif -} - -char *uri_decode(const char *src) { - char *res = gc_alloc(1024); - char *dst = res; - char a, b; - while (*src) { - if ((*src == '%') && ((a = src[1]) && (b = src[2])) && (isxdigit(a) && isxdigit(b))) { - if (a >= 'a') { - a -= 'a' - 'A'; - } - if (a >= 'A') { - a -= ('A' - 10); - } - else { - a -= '0'; - } - if (b >= 'a') { - b -= 'a' - 'A'; - } - if (b >= 'A') { - b -= ('A' - 10); - } - else { - b -= '0'; - } - *dst++ = 16 * a + b; - src += 3; - } - else if (*src == '+') { - *dst++ = ' '; - src++; - } - else { - *dst++ = *src++; - } - } - *dst++ = '\0'; - return res; + #endif } f32 math_floor(f32 x) { return floorf(x); } @@ -1154,6 +1085,11 @@ gpu_texture_t *gpu_create_texture_from_encoded_bytes(buffer_t *data, string_t *f return texture; } +void gpu_delete_texture(gpu_texture_t *texture) { + gpu_texture_destroy(texture); + free(texture); +} + gpu_texture_t *iron_load_texture(string_t *file) { #ifdef WITH_EMBED buffer_t *b = embed_get(file); @@ -1166,7 +1102,6 @@ gpu_texture_t *iron_load_texture(string_t *file) { if (!iron_file_reader_open(&reader, file, IRON_FILE_TYPE_ASSET)) { return NULL; } - int size = (int)iron_file_reader_size(&reader); unsigned char *data = (unsigned char *)malloc(size); iron_file_reader_read(&reader, data, size); @@ -1177,11 +1112,6 @@ gpu_texture_t *iron_load_texture(string_t *file) { return gpu_create_texture_from_encoded_bytes(&buf, file); } -void iron_delete_texture(gpu_texture_t *texture) { - gpu_texture_destroy(texture); - free(texture); -} - #ifdef WITH_AUDIO any iron_load_sound(string_t *file) { @@ -1210,17 +1140,6 @@ buffer_t *iron_load_blob(string_t *file) { return buffer; } -void iron_set_window_title(string_t *title) { - iron_window_set_title(title); - #if defined(IRON_IOS) || defined(IRON_ANDROID) - strcpy(mobile_title, title); - #endif -} - -void iron_set_window_mode(i32 mode) { - iron_window_change_mode((iron_window_mode_t)mode); -} - i32 iron_screen_dpi() { return iron_display_current_mode(iron_primary_display()).pixels_per_inch; } @@ -1334,26 +1253,6 @@ i32 iron_sys_command(string_t *cmd) { return result; } -string_t *iron_get_files_location() { - #ifdef IRON_MACOS - char path[1024]; - strcpy(path, iron_get_resource_path()); - strcat(path, "/"); - strcat(path, IRON_OUTDIR); - strcat(path, "/"); - return path; - #elif defined(IRON_IOS) - char path[1024]; - strcpy(path, iron_get_resource_path()); - strcat(path, "/"); - strcat(path, IRON_OUTDIR); - strcat(path, "/"); - return path; - #else - return iron_internal_get_files_location(); - #endif -} - typedef struct _callback_data { int32_t size; char url[512]; @@ -1404,37 +1303,14 @@ void iron_file_download(string_t *url, void (*callback)(char *, buffer_t *), i32 iron_https_request(url_base, url_path, NULL, 443, 0, &_https_callback, cbd); } -#ifdef IRON_LINUX +#if defined(IRON_WINDOWS) || (defined(IRON_LINUX) && defined(WITH_NFD)) bool _save_and_quit_callback_internal(); #endif bool _save_and_quit_callback(void *data) { - #ifdef IRON_WINDOWS - bool save = false; - wchar_t title[1024]; - GetWindowTextW(iron_windows_window_handle(), title, sizeof(title)); - bool dirty = wcsstr(title, L"* - ArmorPaint") != NULL; - if (dirty) { - int res = MessageBox(iron_windows_window_handle(), L"Project has been modified, save changes?", L"Save Changes?", MB_YESNOCANCEL | MB_ICONEXCLAMATION); - if (res == IDYES) { - save = true; - } - else if (res == IDNO) { - save = false; - } - else { // Cancel - return false; - } - } - iron_save_and_quit(save); - return false; + #if defined(IRON_WINDOWS) || (defined(IRON_LINUX) && defined(WITH_NFD)) // Has gtk + return _save_and_quit_callback_internal(); #endif - - #if defined(IRON_LINUX) && defined(WITH_NFD) // Has gtk - _save_and_quit_callback_internal(); - return false; - #endif - return true; } @@ -1865,6 +1741,13 @@ void iron_mp4_encode(buffer_t *pixels) { } #endif +static gpu_buffer_t rt_constant_buffer; +static gpu_raytrace_pipeline_t rt_pipeline; +static gpu_raytrace_acceleration_structure_t rt_accel; +static bool rt_created = false; +static bool rt_accel_created = false; +const int rt_constant_buffer_size = 24; + void iron_raytrace_init(buffer_t *shader) { if (rt_created) { gpu_buffer_destroy(&rt_constant_buffer); diff --git a/base/sources/iron_file.c b/base/sources/iron_file.c index a0657ad6..067d7115 100644 --- a/base/sources/iron_file.c +++ b/base/sources/iron_file.c @@ -11,15 +11,6 @@ #include #include #endif - -#ifdef IRON_IOS -const char *iron_get_resource_path(void); -#endif - -#ifdef IRON_MACOS -const char *iron_get_resource_path(void); -#endif - #ifdef IRON_WINDOWS #include #endif @@ -28,13 +19,32 @@ static char *fileslocation = NULL; #ifdef IRON_WINDOWS static wchar_t wfilepath[1001]; #endif +#if defined(IRON_MACOS) || defined(IRON_IOS) +const char *iron_get_resource_path(); +#endif void iron_internal_set_files_location(char *dir) { fileslocation = dir; } -char *iron_internal_get_files_location(void) { +char *iron_internal_files_location(void) { + #ifdef IRON_MACOS + char path[1024]; + strcpy(path, iron_get_resource_path()); + strcat(path, "/"); + strcat(path, IRON_OUTDIR); + strcat(path, "/"); + return path; + #elif defined(IRON_IOS) + char path[1024]; + strcpy(path, iron_get_resource_path()); + strcat(path, "/"); + strcat(path, IRON_OUTDIR); + strcat(path, "/"); + return path; + #else return fileslocation; + #endif } #ifdef IRON_WINDOWS diff --git a/base/sources/iron_file.h b/base/sources/iron_file.h index 8951651e..3c3455d3 100644 --- a/base/sources/iron_file.h +++ b/base/sources/iron_file.h @@ -50,7 +50,7 @@ uint8_t iron_read_u8(uint8_t *data); int8_t iron_read_s8(uint8_t *data); void iron_internal_set_files_location(char *dir); -char *iron_internal_get_files_location(void); +char *iron_internal_files_location(void); bool iron_internal_file_reader_open(iron_file_reader_t *reader, const char *filename, int type); typedef struct iron_file_writer { diff --git a/base/sources/iron_system.c b/base/sources/iron_system.c index 18d1a6dc..872a84aa 100644 --- a/base/sources/iron_system.c +++ b/base/sources/iron_system.c @@ -94,7 +94,7 @@ static void (*resume_callback)(void *) = NULL; static void *resume_callback_data = NULL; static void (*shutdown_callback)(void *) = NULL; static void *shutdown_callback_data = NULL; -static void (*drop_files_callback)(wchar_t *, void *) = NULL; +static void (*drop_files_callback)(char *, void *) = NULL; static void *drop_files_callback_data = NULL; static char *(*cut_callback)(void *) = NULL; static void *cut_callback_data = NULL; @@ -137,7 +137,7 @@ void iron_set_shutdown_callback(void (*callback)(void *), void *data) { shutdown_callback_data = data; } -void iron_set_drop_files_callback(void (*callback)(wchar_t *, void *), void *data) { +void iron_set_drop_files_callback(void (*callback)(char *, void *), void *data) { drop_files_callback = callback; drop_files_callback_data = data; } @@ -193,7 +193,7 @@ void iron_internal_shutdown_callback(void) { } } -void iron_internal_drop_files_callback(wchar_t *filePath) { +void iron_internal_drop_files_callback(char *filePath) { if (drop_files_callback != NULL) { drop_files_callback(filePath, drop_files_callback_data); } diff --git a/base/sources/iron_system.h b/base/sources/iron_system.h index 2bcb84a7..89a3f7a0 100644 --- a/base/sources/iron_system.h +++ b/base/sources/iron_system.h @@ -100,7 +100,7 @@ void iron_set_resume_callback(void (*callback)(void *), void *data); void iron_set_pause_callback(void (*callback)(void *), void *data); void iron_set_background_callback(void (*callback)(void *), void *data); void iron_set_shutdown_callback(void (*callback)(void *), void *data); -void iron_set_drop_files_callback(void (*callback)(wchar_t *, void *), void *data); +void iron_set_drop_files_callback(void (*callback)(char *, void *), void *data); void iron_set_cut_callback(char *(*callback)(void *), void *data); void iron_set_copy_callback(char *(*callback)(void *), void *data); void iron_set_paste_callback(void (*callback)(char *, void *), void *data); @@ -115,7 +115,7 @@ void iron_internal_resume_callback(void); void iron_internal_pause_callback(void); void iron_internal_background_callback(void); void iron_internal_shutdown_callback(void); -void iron_internal_drop_files_callback(wchar_t *); +void iron_internal_drop_files_callback(char *); char *iron_internal_cut_callback(void); char *iron_internal_copy_callback(void); void iron_internal_paste_callback(char *); diff --git a/base/sources/ts/data.ts b/base/sources/ts/data.ts index 73a002cb..ff6bd503 100644 --- a/base/sources/ts/data.ts +++ b/base/sources/ts/data.ts @@ -189,7 +189,7 @@ function data_delete_image(handle: string) { if (image == null) { return; } - iron_delete_texture(image); + gpu_delete_texture(image); map_delete(data_cached_images, handle); } @@ -247,7 +247,7 @@ function data_delete_all() { let cached_images_keys: string[] = map_keys(data_cached_images); for (let i: i32 = 0; i < cached_images_keys.length; ++i) { let c: gpu_texture_t = map_get(data_cached_images, cached_images_keys[i]); - iron_delete_texture(c); + gpu_delete_texture(c); } data_cached_images = map_create(); diff --git a/base/sources/ts/file.ts b/base/sources/ts/file.ts index e9f42c19..c8e17e45 100644 --- a/base/sources/ts/file.ts +++ b/base/sources/ts/file.ts @@ -105,7 +105,7 @@ function file_cache_cloud(path: string, done: (s: string)=>void) { dest = iron_internal_save_path(); } else { - dest = iron_get_files_location() + path_sep; + dest = iron_internal_files_location() + path_sep; } dest += path; diff --git a/base/sources/ts/iron.ts b/base/sources/ts/iron.ts index 4f638845..13f71e88 100644 --- a/base/sources/ts/iron.ts +++ b/base/sources/ts/iron.ts @@ -152,7 +152,6 @@ declare function json_encode_end_array(): void; declare function json_encode_begin_object(): void; declare function json_encode_end_object(): void; declare function json_encode_map(m: map_t): void; -declare function uri_decode(s: string): string; declare function js_eval(js: string): f32; declare function js_call(f: any): string; @@ -226,8 +225,8 @@ declare function gpu_create_pipeline(): any; declare function gpu_delete_pipeline(pipeline: any): void; declare function gpu_pipeline_compile(pipeline: any): void; declare function gpu_set_pipeline(pipeline: any): void; +declare function gpu_delete_texture(image: gpu_texture_t): void; declare function iron_load_texture(file: string): any; -declare function iron_delete_texture(image: gpu_texture_t): void; declare function iron_load_sound(file: string): any; declare function iron_a1_sound_destroy(sound: any): void; declare function iron_a1_play_sound(sound: any, loop: bool, pitch: f32, unique: bool): audio_channel_t; @@ -253,9 +252,9 @@ declare function gpu_device_name(): string; declare function iron_time(): f32; declare function iron_window_width(): i32; declare function iron_window_height(): i32; -declare function iron_set_window_title(title: string): void; +declare function iron_window_set_title(title: string): void; declare function iron_window_get_mode(): i32; -declare function iron_set_window_mode(mode: i32): void; +declare function iron_window_change_mode(mode: i32): void; declare function iron_window_resize(width: i32, height: i32): void; declare function iron_window_move(x: i32, y: i32): void; declare function iron_screen_dpi(): i32; @@ -284,7 +283,7 @@ declare function iron_sys_command(cmd: string): i32; declare function iron_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; +declare function iron_internal_files_location(): string; declare function iron_file_download(url: string, callback: (url: string, _: buffer_t)=>void, size: i32 = 0): void; declare function draw_init(image_vert: buffer_t, image_frag: buffer_t, image_transform_vert: buffer_t, image_transform_frag: buffer_t, rect_vert: buffer_t, rect_frag: buffer_t, tris_vert: buffer_t, tris_frag: buffer_t, text_vert: buffer_t, text_frag: buffer_t): void; diff --git a/base/sources/ts/path.ts b/base/sources/ts/path.ts index 30c9033c..74c1280f 100644 --- a/base/sources/ts/path.ts +++ b/base/sources/ts/path.ts @@ -5,12 +5,6 @@ let path_sep: string = "\\"; let path_sep: string = "/"; ///end -// ///if arm_windows -// let path_pwd: string = "cd"; -// ///else -// let path_pwd: string = "echo $PWD"; -// ///end - let path_mesh_formats: string[] = ["obj", "blend"]; let path_texture_formats: string[] = ["jpg", "jpeg", "png", "tga", "bmp", "psd", "gif", "hdr", "k"]; @@ -25,10 +19,8 @@ let path_roughness_ext: string[] = ["roughness", "rough", "r", "rgh"]; let path_metallic_ext: string[] = ["metallic", "metal", "metalness", "m", "met"]; let path_displacement_ext: string[] = ["displacement", "height", "h", "disp"]; -// let path_working_dir_cache: string = null; - function path_data(): string { - return iron_get_files_location() + path_sep + data_path(); + return iron_internal_files_location() + path_sep + data_path(); } function path_to_relative(from: string, to: string): string { @@ -75,24 +67,6 @@ function path_base_name(path: string): string { return substring(path, string_last_index_of(path, path_sep) + 1, string_last_index_of(path, ".")); } -// function path_working_dir(): string { -// if (path_working_dir_cache == null) { -// let cmd: string = path_pwd; -// let save: string; -// if (path_is_protected()) { -// save = iron_internal_save_path(); -// } -// else { -// save = path_data() + path_sep; -// } -// save += "working_dir.txt"; -// iron_sys_command(cmd + " > \"" + save + "\""); -// path_working_dir_cache = sys_buffer_to_string(iron_load_blob(save)); -// path_working_dir_cache = trim_end(path_working_dir_cache); -// } -// return path_working_dir_cache; -// } - function path_is_mesh(path: string): bool { let p: string = to_lower_case(path); for (let i: i32 = 0; i < path_mesh_formats.length; ++i) { @@ -192,7 +166,7 @@ function path_is_folder(p: string): bool { function path_is_protected(): bool { ///if arm_windows - return string_index_of(iron_get_files_location(), "Program Files") >= 0; + return string_index_of(iron_internal_files_location(), "Program Files") >= 0; ///elseif arm_android return true; ///elseif arm_ios diff --git a/base/sources/ts/render_path.ts b/base/sources/ts/render_path.ts index 246fcdf9..555a2ee5 100644 --- a/base/sources/ts/render_path.ts +++ b/base/sources/ts/render_path.ts @@ -245,7 +245,7 @@ function render_path_resize() { for (let i: i32 = 0; i < render_targets_keys.length; ++i) { let rt: render_target_t = map_get(render_path_render_targets, render_targets_keys[i]); if (rt != null && rt.width == 0) { - iron_delete_texture(rt._image); + gpu_delete_texture(rt._image); rt._image = render_path_create_image(rt); } } @@ -305,6 +305,6 @@ function render_target_create(): render_target_t { function render_target_unload(raw: render_target_t) { if (raw._image != null) { - iron_delete_texture(raw._image); + gpu_delete_texture(raw._image); } } diff --git a/base/sources/ts/sys.ts b/base/sources/ts/sys.ts index c6eeef44..dc2b0552 100644 --- a/base/sources/ts/sys.ts +++ b/base/sources/ts/sys.ts @@ -241,7 +241,7 @@ function sys_title(): string { } function sys_title_set(value: string) { - iron_set_window_title(value); + iron_window_set_title(value); _sys_window_title = value; } diff --git a/base/tools/pad/sources/main.ts b/base/tools/pad/sources/main.ts index 3a1ce5a7..740778ca 100644 --- a/base/tools/pad/sources/main.ts +++ b/base/tools/pad/sources/main.ts @@ -161,7 +161,7 @@ function list_folder(path: string) { storage.text = string_replace_all(storage.text, "\r", ""); text_handle.text = storage.text; editor_handle.redraws = 1; - iron_set_window_title(abs); + iron_window_set_title(abs); } // Expand folder else { @@ -318,7 +318,7 @@ function draw_minimap() { if (minimap_h != iron_window_height()) { minimap_h = iron_window_height(); if (minimap != null) { - iron_delete_texture(minimap); + gpu_delete_texture(minimap); } minimap = gpu_create_render_target(minimap_w, minimap_h); } diff --git a/paint/sources/base.ts b/paint/sources/base.ts index 658e69b5..afb7951a 100644 --- a/paint/sources/base.ts +++ b/paint/sources/base.ts @@ -59,9 +59,6 @@ function base_init() { base_last_window_height = iron_window_height(); sys_notify_on_drop_files(function (drop_path: string) { - ///if arm_linux - drop_path = uri_decode(drop_path); - ///end drop_path = trim_end(drop_path); array_push(base_drop_paths, drop_path); }); @@ -667,10 +664,10 @@ function base_toggle_fullscreen() { config_raw.window_h = iron_window_height(); config_raw.window_x = iron_window_x(); config_raw.window_y = iron_window_y(); - iron_set_window_mode(window_mode_t.FULLSCREEN); + iron_window_change_mode(window_mode_t.FULLSCREEN); } else { - iron_set_window_mode(window_mode_t.WINDOWED); + iron_window_change_mode(window_mode_t.WINDOWED); iron_window_resize(config_raw.window_w, config_raw.window_h); iron_window_move(config_raw.window_x, config_raw.window_y); } diff --git a/paint/sources/brush_nodes/color_node.ts b/paint/sources/brush_nodes/color_node.ts index 045254c4..7e1af476 100644 --- a/paint/sources/brush_nodes/color_node.ts +++ b/paint/sources/brush_nodes/color_node.ts @@ -34,7 +34,7 @@ function color_node_get_as_image(self: color_node_t, from: i32): gpu_texture_t { return logic_node_input_get_as_image(self.base.inputs[0]); } if (self.image != null) { - iron_delete_texture(self.image); + gpu_delete_texture(self.image); } let b: buffer_t = buffer_create(16); buffer_set_f32(b, 0, self.value.x); diff --git a/paint/sources/brush_nodes/float_node.ts b/paint/sources/brush_nodes/float_node.ts index ad79f059..771b3f0e 100644 --- a/paint/sources/brush_nodes/float_node.ts +++ b/paint/sources/brush_nodes/float_node.ts @@ -30,7 +30,7 @@ function float_node_get_as_image(self: float_node_t, from: i32): gpu_texture_t { return logic_node_input_get_as_image(self.base.inputs[0]); } if (self.image != null) { - iron_delete_texture(self.image); + gpu_delete_texture(self.image); } let b: buffer_t = buffer_create(16); buffer_set_f32(b, 0, self.value); diff --git a/paint/sources/brush_nodes/vector_node.ts b/paint/sources/brush_nodes/vector_node.ts index a11a9378..ede24869 100644 --- a/paint/sources/brush_nodes/vector_node.ts +++ b/paint/sources/brush_nodes/vector_node.ts @@ -38,7 +38,7 @@ function vector_node_get_as_image(self: vector_node_t, from: i32): gpu_texture_t // let y: f32 = logic_node_input_get(self.base.inputs[1]); // let z: f32 = logic_node_input_get(self.base.inputs[2]); if (self.image != null) { - iron_delete_texture(self.image); + gpu_delete_texture(self.image); } let b: buffer_t = buffer_create(16); let n0: float_node_t = self.base.inputs[0].node; diff --git a/paint/sources/export_arm.ts b/paint/sources/export_arm.ts index 3160bf6b..1369e563 100644 --- a/paint/sources/export_arm.ts +++ b/paint/sources/export_arm.ts @@ -176,7 +176,7 @@ function export_arm_run_project() { // ///end iron_write_png(substring(project_filepath, 0, project_filepath.length - 4) + "_icon.png", mesh_icon_pixels, 256, 256, 0); - iron_delete_texture(mesh_icon); + gpu_delete_texture(mesh_icon); ///end let is_packed: bool = ends_with(project_filepath, "_packed_.arm"); @@ -468,7 +468,7 @@ function export_arm_pack_assets(raw: project_format_t, assets: asset_t[]) { for (let i: i32 = 0; i < temp_images.length; ++i) { let image: gpu_texture_t = temp_images[i]; - iron_delete_texture(image); + gpu_delete_texture(image); } } diff --git a/paint/sources/import_arm.ts b/paint/sources/import_arm.ts index 05e2d0e8..73d420c8 100644 --- a/paint/sources/import_arm.ts +++ b/paint/sources/import_arm.ts @@ -183,13 +183,13 @@ function import_arm_run_project(path: string) { let rts: map_t = render_path_render_targets; let blend0: render_target_t = map_get(rts, "texpaint_blend0"); let _texpaint_blend0: gpu_texture_t = blend0._image; - iron_delete_texture(_texpaint_blend0); + gpu_delete_texture(_texpaint_blend0); blend0.width = config_get_texture_res_x(); blend0.height = config_get_texture_res_y(); blend0._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.R8); let blend1: render_target_t = map_get(rts, "texpaint_blend1"); let _texpaint_blend1: gpu_texture_t = blend1._image; - iron_delete_texture(_texpaint_blend1); + gpu_delete_texture(_texpaint_blend1); blend1.width = config_get_texture_res_x(); blend1.height = config_get_texture_res_y(); blend1._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.R8); @@ -273,13 +273,13 @@ function import_arm_run_project(path: string) { l.paint_emis = ld.paint_emis; l.paint_subs = ld.paint_subs; - iron_delete_texture(_texpaint); + gpu_delete_texture(_texpaint); if (_texpaint_nor != null) { - iron_delete_texture(_texpaint_nor); + gpu_delete_texture(_texpaint_nor); } if (_texpaint_pack != null) { - iron_delete_texture(_texpaint_pack); + gpu_delete_texture(_texpaint_pack); } } } diff --git a/paint/sources/layers.ts b/paint/sources/layers.ts index c6e83b0e..87ca0616 100644 --- a/paint/sources/layers.ts +++ b/paint/sources/layers.ts @@ -51,14 +51,14 @@ function layers_resize() { let blend0: render_target_t = map_get(rts, "texpaint_blend0"); let _texpaint_blend0: gpu_texture_t = blend0._image; - iron_delete_texture(_texpaint_blend0); + gpu_delete_texture(_texpaint_blend0); blend0.width = config_get_texture_res_x(); blend0.height = config_get_texture_res_y(); blend0._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.R8); let blend1: render_target_t = map_get(rts, "texpaint_blend1"); let _texpaint_blend1: gpu_texture_t = blend1._image; - iron_delete_texture(_texpaint_blend1); + gpu_delete_texture(_texpaint_blend1); blend1.width = config_get_texture_res_x(); blend1.height = config_get_texture_res_y(); blend1._image = gpu_create_render_target(config_get_texture_res_x(), config_get_texture_res_y(), tex_format_t.R8); @@ -68,7 +68,7 @@ function layers_resize() { let blur: render_target_t = map_get(rts, "texpaint_blur"); if (blur != null) { let _texpaint_blur: gpu_texture_t = blur._image; - iron_delete_texture(_texpaint_blur); + gpu_delete_texture(_texpaint_blur); let size_x: f32 = math_floor(config_get_texture_res_x() * 0.95); let size_y: f32 = math_floor(config_get_texture_res_y() * 0.95); blur.width = size_x; @@ -120,7 +120,7 @@ function layers_make_temp_img() { function layers_make_temp_mask_img() { if (pipes_temp_mask_image != null && (pipes_temp_mask_image.width != config_get_texture_res_x() || pipes_temp_mask_image.height != config_get_texture_res_y())) { let _temp_mask_image: gpu_texture_t = pipes_temp_mask_image; - iron_delete_texture(_temp_mask_image); + gpu_delete_texture(_temp_mask_image); pipes_temp_mask_image = null; } if (pipes_temp_mask_image == null) { @@ -135,9 +135,9 @@ function layers_make_export_img() { let _expa: gpu_texture_t = layers_expa; let _expb: gpu_texture_t = layers_expb; let _expc: gpu_texture_t = layers_expc; - iron_delete_texture(_expa); - iron_delete_texture(_expb); - iron_delete_texture(_expc); + gpu_delete_texture(_expa); + gpu_delete_texture(_expb); + gpu_delete_texture(_expc); layers_expa = null; layers_expb = null; layers_expc = null; diff --git a/paint/sources/make_material.ts b/paint/sources/make_material.ts index e0d0bf85..00d8dcc8 100644 --- a/paint/sources/make_material.ts +++ b/paint/sources/make_material.ts @@ -223,7 +223,7 @@ function make_material_bake_node_previews() { let key: string = keys[i]; if (array_index_of(context_raw.node_previews_used, key) == -1) { let image: gpu_texture_t = map_get(context_raw.node_previews, key); - iron_delete_texture(image); + gpu_delete_texture(image); map_delete(context_raw.node_previews, key); } } @@ -257,7 +257,7 @@ function make_material_bake_node_preview(node: ui_node_t, group: ui_node_canvas_ let res_y: i32 = math_floor(config_get_texture_res_y() / 4); if (image == null || image.width != res_x || image.height != res_y) { if (image != null) { - iron_delete_texture(image); + gpu_delete_texture(image); } image = gpu_create_render_target(res_x, res_y); map_set(context_raw.node_previews, id, image); @@ -275,7 +275,7 @@ function make_material_bake_node_preview(node: ui_node_t, group: ui_node_canvas_ let res_y: i32 = math_floor(config_get_texture_res_y()); if (image == null || image.width != res_x || image.height != res_y) { if (image != null) { - iron_delete_texture(image); + gpu_delete_texture(image); } image = gpu_create_render_target(res_x, res_y); map_set(context_raw.node_previews, id, image); @@ -293,7 +293,7 @@ function make_material_bake_node_preview(node: ui_node_t, group: ui_node_canvas_ let res_y: i32 = math_floor(config_get_texture_res_y()); if (image == null || image.width != res_x || image.height != res_y) { if (image != null) { - iron_delete_texture(image); + gpu_delete_texture(image); } image = gpu_create_render_target(res_x, res_y, tex_format_t.R8); map_set(context_raw.node_previews, id, image); diff --git a/paint/sources/neural_nodes/photo_to_pbr_node.ts b/paint/sources/neural_nodes/photo_to_pbr_node.ts index 015d7e03..a528d41d 100644 --- a/paint/sources/neural_nodes/photo_to_pbr_node.ts +++ b/paint/sources/neural_nodes/photo_to_pbr_node.ts @@ -157,7 +157,7 @@ function photo_to_pbr_node_get_as_image(self: photo_to_pbr_node_t, from: i32): g draw_begin(photo_to_pbr_node_images[from]); draw_image(temp2, x * photo_to_pbr_node_tile_w, y * photo_to_pbr_node_tile_w); draw_end(); - iron_delete_texture(temp2); + gpu_delete_texture(temp2); } return photo_to_pbr_node_images[from]; diff --git a/paint/sources/neural_nodes/rgb_node.ts b/paint/sources/neural_nodes/rgb_node.ts index 6751f82d..6e63be43 100644 --- a/paint/sources/neural_nodes/rgb_node.ts +++ b/paint/sources/neural_nodes/rgb_node.ts @@ -16,7 +16,7 @@ function rgb_node_create(raw: ui_node_t, args: f32_array_t): rgb_node_t { function rgb_node_get_as_image(self: rgb_node_t, from: i32): gpu_texture_t { if (self.image != null) { - iron_delete_texture(self.image); + gpu_delete_texture(self.image); } let f32a: f32_array_t = f32_array_create(4); diff --git a/paint/sources/neural_nodes/text_to_photo_node.ts b/paint/sources/neural_nodes/text_to_photo_node.ts index 40650550..4f8628f3 100644 --- a/paint/sources/neural_nodes/text_to_photo_node.ts +++ b/paint/sources/neural_nodes/text_to_photo_node.ts @@ -280,7 +280,7 @@ function text_to_photo_node_vae_decoder(latents: f32_array_t, upscale: bool): gp while (image.width < config_get_texture_res_x()) { let last_image: gpu_texture_t = image; image = upscale_node_esrgan(image); - iron_delete_texture(last_image); + gpu_delete_texture(last_image); } return image; } diff --git a/paint/sources/neural_nodes/upscale_node.ts b/paint/sources/neural_nodes/upscale_node.ts index bf5ec2b0..88af4807 100644 --- a/paint/sources/neural_nodes/upscale_node.ts +++ b/paint/sources/neural_nodes/upscale_node.ts @@ -26,7 +26,7 @@ function upscale_node_get_as_image(self: upscale_node_t, from: i32): gpu_texture while (upscale_node_image.width < config_get_texture_res_x()) { let last_image: gpu_texture_t = upscale_node_image; upscale_node_image = upscale_node_esrgan(upscale_node_image); - iron_delete_texture(last_image); + gpu_delete_texture(last_image); } } return upscale_node_image; @@ -47,7 +47,7 @@ function upscale_node_do_tile(source: gpu_texture_t): gpu_texture_t { let size2w: i32 = math_floor(size1w * 2); let size2h: i32 = math_floor(size1h * 2); if (upscale_node_temp != null) { - iron_delete_texture(upscale_node_temp); + gpu_delete_texture(upscale_node_temp); } upscale_node_temp = gpu_create_render_target(size1w, size1h); draw_begin(upscale_node_temp); @@ -118,10 +118,10 @@ function upscale_node_esrgan(source: gpu_texture_t): gpu_texture_t { draw_begin(result); draw_sub_image(tile_result, x * tile_size2x, y * tile_size2x, 64, 64, tile_size2x, tile_size2x); draw_end(); - iron_delete_texture(tile_result); + gpu_delete_texture(tile_result); } } - iron_delete_texture(tile_source); + gpu_delete_texture(tile_source); } else { result = upscale_node_do_tile(source); // Single tile diff --git a/paint/sources/render_path_raytrace_bake.ts b/paint/sources/render_path_raytrace_bake.ts index 4c454da3..ccd84db5 100644 --- a/paint/sources/render_path_raytrace_bake.ts +++ b/paint/sources/render_path_raytrace_bake.ts @@ -25,9 +25,9 @@ function render_path_raytrace_bake_commands(parse_paint_material: (b?: bool)=>vo let baketex0: render_target_t = map_get(render_path_render_targets, "baketex0"); let baketex1: render_target_t = map_get(render_path_render_targets, "baketex1"); let baketex2: render_target_t = map_get(render_path_render_targets, "baketex2"); - iron_delete_texture(baketex0._image); - iron_delete_texture(baketex1._image); - iron_delete_texture(baketex2._image); + gpu_delete_texture(baketex0._image); + gpu_delete_texture(baketex1._image); + gpu_delete_texture(baketex2._image); } { diff --git a/paint/sources/slot_layer.ts b/paint/sources/slot_layer.ts index 14d97d5e..fcbeca1d 100644 --- a/paint/sources/slot_layer.ts +++ b/paint/sources/slot_layer.ts @@ -179,15 +179,15 @@ function slot_layer_unload(raw: slot_layer_t) { let _texpaint_pack: gpu_texture_t = raw.texpaint_pack; let _texpaint_preview: gpu_texture_t = raw.texpaint_preview; - iron_delete_texture(_texpaint); + gpu_delete_texture(_texpaint); if (_texpaint_nor != null) { - iron_delete_texture(_texpaint_nor); + gpu_delete_texture(_texpaint_nor); } if (_texpaint_pack != null) { - iron_delete_texture(_texpaint_pack); + gpu_delete_texture(_texpaint_pack); } if (_texpaint_preview != null) { - iron_delete_texture(_texpaint_preview); + gpu_delete_texture(_texpaint_preview); } map_delete(render_path_render_targets, "texpaint" + raw.ext); @@ -261,7 +261,7 @@ function slot_layer_invert_mask(raw: slot_layer_t) { draw_set_pipeline(null); draw_end(); let _texpaint: gpu_texture_t = raw.texpaint; - iron_delete_texture(_texpaint); + gpu_delete_texture(_texpaint); let rt: render_target_t = map_get(render_path_render_targets, "texpaint" + raw.id); raw.texpaint = rt._image = inverted; context_raw.layer_preview_dirty = true; @@ -397,12 +397,12 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { draw_end(); } - iron_delete_texture(_texpaint); + gpu_delete_texture(_texpaint); if (_texpaint_nor != null) { - iron_delete_texture(_texpaint_nor); + gpu_delete_texture(_texpaint_nor); } if (_texpaint_pack != null) { - iron_delete_texture(_texpaint_pack); + gpu_delete_texture(_texpaint_pack); } let rt: render_target_t = map_get(rts, "texpaint" + raw.ext); @@ -428,7 +428,7 @@ function slot_layer_resize_and_set_bits(raw: slot_layer_t) { draw_set_pipeline(null); draw_end(); - iron_delete_texture(_texpaint); + gpu_delete_texture(_texpaint); let rt: render_target_t = map_get(rts, "texpaint" + raw.ext); rt._image = raw.texpaint; diff --git a/paint/sources/slot_material.ts b/paint/sources/slot_material.ts index b32c421a..f7540bd4 100644 --- a/paint/sources/slot_material.ts +++ b/paint/sources/slot_material.ts @@ -80,8 +80,8 @@ function slot_material_create(m: material_data_t = null, c: ui_node_canvas_t = n } function slot_material_unload(raw: slot_material_t) { - iron_delete_texture(raw.image); - iron_delete_texture(raw.image_icon); + gpu_delete_texture(raw.image); + gpu_delete_texture(raw.image_icon); } function slot_material_delete(raw: slot_material_t) { diff --git a/paint/sources/tab_textures.ts b/paint/sources/tab_textures.ts index 8d37c621..33c6d162 100644 --- a/paint/sources/tab_textures.ts +++ b/paint/sources/tab_textures.ts @@ -151,7 +151,7 @@ function tab_textures_draw(htab: ui_handle_t) { f += ".png"; } iron_write_png(path + path_sep + f, gpu_get_texture_pixels(target), target.width, target.height, 0); - iron_delete_texture(target); + gpu_delete_texture(target); }, target); }); }); diff --git a/paint/sources/ui_nodes.ts b/paint/sources/ui_nodes.ts index fb54861a..2979f7e6 100644 --- a/paint/sources/ui_nodes.ts +++ b/paint/sources/ui_nodes.ts @@ -66,7 +66,7 @@ function ui_viewnodes_init() { function ui_viewnodes_on_node_remove(n: ui_node_t) { let img: gpu_texture_t = map_get(context_raw.node_preview_map, n); if (img != null) { - iron_delete_texture(img); + gpu_delete_texture(img); map_delete(context_raw.node_preview_map, n); } } @@ -816,7 +816,7 @@ function ui_nodes_render() { if (ui_nodes_grid_redraw) { if (ui_nodes_grid != null) { - iron_delete_texture(ui_nodes_grid); + gpu_delete_texture(ui_nodes_grid); } ui_nodes_grid = ui_nodes_draw_grid(ui_nodes.zoom); ui_nodes_grid_redraw = false; diff --git a/paint/sources/ui_view2d.ts b/paint/sources/ui_view2d.ts index 280d43dc..324b5195 100644 --- a/paint/sources/ui_view2d.ts +++ b/paint/sources/ui_view2d.ts @@ -75,7 +75,7 @@ function ui_view2d_render() { // Cache grid if (ui_view2d_grid_redraw) { if (ui_view2d_grid != null) { - iron_delete_texture(ui_view2d_grid); + gpu_delete_texture(ui_view2d_grid); } ui_view2d_grid = ui_nodes_draw_grid(ui_view2d_pan_scale); ui_view2d_grid_redraw = false; diff --git a/paint/sources/util_render.ts b/paint/sources/util_render.ts index 64f3af45..8935af78 100644 --- a/paint/sources/util_render.ts +++ b/paint/sources/util_render.ts @@ -151,7 +151,7 @@ function util_render_make_text_preview() { tex_w = 512; } if (context_raw.text_tool_image != null && context_raw.text_tool_image.width < tex_w) { - iron_delete_texture(context_raw.text_tool_image); + gpu_delete_texture(context_raw.text_tool_image); context_raw.text_tool_image = null; } if (context_raw.text_tool_image == null) { diff --git a/paint/sources/util_uv.ts b/paint/sources/util_uv.ts index 2ffa6bad..669a7b84 100644 --- a/paint/sources/util_uv.ts +++ b/paint/sources/util_uv.ts @@ -12,7 +12,7 @@ let util_uv_pipe_dilate: gpu_pipeline_t = null; function util_uv_cache_uv_map() { if (util_uv_uvmap != null && (util_uv_uvmap.width != config_get_texture_res_x() || util_uv_uvmap.height != config_get_texture_res_y())) { - iron_delete_texture(util_uv_uvmap); + gpu_delete_texture(util_uv_uvmap); util_uv_uvmap = null; util_uv_uvmap_cached = false; } @@ -54,7 +54,7 @@ function util_uv_cache_uv_map() { function util_uv_cache_triangle_map() { if (util_uv_trianglemap != null && (util_uv_trianglemap.width != config_get_texture_res_x() || util_uv_trianglemap.height != config_get_texture_res_y())) { - iron_delete_texture(util_uv_trianglemap); + gpu_delete_texture(util_uv_trianglemap); util_uv_trianglemap = null; util_uv_trianglemap_cached = false; } @@ -92,7 +92,7 @@ function util_uv_cache_triangle_map() { function util_uv_cache_dilate_map() { if (util_uv_dilatemap != null && (util_uv_dilatemap.width != config_get_texture_res_x() || util_uv_dilatemap.height != config_get_texture_res_y())) { - iron_delete_texture(util_uv_dilatemap); + gpu_delete_texture(util_uv_dilatemap); util_uv_dilatemap = null; util_uv_dilatemap_cached = false; } @@ -181,7 +181,7 @@ function util_uv_cache_uv_island_map() { } if (util_uv_uvislandmap != null) { - iron_delete_texture(util_uv_uvislandmap); + gpu_delete_texture(util_uv_uvislandmap); } util_uv_uvislandmap = gpu_create_texture_from_bytes(bytes, w, h, tex_format_t.R8); util_uv_uvislandmap_cached = true;