Skip to main content

MeshCase

Struct MeshCase 

Source
pub struct MeshCase {
    pub flags: u8,
    pub meter: u8,
    pub version: [u16; 3],
    pub version_type: u8,
    pub version_number: u8,
    pub resource: Vec<u8>,
    pub value: TreeCase,
}
Expand description

A Mesh’s or a Sprite’s value, the version and byte order its file has, the bytes its m_StreamData reads and the meter, for the meshdecode target (unityrs-meshdecode’s MeshHandler).

Layout: the flags (a byte of MeshCase’s bits), the meter (a byte), the version (major, minor and build, each a u16, little-endian, then the type and its number, a byte each), the resource (a u16 of length, little-endian, and its bytes), then the value, a TreeCase, which runs to the end. An input that stops inside the header is the default case, and one that stops inside the resource keeps the header alone.

Fields§

§flags: u8

The bits below.

§meter: u8

The meter: 0 runs the handler under the case’s limits alone; any other value runs it again under a meter of meter² × 64 bytes.

§version: [u16; 3]

The version’s major, minor and build.

§version_type: u8

The version’s type (a UnityVersionType byte, any value).

§version_number: u8

The number after the type.

§resource: Vec<u8>

What a resource read returns, at most 65,535 bytes.

§value: TreeCase

The value’s tree and bytes.

Implementations§

Source§

impl MeshCase

Source

pub const SPRITE: u8 = 1

The value is a Sprite’s (its m_RD is the source), not a Mesh’s.

Source

pub const BIG_ENDIAN: u8 = 2

The file is big-endian (the handler swaps the vertex data’s bytes).

Source

pub const RESOURCES: u8 = 4

The handler has a resource reader (MeshHandler::process’s Resources), returning Self::resource.

Source

pub fn has(&self, bit: u8) -> bool

Whether flags holds bit.

Source

pub fn encode(&self) -> Vec<u8> ⓘ

The case’s bytes.

Source

pub fn decode(input: &[u8]) -> Self

The case input holds; what it does not reach is empty.

Trait Implementations§

Source§

impl Clone for MeshCase

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MeshCase

Source§

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

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

impl Default for MeshCase

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for MeshCase

Source§

impl PartialEq for MeshCase

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MeshCase

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.