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
impl DirTextures
Sourcepub fn new(dirs: &[PathBuf]) -> Self
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.
Sourcepub fn with_cache(self) -> Self
pub fn with_cache(self) -> Self
Keep decoded plain textures in memory.
Sourcepub fn dirs(&self) -> &[PathBuf]
pub fn dirs(&self) -> &[PathBuf]
The directories given to DirTextures::new.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl TextureProvider for DirTextures
impl TextureProvider for DirTextures
Source§fn load(&mut self, name: &str) -> Option<Image>
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>
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>
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>
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§
impl Forget for DirTextures
impl Freeze for DirTextureswhere
*const u8 is !null: Freeze,
PhantomData<PathBuf>: Freeze,
PhantomData<(String, PathBuf)>: Freeze,
PhantomData<String>: Freeze,
PhantomData<(String, Option<Image>)>: Freeze,
impl Move for DirTextures
impl RefUnwindSafe for DirTextures
impl Send for DirTextures
impl Sync for DirTextures
impl Unpin for DirTextures
impl UnsafeUnpin for DirTextureswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<PathBuf>: UnsafeUnpin,
PhantomData<(String, PathBuf)>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<(String, Option<Image>)>: UnsafeUnpin,
impl UnwindSafe for DirTextureswhere
RawVecInner: UnwindSafe,
HashMap<String, PathBuf>: UnwindSafe,
HashMap<String, Option<Image>>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more