Model

Struct Model 

Source
pub struct Model {
    pub vertices: Vec<Vertex>,
    pub t: Vec<Tf>,
}
Expand description

A model (a model is a shape). 1 model = 1 entity.
This is what fn new() of specific models return.

  • vertices are the vertices of the model, each group of three Vertex forming a triangle.
  • t are the runtime transformations of the model.

Fields§

§vertices: Vec<Vertex>§t: Vec<Tf>

Implementations§

Source§

impl Model

Source

pub fn from_merge(models: Vec<Model>) -> Self

Merges several models into one single entity, with empty transformations.

Source

pub fn from_vertices(vertices: Vec<Vertex>) -> Self

Creates a single entity from the given vertices, with empty transformations. The number of vertices should (most likely) be a multiple of 3.

Source

pub fn rgb(self, red: f32, green: f32, blue: f32) -> Self

Sets the model rgb color values.

Source

pub fn alpha(self, alpha: f32) -> Self

Sets the model opacity

Source

pub fn transform(self, transformation: Transformation) -> Self

Adds a new transformation with default speed evolution, start time and end time.

§Don’t

DO NOT call this function in multithreaded scenarios, as it calls static mut. See the crate root.

Source

pub fn recolor(self, colorization: Colorization) -> Self

Adds a new color change with default speed evolution, start time and end time.

§Don’t

DO NOT call this function in multithreaded scenarios, as it calls static mut. See the crate root.

Source

pub fn evolution_c(self, e: Evolution) -> Self

Modifies the speed evolution of the latest colorization added.

Source

pub fn start_c(self, start: f32) -> Self

Modifies the start time of the latest colorization added. A start after an end will result in the colorization being instantaneous at start.

Source

pub fn end_c(self, end: f32) -> Self

Modifies the end time of the latest colorization added. An end before a start will result in the colorization being instantaneous at start.

Source

pub fn evolution_t(self, e: Evolution) -> Self

Modifies the speed evolution of the latest transformation added.

Source

pub fn start_t(self, start: f32) -> Self

Modifies the start time of the latest transformation added. A start after an end will result in the transformation being instantaneous at start.

Source

pub fn end_t(self, end: f32) -> Self

Modifies the end time of the latest transformation added. An end before a start will result in the transformation being instantaneous at start.

Auto Trait Implementations§

§

impl Freeze for Model

§

impl RefUnwindSafe for Model

§

impl Send for Model

§

impl Sync for Model

§

impl Unpin for Model

§

impl UnwindSafe for Model

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 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.