Struct ModelPart
#[non_exhaustive]pub struct ModelPart {
pub x: f32,
pub y: f32,
pub z: f32,
pub x_rot: f32,
pub y_rot: f32,
pub z_rot: f32,
pub x_scale: f32,
pub y_scale: f32,
pub z_scale: f32,
pub visible: bool,
pub skip_draw: bool,
pub polygons: Vec<ModelPolygon>,
/* private fields */
}Expand description
ModelPart: a baked part, its children by name, and the pose a mod sets
each frame before drawing it (setupAnim), from the pose it was baked
with (reset_pose).
Wire uses JSON with at most 32 nested containers; named children consume object, list and tuple levels. Encoding preflights children before serialization.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.x: f32Where it sits in its parent, in texels.
y: f32Position on the y axis, in texels.
z: f32Position on the z axis, in texels.
x_rot: f32Its rotation in radians, applied about z, then y, then x.
y_rot: f32Rotation around y, in radians.
z_rot: f32Rotation around z, in radians.
x_scale: f32Scale on the x axis.
y_scale: f32Scale on the y axis.
z_scale: f32Scale on the z axis.
visible: boolFalse draws neither it nor its children.
skip_draw: boolTrue draws its children but not its own faces (skipDraw).
polygons: Vec<ModelPolygon>Its boxes’ faces.
Implementations§
§impl ModelPart
impl ModelPart
pub fn new(
polygons: Vec<ModelPolygon>,
children: Vec<(String, ModelPart)>,
pose: PartPose,
) -> ModelPart
pub fn new( polygons: Vec<ModelPolygon>, children: Vec<(String, ModelPart)>, pose: PartPose, ) -> ModelPart
A part with polygons and children at pose, which it is reset to.
pub fn get_child_mut(&mut self, name: &str) -> Option<&mut ModelPart>
pub fn get_child_mut(&mut self, name: &str) -> Option<&mut ModelPart>
Its mutable child by name.
pub fn children(&self) -> impl Iterator<Item = (&str, &ModelPart)>
pub fn children(&self) -> impl Iterator<Item = (&str, &ModelPart)>
Its parts by name, in the order they draw.
pub fn children_mut(&mut self) -> impl Iterator<Item = (&str, &mut ModelPart)>
pub fn children_mut(&mut self) -> impl Iterator<Item = (&str, &mut ModelPart)>
Its mutable children in drawing order.
pub fn store_pose(&self) -> PartPose
pub fn store_pose(&self) -> PartPose
Its pose now (storePose).
pub fn initial_pose(&self) -> PartPose
pub fn initial_pose(&self) -> PartPose
The pose it was baked with, unless set since (getInitialPose).
pub fn set_initial_pose(&mut self, pose: PartPose)
pub fn set_initial_pose(&mut self, pose: PartPose)
Replace the pose used by reset_pose.
pub fn reset_pose(&mut self)
pub fn reset_pose(&mut self)
Puts it back at its initial pose (resetPose), its children as they are.
pub fn reset_all_poses(&mut self)
pub fn reset_all_poses(&mut self)
Puts it and every part under it back at their initial poses, as
Model.resetPose does before each frame’s setupAnim.
pub fn copy_from(&mut self, other: &ModelPart)
pub fn copy_from(&mut self, other: &ModelPart)
Takes other’s position, rotation and scale (copyFrom).
pub fn set_rotation(&mut self, x_rot: f32, y_rot: f32, z_rot: f32)
pub fn set_rotation(&mut self, x_rot: f32, y_rot: f32, z_rot: f32)
Set its rotation in radians.
pub fn offset_pos(&mut self, by: [f32; 3])
pub fn offset_pos(&mut self, by: [f32; 3])
Moves it by by texels (offsetPos), as keyframe animations do.
pub fn offset_rotation(&mut self, by: [f32; 3])
pub fn offset_rotation(&mut self, by: [f32; 3])
Turns it by by radians (offsetRotation).
pub fn offset_scale(&mut self, by: [f32; 3])
pub fn offset_scale(&mut self, by: [f32; 3])
Scales it by by more (offsetScale: added, as vanilla adds it).