Skip to main content

Vertex3D

Struct Vertex3D 

Source
pub struct Vertex3D { /* private fields */ }
Expand description

Single 64-byte cache/GPU-aligned 3D mesh vertex storing position, normal, Lengyel tangent, dual UVs, and vertex color.

Implementations§

Source§

impl Vertex3D

Compact and full attribute constructors for Vertex3D.

Source

pub const fn new(position: Vec3, normal: Vec3) -> Self

Constructs a Vertex3D from position and normal with identity tangent, zero UVs, and opaque white color.

§Arguments
  • Vec3 - Local-space 3D position.
  • Vec3 - Local-space unit surface normal.
§Returns
  • Self - Constructed 64-byte vertex.
Source

pub const fn from_pos_normal(position: Vec3, normal: Vec3) -> Self

Constructs a Vertex3D from position and normal with default tangent, UV, and color attributes.

§Arguments
  • Vec3 - Local-space 3D position.
  • Vec3 - Local-space unit surface normal.
§Returns
  • Self - Constructed 64-byte vertex.
Source

pub const fn from_full( position: Vec3, normal: Vec3, tangent: [f32; 4], uv0: [f32; 2], uv1: [f32; 2], color0: [u8; 4], flags: u32, ) -> Self

Constructs a fully populated 64-byte Vertex3D with tangent, dual UVs, vertex color, and attribute flags.

§Arguments
  • Vec3 - Local-space 3D position.
  • Vec3 - Local-space unit surface normal.
  • [f32; 4] - Tangent vector (tx, ty, tz, handedness_sign).
  • [f32; 2] - Primary UV coordinate (TEXCOORD_0).
  • [f32; 2] - Secondary UV coordinate (TEXCOORD_1).
  • [u8; 4] - Packed UNORM8 RGBA vertex color (COLOR_0).
  • u32 - Attribute bitmask flags.
§Returns
  • Self - Fully populated 64-byte vertex.
Source§

impl Vertex3D

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_position(&self) -> Vec3

Source

pub fn get_mut_position(&mut self) -> &mut Vec3

Source

pub fn set_position(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_normal(&self) -> Vec3

Source

pub fn get_mut_normal(&mut self) -> &mut Vec3

Source

pub fn set_normal(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_tangent(&self) -> [f32; 4]

Source

pub fn get_mut_tangent(&mut self) -> &mut [f32; 4]

Source

pub fn set_tangent(&mut self, val: [f32; 4]) -> &mut Self

Source

pub fn get_uv0(&self) -> [f32; 2]

Source

pub fn get_mut_uv0(&mut self) -> &mut [f32; 2]

Source

pub fn set_uv0(&mut self, val: [f32; 2]) -> &mut Self

Source

pub fn get_uv1(&self) -> [f32; 2]

Source

pub fn get_mut_uv1(&mut self) -> &mut [f32; 2]

Source

pub fn set_uv1(&mut self, val: [f32; 2]) -> &mut Self

Source

pub fn get_color0(&self) -> [u8; 4]

Source

pub fn get_mut_color0(&mut self) -> &mut [u8; 4]

Source

pub fn set_color0(&mut self, val: [u8; 4]) -> &mut Self

Source

pub fn get_flags(&self) -> u32

Source

pub fn get_mut_flags(&mut self) -> &mut u32

Source

pub fn set_flags(&mut self, val: u32) -> &mut Self

Trait Implementations§

Source§

impl Clone for Vertex3D

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 Copy for Vertex3D

Source§

impl Debug for Vertex3D

Source§

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

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

impl Default for Vertex3D

Default neutral vertex positioned at origin with +Y normal, +X tangent, and white vertex color.

Source§

fn default() -> Self

Returns a default 64-byte Vertex3D.

§Returns
  • Self - Default Vertex3D.
Source§

impl PartialEq for Vertex3D

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 Vertex3D

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.