mirror of
https://codeberg.org/icewind/vbsp.git
synced 2026-06-03 18:54:05 +02:00
texture info handling
This commit is contained in:
parent
c459a8308b
commit
e132a34a00
6 changed files with 69 additions and 7 deletions
|
|
@ -119,3 +119,24 @@ impl<'a> Handle<'a, Leaf> {
|
|||
.filter_map(move |leaf_face| bsp.face(leaf_face.face as usize))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Handle<'a, TextureInfo> {
|
||||
pub fn texture_data(&self) -> Handle<'a, TextureData> {
|
||||
Handle::new(self.bsp, &self.bsp.textures_data[self.data.texture_data_index as usize])
|
||||
}
|
||||
pub fn name(&self) -> &'a str {
|
||||
self.texture_data().name()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Handle<'a, TextureData> {
|
||||
pub fn name(&self) -> &'a str {
|
||||
let start = self.bsp.texture_string_tables[self.name_string_table_id as usize] as usize;
|
||||
let part = &self.bsp.texture_string_data[start..];
|
||||
if let Some((s, _)) = part.split_once("\0") {
|
||||
s
|
||||
} else {
|
||||
part
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue