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

Mesh

Struct Mesh 

Source
pub struct Mesh<'a> { /* private fields */ }
Expand description

A parsed 3D mesh backed by slices into the caller’s cooked blob.

Cheap to construct (just bounds-checks the header + computes sub-slice offsets). Cheap to pass around – table &[u8] slices, an index stride, a flags u16, and the counts.

Implementations§

Source§

impl<'a> Mesh<'a>

Source

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

Parse a cooked .psxm blob. Returns a Mesh view that borrows into bytes.

Source

pub fn vertex_count(&self) -> u16

Vertex count.

Source

pub fn vert_count(&self) -> u16

👎Deprecated:

renamed to vertex_count

Renamed to Self::vertex_count.

Source

pub fn face_count(&self) -> u16

Triangle count.

Source

pub fn flags(&self) -> u16

Mesh feature flags (see [psxed_format::mesh::flags]).

Source

pub fn has_face_colors(&self) -> bool

Does the blob carry a face-colour table?

Source

pub fn has_normals(&self) -> bool

Does the blob carry per-vertex normals? Required for any GTE- or CPU-lit rendering path.

Source

pub fn vertex(&self, i: u16) -> Vec3I16

Decode vertex i as a Q3.12 Vec3I16. Returns Vec3I16::ZERO if the index is out of range – keeps the render path branch-free, callers who care can check against Self::vertex_count first.

Source

pub fn face(&self, i: u16) -> (u16, u16, u16)

Triangle i’s three vertex indices. Returns (0, 0, 0) for an out-of-range index.

Source

pub fn face_color(&self, i: u16) -> Option<(u8, u8, u8)>

Triangle i’s flat colour, or None if the blob doesn’t carry a face-colour table.

Source

pub fn vertex_normal(&self, i: u16) -> Option<Vec3I16>

Per-vertex Q3.12 normal. Returns None if the blob lacks a normal table (HAS_NORMALS flag clear) or i is out of range. Components are unit-length-ish (Q3.12 quantisation introduces sub-ULP error but the GTE lighting path is tolerant).

Trait Implementations§

Source§

impl<'a> Clone for Mesh<'a>

Source§

fn clone(&self) -> Mesh<'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 Mesh<'a>

Source§

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

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

impl<'a> Copy for Mesh<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Mesh<'a>

§

impl<'a> RefUnwindSafe for Mesh<'a>

§

impl<'a> Send for Mesh<'a>

§

impl<'a> Sync for Mesh<'a>

§

impl<'a> Unpin for Mesh<'a>

§

impl<'a> UnsafeUnpin for Mesh<'a>

§

impl<'a> UnwindSafe for Mesh<'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.