mirror of
https://codeberg.org/icewind/vmdl.git
synced 2026-06-03 16:44:11 +02:00
ci
This commit is contained in:
parent
4be7e6db0a
commit
377e1773c0
14 changed files with 2683 additions and 32 deletions
|
|
@ -55,7 +55,7 @@ impl Model {
|
|||
.body_parts
|
||||
.iter()
|
||||
.flat_map(|part| part.models.iter())
|
||||
.flat_map(|model| model.lods.iter().next())
|
||||
.flat_map(|model| model.lods.first())
|
||||
.flat_map(|lod| lod.meshes.iter());
|
||||
|
||||
vtx_meshes
|
||||
|
|
@ -81,10 +81,10 @@ impl Model {
|
|||
}
|
||||
}
|
||||
|
||||
fn read_indexes<'a, I: Iterator<Item = usize> + 'static, T: Readable>(
|
||||
fn read_indexes<I: Iterator<Item = usize> + 'static, T: Readable>(
|
||||
indexes: I,
|
||||
data: &'a [u8],
|
||||
) -> impl Iterator<Item = Result<T, ModelError>> + 'a {
|
||||
data: &[u8],
|
||||
) -> impl Iterator<Item = Result<T, ModelError>> + '_ {
|
||||
indexes
|
||||
.map(|index| {
|
||||
data.get(index..).ok_or_else(|| ModelError::OutOfBounds {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ impl Mdl {
|
|||
body_parts: header
|
||||
.body_part_indexes()
|
||||
.map(|index| {
|
||||
let data = data.get(index..).ok_or_else(|| ModelError::OutOfBounds {
|
||||
let data = data.get(index..).ok_or(ModelError::OutOfBounds {
|
||||
data: "BodyPart",
|
||||
offset: index,
|
||||
})?;
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ bitflags! {
|
|||
impl StudioHeader {
|
||||
pub fn header2_index(&self) -> Option<usize> {
|
||||
(self.studio_hdr2_index > 0)
|
||||
.then(|| self.studio_hdr2_index)
|
||||
.then_some(self.studio_hdr2_index)
|
||||
.and_then(|index| usize::try_from(index).ok())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ impl Vvd {
|
|||
let fixup = fixup?;
|
||||
let from = fixup.source_vertex_id as usize;
|
||||
let to = (fixup.source_vertex_id.saturating_add(fixup.vertex_count)) as usize;
|
||||
vertices.extend_from_slice(&source_vertices.get(from..to).ok_or_else(|| {
|
||||
vertices.extend_from_slice(source_vertices.get(from..to).ok_or({
|
||||
ModelError::OutOfBounds {
|
||||
data: "source_vertices",
|
||||
offset: to as usize,
|
||||
offset: to,
|
||||
}
|
||||
})?);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue