From c8dd5f989f63d3d61e74e32eba22dbf9298cf24d Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Sat, 18 Jul 2026 09:52:20 +0400 Subject: feat(game): bind preview diffuse materials --- crates/fparkan-assets/src/lib.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'crates/fparkan-assets/src/lib.rs') 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 { + decode_mip_rgba8(&self.texm, level) + } +} + impl PreparedVisual { /// Returns the primary material id, if any. #[must_use] -- cgit v1.2.3