mirror of
https://codeberg.org/icewind/vmdl.git
synced 2026-06-03 16:44:11 +02:00
expose texture index
This commit is contained in:
parent
2b706a0577
commit
8039f921da
2 changed files with 7 additions and 0 deletions
|
|
@ -100,6 +100,11 @@ impl<'a> SkinTable<'a> {
|
||||||
.get(*texture_index as usize)
|
.get(*texture_index as usize)
|
||||||
.map(|info| info.name.as_str())
|
.map(|info| info.name.as_str())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn texture_index(&self, index: i32) -> Option<usize> {
|
||||||
|
let texture_index = self.table.get(index as usize)?;
|
||||||
|
Some(*texture_index as usize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Mesh<'a> {
|
pub struct Mesh<'a> {
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,7 @@ impl ReadRelative for Mesh {
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct TextureInfo {
|
pub struct TextureInfo {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
pub name_index: i32,
|
||||||
pub search_paths: Vec<String>,
|
pub search_paths: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,6 +135,7 @@ impl ReadRelative for TextureInfo {
|
||||||
fn read(data: &[u8], header: Self::Header) -> Result<Self> {
|
fn read(data: &[u8], header: Self::Header) -> Result<Self> {
|
||||||
Ok(TextureInfo {
|
Ok(TextureInfo {
|
||||||
name: String::read(&data[header.name_index as usize..], ())?.replace('\\', "/"),
|
name: String::read(&data[header.name_index as usize..], ())?.replace('\\', "/"),
|
||||||
|
name_index: header.name_index,
|
||||||
search_paths: Vec::new(),
|
search_paths: Vec::new(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue