Struct cafe::Vector3

source ·
#[repr(C)]
pub struct Vector3<T> { pub x: T, pub y: T, pub z: T, }

Fields§

§x: T§y: T§z: T

Implementations§

source§

impl<T> Vector3<T>

source

pub fn new(x: T, y: T, z: T) -> Vector3<T>

source

pub fn as_array(&self) -> [&T; 3]

source

pub fn stride() -> usize

source§

impl Vector3<f32>

source

pub fn zero() -> Vector3<f32>

source

pub fn up() -> Vector3<f32>

source

pub fn down() -> Vector3<f32>

source

pub fn front() -> Vector3<f32>

source

pub fn back() -> Vector3<f32>

source

pub fn from_array(data: [f32; 4]) -> Vector3<f32>

source

pub fn dot(&self, rhs: &Vector3<f32>) -> f32

source

pub fn len(&self) -> f32

source

pub fn cross(&self, other: &Vector3<f32>) -> Vector3<f32>

source

pub fn normalize(&self) -> Vector3<f32>

source

pub fn scalar(&self, val: f32) -> Vector3<f32>

Trait Implementations§

source§

impl<T> Add<Vector3<T>> for Vector3<T>where T: Add<T, Output = T> + Add<T>,

§

type Output = Vector3<T>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Vector3<T>) -> <Vector3<T> as Add<Vector3<T>>>::Output

Performs the + operation. Read more
source§

impl<T> AddAssign<Vector3<T>> for Vector3<T>where T: AddAssign<T>,

source§

fn add_assign(&mut self, rhs: Vector3<T>)

Performs the += operation. Read more
source§

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

source§

fn clone(&self) -> Vector3<T>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Vector3<T>where T: Debug,

source§

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

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

impl<T> Default for Vector3<T>where T: Default,

source§

fn default() -> Vector3<T>

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

impl<T> GlAttrib for Vector3<T>where T: GlEnum,

source§

fn size() -> u32

source§

fn stride() -> usize

source§

fn get_size(&self) -> u32

source§

fn get_stride(&self) -> usize

source§

fn setup_attrib(index: u32, normalized: bool, stride: i32, start: i32)

source§

impl<T> GlEnum for Vector3<T>where T: GlEnum,

source§

impl<T> GlUniform for Vector3<T>where T: GlUniform,

source§

fn uniform(location: i32, val: &Vector3<T>)

source§

fn uniformv(location: i32, count: i32, ptr: *const Vector3<T>)

source§

fn send_uniform(&self, location: i32)

source§

impl GlslType for Vector3<bool>

source§

impl GlslType for Vector3<f32>

source§

impl GlslType for Vector3<i32>

source§

impl GlslType for Vector3<u32>

source§

impl<T> PartialEq<Vector3<T>> for Vector3<T>where T: PartialEq<T>,

source§

fn eq(&self, other: &Vector3<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Sub<Vector3<T>> for Vector3<T>where T: Sub<T, Output = T> + Sub<T>,

§

type Output = Vector3<T>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Vector3<T>) -> <Vector3<T> as Sub<Vector3<T>>>::Output

Performs the - operation. Read more
source§

impl<T> SubAssign<Vector3<T>> for Vector3<T>where T: SubAssign<T>,

source§

fn sub_assign(&mut self, rhs: Vector3<T>)

Performs the -= operation. Read more
source§

impl<T> Copy for Vector3<T>where T: Copy,

source§

impl<T> StructuralPartialEq for Vector3<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Vector3<T>where T: RefUnwindSafe,

§

impl<T> Send for Vector3<T>where T: Send,

§

impl<T> Sync for Vector3<T>where T: Sync,

§

impl<T> Unpin for Vector3<T>where T: Unpin,

§

impl<T> UnwindSafe for Vector3<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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.