pub struct Vertex {
pub position: [f32; 3],
pub color: [f32; 4],
pub t: Vec<Tf>,
pub c: Vec<Cl>,
}Expand description
A vertex with:
- its id. Changing it manually has no effect;
- the id of the entity it belongs to. Changing it manually has no effect;
- a 3D XYZ position;
- an RGBA color;
- (A Vec of transformations);
Vertices enable building Triangles, which enable building all other shapes.
Fields§
§position: [f32; 3]The position of the vertex.
color: [f32; 4]The color of the vertex, in RGBA format.
t: Vec<Tf>§c: Vec<Cl>Implementations§
Source§impl Vertex
impl Vertex
Sourcepub fn new() -> Self
pub fn new() -> Self
A new default Vertex. Call this method to initialize a vertex, before transforming it.
§Don’t
DO NOT call this function in multithreaded scenarios, as it calls static mut. See the crate root.
Sourcepub fn pos(self, x: f32, y: f32, z: f32) -> Self
pub fn pos(self, x: f32, y: f32, z: f32) -> Self
Modifies the position of the vertex to (x, y, z).
Sourcepub fn rgb(self, red: f32, green: f32, blue: f32) -> Self
pub fn rgb(self, red: f32, green: f32, blue: f32) -> Self
Modifies the red, green and blue color channels of the vertex color.
Sourcepub fn rgba(self, red: f32, green: f32, blue: f32, alpha: f32) -> Self
pub fn rgba(self, red: f32, green: f32, blue: f32, alpha: f32) -> Self
Modifies the red, green, blue and alpha color channels of the vertex color.
Sourcepub fn transform(self, transformation: Transformation) -> Self
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.
Sourcepub fn recolor(self, colorization: Colorization) -> Self
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.
Sourcepub fn evolution_c(self, e: Evolution) -> Self
pub fn evolution_c(self, e: Evolution) -> Self
Modifies the speed evolution of the latest colorization added.
Sourcepub fn start_c(self, start: f32) -> Self
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.
Sourcepub fn end_c(self, end: f32) -> Self
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.
Sourcepub fn evolution_t(self, e: Evolution) -> Self
pub fn evolution_t(self, e: Evolution) -> Self
Modifies the speed evolution of the latest transformation added.