mirror of
https://codeberg.org/icewind/vmdl.git
synced 2026-06-03 16:44:11 +02:00
viewer wip
This commit is contained in:
parent
fc98416aa3
commit
88bcdb35e7
8 changed files with 329 additions and 5 deletions
|
|
@ -142,6 +142,7 @@ impl Mesh {
|
|||
pub struct StripGroup {
|
||||
// todo vertex indexes
|
||||
// todo topologies
|
||||
pub indices: Vec<u16>,
|
||||
pub vertices: Vec<Vertex>,
|
||||
pub strips: Vec<Strip>,
|
||||
pub flags: StripGroupFlags,
|
||||
|
|
@ -173,6 +174,17 @@ impl StripGroup {
|
|||
Strip::read(data, header)
|
||||
})
|
||||
.collect::<Result<_>>()?,
|
||||
indices: header
|
||||
.index_indexes()
|
||||
.map(|index| {
|
||||
let data = data.get(index..).ok_or_else(|| ModelError::OutOfBounds {
|
||||
data: "VertexIndex",
|
||||
offset: index,
|
||||
})?;
|
||||
let mut reader = Cursor::new(data);
|
||||
Ok(reader.read_le()?)
|
||||
})
|
||||
.collect::<Result<_>>()?,
|
||||
flags: header.flags,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ impl StripGroupHeader {
|
|||
}
|
||||
|
||||
pub fn index_indexes(&self) -> impl Iterator<Item = usize> {
|
||||
index_range(self.index_offset, self.index_count, size_of::<Vertex>())
|
||||
index_range(self.index_offset, self.index_count, size_of::<u16>())
|
||||
}
|
||||
|
||||
pub fn strip_indexes(&self) -> impl Iterator<Item = usize> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue