[][src]Struct vxdraw::debtri::Debtri

pub struct Debtri<'a> { /* fields omitted */ }

Debug triangles accessor object returned by VxDraw::debtri

Merely used for grouping together all operations on debug triangles. This is a very cheap object to create/destroy (it really does nothing).

Methods

impl<'a> Debtri<'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 triangle draw order

All triangles are drawn in a specific order. This method figures out which order is used between two triangles. The order can be manipulated by Debtri::swap_draw_order.

pub fn swap_draw_order(&mut self, left: &mut Handle, right: &mut Handle)[src]

Swap two triangles with each other

Swaps the internal data of each triangle (all vertices and their data, translation, and so on). The effect of this is that the draw order is swapped too, meaning that the triangles reverse order (one drawn on top of the other).

pub fn show(&mut self)[src]

Enable drawing of the debug triangles

pub fn hide(&mut self)[src]

Disable drawing of the debug triangles

pub fn count(&mut self) -> usize[src]

Current amount of triangles that are queued for drawing

pub fn add(&mut self, triangle: DebugTriangle) -> Handle[src]

Add a new debug triangle to the renderer

The new triangle will be drawn upon the next draw invocation. The triangle generated is NOT guaranteed to be the triangle to be rendered on top of all other triangles if Debtri::remove has been called earlier. In general, use Debtri::compare_draw_order and Debtri::swap_draw_order to enforce drawing order if that's needed.

pub fn pop(&mut self)[src]

Remove the topmost debug triangle from rendering

Has no effect if there are no debug triangles. Beware that this function is intended for simple use cases, when using Debtri::remove, holes may be created which cause Debtri::pop to not work as expected. Please use Debtri::remove instead of Debtri::pop in complex applications. See Debtri::add for more information.

pub fn pop_many(&mut self, n: usize)[src]

Remove the last N added debug triangle from rendering

If the amount to pop is bigger than the amount of debug triangles, then all debug triangles wil be removed.

pub fn remove(&mut self, handle: Handle)[src]

Remove a debug triangle

The triangle is set to a scale of 0 and its handle is stored internally in a list of holes. Calling Debtri::add with available holes will fill the first available hole with the new triangle.

pub fn set_deform(&mut self, handle: &Handle, points: [(f32, f32); 3])[src]

Change the vertices of the model-space

The name set_deform is used to keep consistent with the verb Debtri::deform and Debtri::deform_all. What this function does is just setting absolute vertex positions for each vertex in the triangle.

pub fn set_color(&mut self, handle: &Handle, rgba: Color)[src]

Set a solid color of a debug triangle

pub fn set_translation(&mut self, handle: &Handle, pos: (f32, f32))[src]

Set the position (translation) of a debug triangle

The name set_translation is chosen to keep the counterparts translate and translate_all consistent. This function can purely be thought of as setting the position of the triangle with respect to the model-space's origin.

pub fn set_rotation<T: Copy + Into<Rad<f32>>>(
    &mut self,
    handle: &Handle,
    deg: T
)
[src]

Set the rotation of a debug triangle

The rotation is about the model space origin.

pub fn set_scale(&mut self, handle: &Handle, scale: f32)[src]

Set the scale of a debug triangle

pub fn deform(&mut self, handle: &Handle, delta: [(f32, f32); 3])[src]

Deform a triangle by adding delta vertices

Adds the delta vertices to the debug triangle. Beware: This changes model space form.

pub fn color(&mut self, handle: &Handle, color: [i16; 4])[src]

Color a debug triangle by adding a color

Color mutates the model-space of a triangle. The color value this takes is i16 because it needs to be able to add and subtract the color components. Internally the RGBA u8 color values are converted to i16 and then cast back to u8 using clamping.

pub fn translate(&mut self, handle: &Handle, delta: (f32, f32))[src]

Translate a debug triangle by a vector

Translation does not mutate the model-space of a triangle.

pub fn rotate<T: Copy + Into<Rad<f32>>>(&mut self, handle: &Handle, deg: T)[src]

Rotate a debug triangle

Rotation does not mutate the model-space of a triangle.

pub fn scale(&mut self, handle: &Handle, scale: f32)[src]

Scale a debug triangle

Scale does not mutate the model-space of a triangle.

pub fn deform_all(&mut self, delta: impl FnMut(usize) -> [(f32, f32); 3])[src]

Deform all triangles by adding delta vertices

Adds the delta vertices to each debug triangle. See Debtri::deform for more information.

pub fn color_all(&mut self, delta: impl FnMut(usize) -> [i16; 4])[src]

Color all debug triangles by adding a color

Adds the color in the argument to the existing color of each triangle. See Debtri::color for more information.

pub fn translate_all(&mut self, delta: impl FnMut(usize) -> (f32, f32))[src]

Translate all debug triangles by a vector

Adds the translation in the argument to the existing translation of each triangle. See Debtri::translate for more information.

pub fn rotate_all<T: Copy + Into<Rad<f32>>>(
    &mut self,
    delta: impl FnMut(usize) -> T
)
[src]

Rotate all debug triangles

Adds the rotation in the argument to the existing rotation of each triangle. See Debtri::rotate for more information.

pub fn scale_all(&mut self, delta: impl FnMut(usize) -> f32)[src]

Scale all debug triangles (multiplicative)

Multiplies the scale in the argument with the existing scale of each triangle. See Debtri::scale for more information.

pub fn set_deform_all(&mut self, delta: impl FnMut(usize) -> [(f32, f32); 3])[src]

Set the deform on all debug triangles

Applies Debtri::set_deform to all triangles.

pub fn set_color_all(&mut self, delta: impl FnMut(usize) -> Color)[src]

Set the color on all debug triangles

Applies Debtri::set_color to all triangles.

pub fn set_translation_all(&mut self, delta: impl FnMut(usize) -> (f32, f32))[src]

Set the translation on all debug triangles

Applies Debtri::set_translation to all triangles.

pub fn set_rotation_all<T: Copy + Into<Rad<f32>>>(
    &mut self,
    delta: impl FnMut(usize) -> T
)
[src]

Set the rotation on all debug triangles

Applies Debtri::set_rotation to all triangles.

pub fn set_scale_all(&mut self, delta: impl FnMut(usize) -> f32)[src]

Set the scale on all debug triangles

Applies Debtri::set_scale to all triangles. Note: This may re-enable removed triangles, see Debtri::remove.

Auto Trait Implementations

impl<'a> Unpin for Debtri<'a>

impl<'a> !Sync for Debtri<'a>

impl<'a> !Send for Debtri<'a>

impl<'a> !UnwindSafe for Debtri<'a>

impl<'a> !RefUnwindSafe for Debtri<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Supports<T> for T[src]

impl<T> SetParameter for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,