From fad0494b2db09309839de8ea6d9d0be33ca67c5e Mon Sep 17 00:00:00 2001 From: luboslenco Date: Sun, 9 Feb 2025 18:30:12 +0100 Subject: [PATCH] Cleanup --- armorcore/sources/ts/render_path.ts | 32 +++-------------------------- armorcore/sources/ts/uniforms.ts | 5 ----- 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/armorcore/sources/ts/render_path.ts b/armorcore/sources/ts/render_path.ts index 2c4e8d47..4bb0b49d 100644 --- a/armorcore/sources/ts/render_path.ts +++ b/armorcore/sources/ts/render_path.ts @@ -8,7 +8,6 @@ type render_target_t = { scale?: f32; depth_buffer?: string; // 2D texture mipmaps?: bool; - depth?: i32; // 3D texture // Runtime _depth_format?: depth_format_t; _depth_from?: string; @@ -34,7 +33,6 @@ let render_path_commands: ()=>void = null; let render_path_render_targets: map_t = map_create(); let render_path_current_w: i32; let render_path_current_h: i32; -let render_path_current_d: i32; let _render_path_frame_time: f32 = 0.0; let _render_path_frame: i32 = 0; let _render_path_current_target: render_target_t = null; @@ -73,7 +71,6 @@ function render_path_render_frame() { render_path_current_w = app_w(); render_path_current_h = app_h(); - render_path_current_d = 1; _render_path_meshes_sorted = false; for (let i: i32 = 0; i < scene_lights.length; ++i) { @@ -93,7 +90,6 @@ function render_path_render_frame() { function render_path_set_target(target: string, additional: string[] = null) { if (target == "") { // Framebuffer - render_path_current_d = 1; _render_path_current_target = null; render_path_current_w = app_w(); render_path_current_h = app_h(); @@ -115,9 +111,6 @@ function render_path_set_target(target: string, additional: string[] = null) { } render_path_current_w = rt._image.width; render_path_current_h = rt._image.height; - if (rt.depth > 1) { - render_path_current_d = rt._image.depth; - } render_path_begin(rt._image, additional_images); } _render_path_bind_params = null; @@ -165,11 +158,6 @@ function render_path_clear_target(color: color_t = 0x00000000, depth: f32 = 0.0, g4_clear(color, depth, flags); } -function render_path_clear_image(target: string, color: i32) { - let rt: render_target_t = map_get(render_path_render_targets, target); - image_clear(rt._image, 0, 0, 0, rt._image.width, rt._image.height, rt._image.depth, color); -} - function render_path_gen_mipmaps(target: string) { let rt: render_target_t = map_get(render_path_render_targets, target); image_gen_mipmaps(rt._image, 1000); @@ -409,30 +397,17 @@ function render_path_create_target(t: render_target_t): render_target_t { function render_path_create_image(t: render_target_t, depth_format: depth_format_t): image_t { let width: i32 = t.width == 0 ? app_w() : t.width; let height: i32 = t.height == 0 ? app_h() : t.height; - let depth: i32 = t.depth; width = math_floor(width * t.scale); height = math_floor(height * t.scale); - depth = math_floor(depth * t.scale); if (width < 1) { width = 1; } if (height < 1) { height = 1; } - if (t.depth > 1) { // 3D texture - // Image only - let img: image_t = image_create_3d(width, height, depth, - t.format != null ? render_path_get_tex_format(t.format) : tex_format_t.RGBA32); - if (t.mipmaps) { - image_gen_mipmaps(img, 1000); // Allocate mipmaps - } - return img; - } - else { // 2D texture - return image_create_render_target(width, height, - t.format != null ? render_path_get_tex_format(t.format) : tex_format_t.RGBA32, - depth_format); - } + return image_create_render_target(width, height, + t.format != null ? render_path_get_tex_format(t.format) : tex_format_t.RGBA32, + depth_format); } function render_path_get_tex_format(s: string): tex_format_t { @@ -477,7 +452,6 @@ function render_target_create(): render_target_t { let raw: render_target_t = {}; raw.scale = 1.0; raw.mipmaps = false; - raw.depth = 1; raw._depth_from = ""; raw._has_depth = false; return raw; diff --git a/armorcore/sources/ts/uniforms.ts b/armorcore/sources/ts/uniforms.ts index 812ed360..9dd4a361 100644 --- a/armorcore/sources/ts/uniforms.ts +++ b/armorcore/sources/ts/uniforms.ts @@ -125,11 +125,6 @@ function uniforms_bind_render_target(rt: render_target_t, context: shader_contex g4_set_tex(context._.tex_units[j], rt._image); // sampler2D } - if (rt.depth > 1) { // sampler3D - g4_set_tex_3d_params(context._.tex_units[j], tex_addressing_t.CLAMP, tex_addressing_t.CLAMP, tex_addressing_t.CLAMP, tex_filter_t.LINEAR, tex_filter_t.ANISOTROPIC, mip_map_filter_t.LINEAR); - continue; - } - if (rt.mipmaps) { g4_set_tex_params(context._.tex_units[j], tex_addressing_t.CLAMP, tex_addressing_t.CLAMP, tex_filter_t.LINEAR, tex_filter_t.LINEAR, mip_map_filter_t.LINEAR); continue;