diff options
| author | Valentin Popov <valentin@popov.link> | 2026-07-18 08:52:20 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-07-18 08:52:20 +0300 |
| commit | c8dd5f989f63d3d61e74e32eba22dbf9298cf24d (patch) | |
| tree | e3410465adbaf6ff7c7dc09b84816b9bbd44ba51 /crates | |
| parent | 2772c39e41c930d41679876842c1f0854ee6f181 (diff) | |
| download | fparkan-c8dd5f989f63d3d61e74e32eba22dbf9298cf24d.tar.xz fparkan-c8dd5f989f63d3d61e74e32eba22dbf9298cf24d.zip | |
feat(game): bind preview diffuse materials
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/fparkan-assets/src/lib.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/fparkan-assets/src/lib.rs b/crates/fparkan-assets/src/lib.rs index f2b820c..e4a9b40 100644 --- a/crates/fparkan-assets/src/lib.rs +++ b/crates/fparkan-assets/src/lib.rs @@ -39,7 +39,7 @@ use fparkan_resource::{ResourceError, ResourceKey, ResourceRepository}; pub use fparkan_terrain::{TerrainError, TerrainWorld}; use fparkan_terrain_format::{decode_build_dat, decode_land_map, decode_land_msh}; pub use fparkan_terrain_format::{BuildCategory, TerrainFormatError}; -use fparkan_texm::{decode_texm, TexmDocument, TexmError}; +use fparkan_texm::{decode_mip_rgba8, decode_texm, RgbaImage, TexmDocument, TexmError}; use std::collections::{hash_map::Entry, HashMap, HashSet}; use std::fmt; use std::hash::{Hash, Hasher}; @@ -307,6 +307,18 @@ pub struct PreparedTexture { pub usage: PreparedTextureUsage, } +impl PreparedTexture { + /// Decodes one prepared texture mip into the renderer upload representation. + /// + /// # Errors + /// + /// Returns the original TEXM decode error when the requested mip is invalid + /// or malformed. + pub fn decode_mip_rgba8(&self, level: u32) -> Result<RgbaImage, TexmError> { + decode_mip_rgba8(&self.texm, level) + } +} + impl PreparedVisual { /// Returns the primary material id, if any. #[must_use] |
