From 6e6496eebf4057ceb4a09869b0df21b1f0260e81 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 18 Jul 2026 07:29:31 +0400 Subject: feat(render): upload original TEXM to Vulkan --- crates/fparkan-inspection/src/lib.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'crates') diff --git a/crates/fparkan-inspection/src/lib.rs b/crates/fparkan-inspection/src/lib.rs index 983505a..ccef1b7 100644 --- a/crates/fparkan-inspection/src/lib.rs +++ b/crates/fparkan-inspection/src/lib.rs @@ -331,6 +331,37 @@ pub fn inspect_texture_from_root( }) } +/// Loads a decoded TEXM document through repository-backed lookup. +/// +/// # Errors +/// +/// Returns a string error when the resource cannot be resolved or parsed as a +/// valid TEXM payload. +pub fn load_texture_from_root( + root: &Path, + archive: &str, + resource: &str, +) -> Result { + let bytes = read_resource_bytes_diagnostic(root, archive, resource) + .map_err(|err| render_human(&err))?; + decode_texm(bytes).map_err(|err| err.to_string()) +} + +/// Loads and decodes TEXM mip 0 as RGBA8 through repository-backed lookup. +/// +/// # Errors +/// +/// Returns a string error when the resource cannot be resolved, decoded, or +/// converted to the shared RGBA8 upload representation. +pub fn load_texture_mip0_rgba8_from_root( + root: &Path, + archive: &str, + resource: &str, +) -> Result { + let document = load_texture_from_root(root, archive, resource)?; + fparkan_texm::decode_mip_rgba8(&document, 0).map_err(|err| err.to_string()) +} + /// Inspects a terrain land file by path. /// /// # Errors -- cgit v1.2.3