pub struct Model<'a> { /* private fields */ }Expand description
A parsed textured 3D model backed by slices into the caller’s
cooked .psxmdl blob.
This is intentionally a low-level view. It exposes the tables the renderer needs – joints, materials, rigid parts, vertices, and faces – without allocating or converting the whole model at load time.
Implementations§
Source§impl<'a> Model<'a>
impl<'a> Model<'a>
Sourcepub fn from_bytes(bytes: &'a [u8]) -> Result<Self, ParseError>
pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, ParseError>
Parse a cooked .psxmdl blob.
Sourcepub fn is_double_sided(&self) -> bool
pub fn is_double_sided(&self) -> bool
Whether this model should render double-sided (no backface culling). Set by the cooker for hollow / open-faced models.
Sourcepub fn joint_count(&self) -> u16
pub fn joint_count(&self) -> u16
Number of joint records.
Sourcepub fn material_count(&self) -> u16
pub fn material_count(&self) -> u16
Number of material records.
Sourcepub fn part_count(&self) -> u16
pub fn part_count(&self) -> u16
Number of rigid part records.
Sourcepub fn vertex_count(&self) -> u16
pub fn vertex_count(&self) -> u16
Number of vertex records.
Sourcepub fn face_count(&self) -> u16
pub fn face_count(&self) -> u16
Number of triangle records.
Sourcepub fn texture_width(&self) -> u16
pub fn texture_width(&self) -> u16
Primary texture width in texels.
Sourcepub fn texture_height(&self) -> u16
pub fn texture_height(&self) -> u16
Primary texture height in texels.
Sourcepub fn bind_pose_floor_lift(&self) -> i32
pub fn bind_pose_floor_lift(&self) -> i32
Distance from the model origin down to the lowest bind-pose vertex, in MODEL units (the vertex table’s own units). Scale it with the same local-to-world scale the mesh is drawn with and the feet land exactly on the floor point; scaling it separately (or pre-scaling here) loses up to a unit per rounding and leaves the feet hovering.
Model space is Y-up; the origin is wherever the importer normalised it (usually near, but not exactly at, mid-height), so this replaces the “half of the authored height” guess.
Sourcepub fn local_to_world_q12(&self) -> u16
pub fn local_to_world_q12(&self) -> u16
Suggested uniform scale from model-local units to engine world units.
0x1000 is identity. Older blobs may store zero in the reserved
header slot; those are treated as identity.
Sourcepub fn joint(&self, index: u16) -> Option<ModelJoint>
pub fn joint(&self, index: u16) -> Option<ModelJoint>
Joint record by index.
Sourcepub fn material(&self, index: u16) -> Option<ModelMaterial>
pub fn material(&self, index: u16) -> Option<ModelMaterial>
Material record by index.
Sourcepub fn vertex(&self, index: u16) -> Option<ModelVertex>
pub fn vertex(&self, index: u16) -> Option<ModelVertex>
Vertex record by global vertex index.
Sourcepub fn face_palette_bank(&self, index: u16) -> Option<u8>
pub fn face_palette_bank(&self, index: u16) -> Option<u8>
4bpp CLUT bank selected by a model face.
Legacy and ordinary single-palette models return bank zero. None
means the face index is outside the model.
Sourcepub fn palette_bank_count(&self) -> u8
pub fn palette_bank_count(&self) -> u8
Number of consecutive 16-entry CLUT banks referenced by this model.
Trait Implementations§
impl<'a> Copy for Model<'a>
Auto Trait Implementations§
impl<'a> Freeze for Model<'a>
impl<'a> RefUnwindSafe for Model<'a>
impl<'a> Send for Model<'a>
impl<'a> Sync for Model<'a>
impl<'a> Unpin for Model<'a>
impl<'a> UnsafeUnpin for Model<'a>
impl<'a> UnwindSafe for Model<'a>
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)