Skip to main content

TextureCache

Struct TextureCache 

Source
pub struct TextureCache { /* private fields */ }

Implementations§

Source§

impl TextureCache

Source

pub fn new(asset_dir: PathBuf, palette: Option<Palette>) -> Self

Builds a texture cache by indexing TEXBSI.* files under asset_dir.

Source

pub fn new_for_edition( asset_dir: PathBuf, palette: Option<Palette>, software: bool, ) -> Self

Selects software TEXTURE banks or Glide TEXBSI banks explicitly.

Source

pub fn from_data( texbsi_data: HashMap<u16, Vec<u8>>, palette: Option<Palette>, ) -> Self

Builds a texture cache from pre-loaded TEXBSI data (no filesystem access).

texbsi_data maps TEXBSI IDs (e.g. 302) to raw file bytes. Used by the FFI layer where the caller provides all data in memory.

Source

pub fn from_software_data( data: HashMap<u16, Vec<u8>>, palette: Option<Palette>, ) -> Result<Self>

Builds a software cache from bank bytes without filesystem access.

Source

pub const fn palette(&self) -> Option<&Palette>

Source

pub const fn missing_requests(&self) -> &BTreeMap<(u16, u8), String>

Referenced texture/image failures retained by the existing fallback path.

Source

pub fn resolve_texture_id( texture_id: u16, contains: impl Fn(u16) -> bool, ) -> u16

Resolves an authored texture bank against available IDs using the exporter’s remapping rules.

Source

pub fn ensure_bsi_available(&mut self, texture_id: u16)

Source

pub fn image_count(&self, texture_id: u16) -> Option<usize>

Source

pub fn get_image_rgba( &mut self, texture_id: u16, image_id: u8, ) -> Option<(Vec<u8>, u16, u16)>

Source

pub fn get_image_rgba_with_frame_count( &mut self, texture_id: u16, image_id: u8, ) -> Option<(Vec<u8>, u16, u16, u16)>

Source

pub fn get_all_frames_by_image_id( &mut self, texture_id: u16, image_id: u8, ) -> Option<AllFramesInfo>

Source

pub fn get_image_dimensions( &mut self, texture_id: u16, image_id: u8, ) -> Option<(u16, u16)>

Returns dimensions for a texture/image pair without decoding PNG bytes.

Source

pub fn get_image_tex_scale( &mut self, texture_id: u16, image_id: u8, ) -> Option<f32>

Returns the effective tex_scale factor for a texture/image pair. The raw BHDR tex_scale is 8.8 fixed-point; 0 is treated as 0x0100 (1.0).

Source

pub fn get_image_png( &mut self, texture_id: u16, image_id: u8, compress: bool, ) -> Option<(Vec<u8>, u16, u16, bool)>

Returns PNG-encoded image bytes, dimensions, and whether the image contains any transparent pixels (palette index 0) for a texture/image pair.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.