Skip to main content

DirTextures

Struct DirTextures 

Source
pub struct DirTextures { /* private fields */ }
Expand description

Directories’ textures for the engine: plain lookups by base name, MD3 sprites / GIFs / shader textures through a MediaFiles index of the same directories.

Implementations§

Source§

impl DirTextures

Source

pub fn new(dirs: &[PathBuf]) -> Self

Index dirs (earlier directories take priority). A directory that is one of the MD3 folders (textures, sprites, gifs) makes its parent the data root too, so a preset’s sprites\x.png resolves next to the textures.

Source

pub fn scan(root: &Path) -> Self

Index the single directory root.

Source

pub fn with_cache(self) -> Self

Keep decoded plain textures in memory.

Source

pub fn dirs(&self) -> &[PathBuf]

The directories given to DirTextures::new.

Source

pub fn len(&self) -> usize

Number of plain textures indexed.

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl TextureProvider for DirTextures

Source§

fn load(&mut self, name: &str) -> Option<Image>

Pixels of the texture called name, or None when the host has no such texture.
Source§

fn random_pool(&self) -> Vec<String>

Names (same namespace as TextureProvider::load) the engine may pick from for randNN samplers. Order is part of the determinism contract: return the names sorted ascending (lowercase); duplicates are allowed and count as separate entries (projectM’s texture scan keeps one entry per file).
Source§

fn load_md3_texture(&mut self, name: &str) -> Option<Media>

MilkDrop 3 (Compat::MilkDrop3): the shader texture name (same naming as TextureProvider::load), looked up like MD3 does — .gif and .jfif files too, in the textures, sprites and gifs folders (MediaFiles::find_texture) — and an animated GIF returned as Media::Animated. The default has no MD3 folders and no animation: it is TextureProvider::load.
Source§

fn load_sprite(&mut self, path: &str) -> Option<Media>

MilkDrop 3: the image of a preset’s SpriteName, a path relative to the MD3 data root with \ or / separators (sprites\logo.png); see MediaFiles::find_sprite. Any format the host can decode; a GIF comes back as Media::Animated (see decode_gif). The default finds nothing.

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,