mirror of
https://codeberg.org/icewind/vmdl.git
synced 2026-06-03 16:44:11 +02:00
finaly got orientation figured out I think
This commit is contained in:
parent
06cbe395eb
commit
2dffd8d7cd
9 changed files with 171 additions and 75 deletions
|
|
@ -1,11 +1,11 @@
|
|||
use cgmath::Euler;
|
||||
use cgmath::{Euler, Matrix4};
|
||||
use std::env::args;
|
||||
use std::fs;
|
||||
use std::path::PathBuf;
|
||||
use vmdl::mdl::Mdl;
|
||||
use vmdl::vtx::Vtx;
|
||||
use vmdl::vvd::Vvd;
|
||||
use vmdl::Model;
|
||||
use vmdl::{Model, Quaternion};
|
||||
|
||||
fn main() -> Result<(), vmdl::ModelError> {
|
||||
let mut args = args();
|
||||
|
|
@ -19,25 +19,33 @@ fn main() -> Result<(), vmdl::ModelError> {
|
|||
let data = fs::read(path.with_extension("vvd"))?;
|
||||
let vvd = Vvd::read(&data)?;
|
||||
|
||||
// dbg!(&mdl.header2);
|
||||
// dbg!(&mdl.header);
|
||||
|
||||
// for bone in &mdl.bones {
|
||||
// println!(
|
||||
// "{}: from {} at\n\t{:?}\n\t{:?}\n\t{:?}",
|
||||
// bone.name, bone.parent, bone.rot, bone.q_alignment, bone.pose_to_bone
|
||||
// "{}: from {} at\n\t{:?}\n\t{:?}\n\t{:?}\n\t{:?}",
|
||||
// bone.name, bone.parent, bone.rot, bone.rot_scale, bone.quaternion, bone.pose_to_bone
|
||||
// );
|
||||
// }
|
||||
dbg!(&mdl.local_animations[0]);
|
||||
// dbg!(&mdl.bones[0]);
|
||||
dbg!(&mdl.local_animations[0].animations[0]);
|
||||
let transform = mdl
|
||||
.local_animations
|
||||
.first()
|
||||
.get(0)
|
||||
.map(|a| a.animations[0].rotation(0))
|
||||
.unwrap();
|
||||
dbg!(transform);
|
||||
dbg!(Euler::from(cgmath::Quaternion::from(transform)));
|
||||
// dbg!(&mdl.body_table_by_name);
|
||||
|
||||
// dbg!(&mdl.attachments);
|
||||
let _model = Model::from_parts(mdl, vtx, vvd);
|
||||
let model = Model::from_parts(mdl, vtx, vvd);
|
||||
dbg!(model.animations().nth(1).unwrap().get_bone_transform(1, 0));
|
||||
// dbg!(model.root_transform());
|
||||
// dbg!(model.idle_transform());
|
||||
// dbg!(Euler::from(cgmath::Quaternion::from(
|
||||
// model.idle_transform()
|
||||
// )));
|
||||
// dbg!(Euler::from(Quaternion::from(model.root_transform())));
|
||||
// for strip in model.vertex_strips() {
|
||||
// for vertex in strip {
|
||||
|
|
|
|||
|
|
@ -250,9 +250,7 @@ fn model_to_model(model: &Model, loader: &Loader, skin: usize) -> CpuModel {
|
|||
|
||||
let skin = model.skin_tables().nth(skin).unwrap();
|
||||
|
||||
let transforms = model.root_transform();
|
||||
let transforms = dbg!(model.idle_transform());
|
||||
// let transforms = Matrix4::identity();
|
||||
let transforms = Matrix4::identity();
|
||||
|
||||
let geometries = model
|
||||
.meshes()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue