Nn::mii::detail::ResourceShapeHeader: Difference between revisions
Appearance
Created page with "ShapeMid.dat, and others. == Struct Format (Header) == This abridged sample is implemented in Rust, using the binrw library. This sample is edited for readability, full sample can be found here<ref>https://github.com/j0lol/vee/blob/f134e28eec22bdf8587d5abbf0f2d0f1ffc5b8a5/crates/vee_resources/src/shape.rs#L1</ref>. <syntaxhighlight lang="rust"> /// Specifies where data is, now big it is, and how compressed it is. /// Used for both textures and shapes. #[derive(BinRead)..." |
m Jo moved page Shape*.dat to Nn::mii::detail::ResourceShapeHeader |
(No difference)
| |
Latest revision as of 14:39, 24 September 2025
ShapeMid.dat, and others.
Struct Format (Header)
[edit | edit source]This abridged sample is implemented in Rust, using the binrw library. This sample is edited for readability, full sample can be found here[1].
/// Specifies where data is, now big it is, and how compressed it is.
/// Used for both textures and shapes.
#[derive(BinRead)]
pub struct ResourceCommonAttribute {
pub offset: u32,
pub size: u32,
pub size_compressed: u32,
pub compression_level: u8,
pub memory_level: u8,
pad: u16,
}
/// Specifies where {vertex,index} buffers are, and how big they are.
#[derive(BinRead)]
pub struct ResourceShapeAttribute {
pub attr_offset: [u32; 5],
pub attr_size: [u32; 5],
pub index_offset: u32,
pub index_size: u32,
pub bounding_box: [[f32; 3]; 2],
}
/// All the data required to read a mesh from the shape file.
/// Essentially a 'pointer' to the data.
#[derive(BinRead)]
pub struct ShapeElement {
pub common: ResourceCommonAttribute,
pub shape: ResourceShapeAttribute,
}
/// Contains positional data for any headwear that
/// may be placed on the model post-render.
#[derive(BinRead)]
pub struct ResourceShapeHairTransform {
front_translate: [f32; 3],
front_rotate: [f32; 3],
side_translate: [f32; 3],
side_rotate: [f32; 3],
top_translate: [f32; 3],
top_rotate: [f32; 3],
}
/// Contains positional data used to move face parts
/// like the beard, nose, hair, glasses, etc.
#[derive(BinRead)]
pub struct ResourceShapeFacelineTransform {
pub hair_translate: [f32; 3],
pub nose_translate: [f32; 3],
pub beard_translate: [f32; 3],
}
/// Header of the `Shape` resource file.
#[derive(BinRead)]
#[br(little, magic = b"NFSR")]
pub struct ResourceShape {
ver: u32,
file_size: u32,
max_size: [u32; 12],
max_alignment: [u32; 12],
pub beard: [ShapeElement; 4],
pub face_line: [ShapeElement; 12],
pub mask: [ShapeElement; 12],
pub hat_normal: [ShapeElement; 132],
pub hat_cap: [ShapeElement; 132],
pub forehead_normal: [ShapeElement; 132],
pub forehead_cap: [ShapeElement; 132],
pub hair_normal: [ShapeElement; 132],
pub hair_cap: [ShapeElement; 132],
pub glasses: [ShapeElement; 1],
pub nose: [ShapeElement; 18],
pub nose_line: [ShapeElement; 18],
pub hair_transform: [ResourceShapeHairTransform; 132],
pub face_line_transform: [ResourceShapeFacelineTransform; 12],
}