mirror of
https://codeberg.org/icewind/vmdl.git
synced 2026-06-03 16:44:11 +02:00
fix multi mesh models indices
This commit is contained in:
parent
89529579be
commit
467c889cc3
1 changed files with 4 additions and 1 deletions
|
|
@ -1,10 +1,12 @@
|
||||||
mod raw;
|
mod raw;
|
||||||
|
|
||||||
|
use std::mem::size_of;
|
||||||
pub use raw::header::*;
|
pub use raw::header::*;
|
||||||
pub use raw::header2::*;
|
pub use raw::header2::*;
|
||||||
|
|
||||||
use crate::mdl::raw::{BodyPartHeader, Bone, MeshHeader, ModelHeader};
|
use crate::mdl::raw::{BodyPartHeader, Bone, MeshHeader, ModelHeader};
|
||||||
use crate::{read_indexes, read_relative, FixedString, ModelError, ReadRelative, Readable};
|
use crate::{read_indexes, read_relative, FixedString, ModelError, ReadRelative, Readable};
|
||||||
|
use crate::vvd::Vertex;
|
||||||
|
|
||||||
type Result<T> = std::result::Result<T, ModelError>;
|
type Result<T> = std::result::Result<T, ModelError>;
|
||||||
|
|
||||||
|
|
@ -60,6 +62,7 @@ pub struct Model {
|
||||||
pub ty: i32,
|
pub ty: i32,
|
||||||
pub bounding_radius: f32,
|
pub bounding_radius: f32,
|
||||||
pub meshes: Vec<Mesh>,
|
pub meshes: Vec<Mesh>,
|
||||||
|
/// Base offset of the model's vertices
|
||||||
pub vertex_offset: i32,
|
pub vertex_offset: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,7 +75,7 @@ impl ReadRelative for Model {
|
||||||
name: header.name.try_into()?,
|
name: header.name.try_into()?,
|
||||||
ty: header.ty,
|
ty: header.ty,
|
||||||
bounding_radius: header.bounding_radius,
|
bounding_radius: header.bounding_radius,
|
||||||
vertex_offset: header.vertex_index,
|
vertex_offset: header.vertex_index / (size_of::<Vertex>() as i32),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue