[−][src]Struct vxdraw::quads::Quads
Accessor object to all quads
A quad is a colored object with 4 points. See crate::quads for examples.
Methods
impl<'a> Quads<'a>
[src]
pub fn new(vx: &'a mut VxDraw) -> Self
[src]
Spawn the accessor object from VxDraw.
This is a very cheap operation.
pub fn compare_draw_order(&self, left: &Handle, right: &Handle) -> Ordering
[src]
Compare quad draw order
All quads are drawn in a specific order. This method figures out which order is used between two quads. The order can be manipulated by Quads::swap_draw_order.
pub fn swap_draw_order(&mut self, left: &mut Handle, right: &mut Handle)
[src]
Swap two quads with each other
Swaps the internal data of each quad (all vertices and their data, translation, and so on). The effect of this is that the draw order is swapped too, meaning that the quads reverse order (one drawn on top of the other).
This function can swap quads from two different layers, but also quads in the same layer.
pub fn add_layer(&mut self, options: &LayerOptions) -> Layer
[src]
Create a new layer for quads
This new layer will be ordered on top of all previous layers, meaning that its quads will be drawn on top of all other drawn items. If another layer is created, that layer will be drawn on top of this layer, and so on.
pub fn layer_count(&self) -> usize
[src]
Query the amount of layers of this type there are
pub fn hide(&mut self, layer: &Layer)
[src]
Disable drawing of the quads at this layer
pub fn show(&mut self, layer: &Layer)
[src]
Enable drawing of the quads at this layer
pub fn add(&mut self, layer: &Layer, quad: Quad) -> Handle
[src]
Add a new quad to the given layer
The new quad will be based on the data in Quad, and inserted into the given Layer.
pub fn remove_layer(&mut self, layer: Layer)
[src]
Remove a layer of quads
Removes the quad layer from memory and destroys all quads associated with it. All lingering quad handles that were spawned using this layer will be invalidated.
pub fn remove(&mut self, handle: Handle)
[src]
Remove a quad
The quad is set to a scale of 0 and its handle is stored internally in a list of
holes
. Calling Quads::add with available holes will fill the first available hole
with the new quad.
pub fn set_deform(&mut self, handle: &Handle, points: [(f32, f32); 4])
[src]
Change the vertices of the model-space
The name set_deform
is used to keep consistent Quads::deform.
What this function does is just setting absolute vertex positions for each vertex in the
quad.
pub fn set_solid_color(&mut self, handle: &Handle, rgba: Color)
[src]
Set a solid color of a quad
pub fn set_color(&mut self, handle: &Handle, rgba: [Color; 4])
[src]
Set a solid color each vertex of a quad
pub fn set_translation(&mut self, handle: &Handle, position: (f32, f32))
[src]
Set the position (translation) of a quad
The name set_translation
is chosen to keep the counterparts Quads::translate and
translate_all
consistent. This function can purely be thought of as setting the position
of the quad with respect to the model-space's origin.
pub fn set_rotation<T: Copy + Into<Rad<f32>>>(
&mut self,
handle: &Handle,
angle: T
)
[src]
&mut self,
handle: &Handle,
angle: T
)
Set the rotation of a quad
The rotation is about the model space origin.
pub fn set_scale(&mut self, handle: &Handle, scale: f32)
[src]
Set the scale of a quad
pub fn deform(&mut self, handle: &Handle, delta: [(f32, f32); 4])
[src]
Deform a quad by adding delta vertices
Adds the delta vertices to the quad. Beware: This changes model space form.
pub fn translate(&mut self, handle: &Handle, movement: (f32, f32))
[src]
Translate a quad by a vector
Translation does not mutate the model-space of a quad.
pub fn rotate<T: Copy + Into<Rad<f32>>>(&mut self, handle: &Handle, deg: T)
[src]
Rotate a quad
Rotation does not mutate the model-space of a quad.
pub fn scale(&mut self, handle: &Handle, scale: f32)
[src]
Scale a quad
Scale does not mutate the model-space of a quad.
pub fn deform_all(
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> [(f32, f32); 4]
)
[src]
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> [(f32, f32); 4]
)
Deform all quads by adding delta vertices
Applies Quads::deform to each quad.
pub fn translate_all(
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> (f32, f32)
)
[src]
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> (f32, f32)
)
Translate all quads by adding delta vertices
Applies Quads::translate to each quad.
pub fn rotate_all<T: Copy + Into<Rad<f32>>>(
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> T
)
[src]
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> T
)
Rotate all quads by adding delta rotations
Applies Quads::rotate to each quad.
pub fn scale_all(&mut self, layer: &Layer, delta: impl FnMut(usize) -> f32)
[src]
Scale all quads by multiplying a delta scale
Applies Quads::scale to each quad.
pub fn set_deform_all(
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> [(f32, f32); 4]
)
[src]
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> [(f32, f32); 4]
)
Deform all quads by setting delta vertices
Applies Quads::set_deform to each quad.
pub fn set_solid_color_all(
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> Color
)
[src]
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> Color
)
Set the color on all quads
Applies Quads::set_solid_color to each quad.
pub fn set_color_all(
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> [Color; 4]
)
[src]
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> [Color; 4]
)
Set the color on all quads (for each vertex)
Applies Quads::set_color to each quad.
pub fn set_translation_all(
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> (f32, f32)
)
[src]
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> (f32, f32)
)
Set the translation on all quads
Applies Quads::set_translation to each quad.
pub fn set_rotation_all<T: Copy + Into<Rad<f32>>>(
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> T
)
[src]
&mut self,
layer: &Layer,
delta: impl FnMut(usize) -> T
)
Set the rotation on all quads
Applies Quads::set_rotation to each quad.
pub fn set_scale_all(&mut self, layer: &Layer, delta: impl FnMut(usize) -> f32)
[src]
Set the scale on all quads
Applies Quads::set_scale to each quad. Note: This may re-enable removed quads, see Quads::remove.
Auto Trait Implementations
impl<'a> Unpin for Quads<'a>
impl<'a> !Sync for Quads<'a>
impl<'a> !Send for Quads<'a>
impl<'a> !UnwindSafe for Quads<'a>
impl<'a> !RefUnwindSafe for Quads<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Supports<T> for T
[src]
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,