Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Model

Struct Model 

Source
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>

Source

pub fn from_bytes(bytes: &'a [u8]) -> Result<Self, ParseError>

Parse a cooked .psxmdl blob.

Source

pub fn flags(&self) -> u16

Model feature flags (see [psxed_format::model::flags]).

Source

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.

Source

pub fn joint_count(&self) -> u16

Number of joint records.

Source

pub fn material_count(&self) -> u16

Number of material records.

Source

pub fn part_count(&self) -> u16

Number of rigid part records.

Source

pub fn vertex_count(&self) -> u16

Number of vertex records.

Source

pub fn face_count(&self) -> u16

Number of triangle records.

Source

pub fn texture_width(&self) -> u16

Primary texture width in texels.

Source

pub fn texture_height(&self) -> u16

Primary texture height in texels.

Source

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.

Source

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.

Source

pub fn joint(&self, index: u16) -> Option<ModelJoint>

Joint record by index.

Source

pub fn material(&self, index: u16) -> Option<ModelMaterial>

Material record by index.

Source

pub fn part(&self, index: u16) -> Option<ModelPart>

Rigid part record by index.

Source

pub fn vertex(&self, index: u16) -> Option<ModelVertex>

Vertex record by global vertex index.

Source

pub fn face(&self, index: u16) -> Option<ModelFace>

Textured triangle by global face index.

Source

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.

Source

pub fn palette_bank_count(&self) -> u8

Number of consecutive 16-entry CLUT banks referenced by this model.

Trait Implementations§

Source§

impl<'a> Clone for Model<'a>

Source§

fn clone(&self) -> Model<'a>

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Model<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.