aboutsummaryrefslogtreecommitdiff
path: root/crates/texm/src/error.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-02-19 04:19:18 +0300
committerValentin Popov <valentin@popov.link>2026-02-19 04:19:18 +0300
commita281ffa32ea615670d369503692f057b2dc60e6f (patch)
tree321bcc1bfc489e2e7d0ff10dae620864ab08d054 /crates/texm/src/error.rs
parent18d4c6cf9fabc18282b29d103c8d30024f66e49b (diff)
downloadfparkan-a281ffa32ea615670d369503692f057b2dc60e6f.tar.xz
fparkan-a281ffa32ea615670d369503692f057b2dc60e6f.zip
feat: Enhance model and texture loading with improved error handling and new features
- Introduced `LoadedModel` and `LoadedTexture` structs for better encapsulation of model and texture data. - Added functions to load models and textures from archives, including support for resolving textures based on materials and wear entries. - Implemented error handling for missing textures, materials, and wear entries. - Updated the rendering pipeline to support texture loading and binding, including command-line arguments for texture customization. - Enhanced the `texm` crate with new decoding capabilities for various pixel formats, including indexed textures. - Added tests for texture decoding and loading to ensure reliability and correctness. - Updated documentation to reflect changes in the material and texture resolution process.
Diffstat (limited to 'crates/texm/src/error.rs')
-rw-r--r--crates/texm/src/error.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/crates/texm/src/error.rs b/crates/texm/src/error.rs
index a5dda77..38e32ca 100644
--- a/crates/texm/src/error.rs
+++ b/crates/texm/src/error.rs
@@ -23,6 +23,15 @@ pub enum Error {
expected_end: usize,
actual_size: usize,
},
+ MipIndexOutOfRange {
+ requested: usize,
+ mip_count: usize,
+ },
+ MipDataOutOfBounds {
+ offset: usize,
+ size: usize,
+ payload_size: usize,
+ },
InvalidPageMagic,
InvalidPageSize {
expected: usize,
@@ -50,6 +59,21 @@ impl fmt::Display for Error {
f,
"Texm core data out of bounds: expected_end={expected_end}, actual_size={actual_size}"
),
+ Self::MipIndexOutOfRange {
+ requested,
+ mip_count,
+ } => write!(
+ f,
+ "Texm mip index out of range: requested={requested}, mip_count={mip_count}"
+ ),
+ Self::MipDataOutOfBounds {
+ offset,
+ size,
+ payload_size,
+ } => write!(
+ f,
+ "Texm mip data out of bounds: offset={offset}, size={size}, payload_size={payload_size}"
+ ),
Self::InvalidPageMagic => write!(f, "Texm tail exists but Page magic is missing"),
Self::InvalidPageSize { expected, actual } => {
write!(f, "invalid Page chunk size: expected={expected}, actual={actual}")