mirror of
https://codeberg.org/icewind/vmdl.git
synced 2026-06-03 16:44:11 +02:00
handle empty skin tables
This commit is contained in:
parent
8431ff6613
commit
8d8f7e6158
1 changed files with 18 additions and 7 deletions
13
src/lib.rs
13
src/lib.rs
|
|
@ -13,9 +13,11 @@ pub use crate::vvd::Vvd;
|
||||||
use bytemuck::{pod_read_unaligned, Pod};
|
use bytemuck::{pod_read_unaligned, Pod};
|
||||||
pub use error::*;
|
pub use error::*;
|
||||||
pub use handle::Handle;
|
pub use handle::Handle;
|
||||||
|
use itertools::Either;
|
||||||
pub use shared::*;
|
pub use shared::*;
|
||||||
use std::any::type_name;
|
use std::any::type_name;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::iter::once;
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
|
@ -63,13 +65,22 @@ impl Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn skin_tables(&self) -> impl Iterator<Item = SkinTable> {
|
pub fn skin_tables(&self) -> impl Iterator<Item = SkinTable> {
|
||||||
|
if self.mdl.header.skin_reference_count > 0 {
|
||||||
|
Either::Left(
|
||||||
self.mdl
|
self.mdl
|
||||||
.skin_table
|
.skin_table
|
||||||
.chunks(self.mdl.header.skin_reference_count as usize)
|
.chunks(self.mdl.header.skin_reference_count as usize)
|
||||||
.map(|chunk| SkinTable {
|
.map(|chunk| SkinTable {
|
||||||
table: chunk,
|
table: chunk,
|
||||||
textures: &self.mdl.textures,
|
textures: &self.mdl.textures,
|
||||||
})
|
}),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Either::Right(once(SkinTable {
|
||||||
|
table: &[],
|
||||||
|
textures: &[],
|
||||||
|
}))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn meshes(&self) -> impl Iterator<Item = Mesh> {
|
pub fn meshes(&self) -> impl Iterator<Item = Mesh> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue