mirror of
https://codeberg.org/icewind/vbspview.git
synced 2026-06-03 10:14:10 +02:00
fix rotation order, I hate my life
This commit is contained in:
parent
266f8e3cd3
commit
8860c38ae0
1 changed files with 15 additions and 4 deletions
21
src/main.rs
21
src/main.rs
|
|
@ -313,12 +313,23 @@ fn load_prop(loader: &Loader, prop: Handle<StaticPropLump>) -> Result<CPUMesh, E
|
|||
let mut mesh = load_prop_mesh(loader, prop.model())?;
|
||||
|
||||
let translation = Mat4::from_translation(map_coords(prop.origin).into());
|
||||
let rotation = Mat4::from(Euler {
|
||||
x: degrees(prop.angles[0]),
|
||||
y: degrees(prop.angles[1]),
|
||||
// manually do axis one by one as source seems to do roll, patch, yaw
|
||||
// while cgmath does yaw, pitch, roll (as directx does?)
|
||||
mesh.transform(&Mat4::from(Euler {
|
||||
x: degrees(0.0),
|
||||
y: degrees(0.0),
|
||||
z: degrees(prop.angles[2]),
|
||||
});
|
||||
mesh.transform(&rotation);
|
||||
}));
|
||||
mesh.transform(&Mat4::from(Euler {
|
||||
x: degrees(prop.angles[0]),
|
||||
y: degrees(0.0),
|
||||
z: degrees(0.0),
|
||||
}));
|
||||
mesh.transform(&Mat4::from(Euler {
|
||||
x: degrees(0.0),
|
||||
y: degrees(prop.angles[1]),
|
||||
z: degrees(0.0),
|
||||
}));
|
||||
mesh.transform(&translation);
|
||||
Ok(mesh)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue