1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-22 12:47:45 +00:00

Fix Dawntrail model loading

I figured out some crappy padding I need to add, not sure what these
exactly are yet!
This commit is contained in:
Joshua Goins 2024-04-17 17:47:03 -04:00
parent 2af1543c9b
commit dff1a83809

View file

@ -312,8 +312,11 @@ struct ModelData {
#[br(count = header.shape_value_count)] #[br(count = header.shape_value_count)]
shape_values: Vec<ShapeValue>, shape_values: Vec<ShapeValue>,
// TODO: Dawntrail doesn't seem to have these anymore? Needs more testing // TODO: Dawntrail mysteries
#[br(if(file_header.version < 0x01000006, 0))] #[br(if(file_header.version >= 0x01000006))]
#[br(count = 24)]
_padding1: Vec<u8>,
submesh_bone_map_size: u32, submesh_bone_map_size: u32,
#[br(count = submesh_bone_map_size / 2)] #[br(count = submesh_bone_map_size / 2)]
@ -323,6 +326,11 @@ struct ModelData {
#[br(count = padding_amount)] #[br(count = padding_amount)]
unknown_padding: Vec<u8>, unknown_padding: Vec<u8>,
// TODO: Dawntrail mysteries
#[br(if(file_header.version >= 0x01000006))]
#[br(count = 385)]
_padding2: Vec<u8>,
bounding_box: BoundingBox, bounding_box: BoundingBox,
model_bounding_box: BoundingBox, model_bounding_box: BoundingBox,
water_bounding_box: BoundingBox, water_bounding_box: BoundingBox,
@ -426,6 +434,8 @@ impl MDL {
let model = ModelData::read_args(&mut cursor, binrw::args! { file_header: &model_file_header }).ok()?; let model = ModelData::read_args(&mut cursor, binrw::args! { file_header: &model_file_header }).ok()?;
//println!("{:#?}", model);
let mut affected_bone_names = vec![]; let mut affected_bone_names = vec![];
for offset in &model.bone_name_offsets { for offset in &model.bone_name_offsets {