diff options
| author | Valentin Popov <valentin@popov.link> | 2026-07-18 06:29:31 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-07-18 06:29:31 +0300 |
| commit | 6e6496eebf4057ceb4a09869b0df21b1f0260e81 (patch) | |
| tree | d6e019a6f653c07b2b75579bc7c25e3bf45cfc90 /crates/fparkan-inspection/src/lib.rs | |
| parent | 283b48e8c512dd251d4617cc988985e3be2a0c5e (diff) | |
| download | fparkan-6e6496eebf4057ceb4a09869b0df21b1f0260e81.tar.xz fparkan-6e6496eebf4057ceb4a09869b0df21b1f0260e81.zip | |
feat(render): upload original TEXM to Vulkan
Diffstat (limited to 'crates/fparkan-inspection/src/lib.rs')
| -rw-r--r-- | crates/fparkan-inspection/src/lib.rs | 31 |
1 files changed, 31 insertions, 0 deletions
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<fparkan_texm::TexmDocument, String> { + 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<fparkan_texm::RgbaImage, String> { + 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 |
