#[repr(C)]pub struct Vector4<T> {
pub x: T,
pub y: T,
pub z: T,
pub w: T,
}
Fields§
§x: T
§y: T
§z: T
§w: T
Implementations§
Source§impl<T> Vector4<T>
impl<T> Vector4<T>
Sourcepub fn new(x: T, y: T, z: T, w: T) -> Vector4<T>
pub fn new(x: T, y: T, z: T, w: T) -> Vector4<T>
Examples found in repository?
examples/cube.rs (line 25)
23 fn run(&mut self, dt: f32, render: &mut Self::Render) -> bool {
24 render.begin();
25 render.clear_color(Vec4::new(0.3, 0.4, 0.4, 1.0));
26 render.clear();
27
28 for pos in &self.positions {
29 render.draw_cube(*pos);
30 }
31
32 render.end();
33 true
34 }
pub fn as_array(&self) -> [&T; 4]
pub fn stride() -> usize
Source§impl Vector4<f32>
impl Vector4<f32>
pub fn zero() -> Vector4<f32>
pub fn from_array(data: [f32; 4]) -> Vector4<f32>
pub fn dot(&self, rhs: &Vector4<f32>) -> f32
pub fn len(&self) -> f32
pub fn cross(&self, other: &Vector4<f32>) -> Vector4<f32>
pub fn normalize(&self) -> Vector4<f32>
pub fn apply_matrix(&mut self, matrix: Mat4)
Trait Implementations§
Source§impl<T> AddAssign for Vector4<T>where
T: AddAssign,
impl<T> AddAssign for Vector4<T>where
T: AddAssign,
Source§fn add_assign(&mut self, rhs: Vector4<T>)
fn add_assign(&mut self, rhs: Vector4<T>)
Performs the
+=
operation. Read moreSource§impl<T> SubAssign for Vector4<T>where
T: SubAssign,
impl<T> SubAssign for Vector4<T>where
T: SubAssign,
Source§fn sub_assign(&mut self, rhs: Vector4<T>)
fn sub_assign(&mut self, rhs: Vector4<T>)
Performs the
-=
operation. Read moreimpl<T> Copy for Vector4<T>where
T: Copy,
impl<T> StructuralPartialEq for Vector4<T>
Auto Trait Implementations§
impl<T> Freeze for Vector4<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vector4<T>where
T: RefUnwindSafe,
impl<T> Send for Vector4<T>where
T: Send,
impl<T> Sync for Vector4<T>where
T: Sync,
impl<T> Unpin for Vector4<T>where
T: Unpin,
impl<T> UnwindSafe for Vector4<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more