pub struct Vertices { /* private fields */ }Expand description
A mesh of triangles in user space, with optional texture coordinates.
Texture coordinates run from zero to one across the image and are read per vertex, which is the point of supplying them: every other way of drawing an image here maps it by position, and a mesh that wanted that mapping would not need coordinates at all.
Implementations§
Source§impl Vertices
impl Vertices
Sourcepub fn new(mode: VertexMode, positions: Vec<Vec2>) -> Result<Vertices, Error>
pub fn new(mode: VertexMode, positions: Vec<Vec2>) -> Result<Vertices, Error>
A mesh from positions alone, filled by the paint.
The paint is sampled by position, as it is for any shape: a gradient runs across the mesh the way it would across a path covering the same area.
Sourcepub fn textured(
mode: VertexMode,
positions: Vec<Vec2>,
texture_coords: Vec<Vec2>,
) -> Result<Vertices, Error>
pub fn textured( mode: VertexMode, positions: Vec<Vec2>, texture_coords: Vec<Vec2>, ) -> Result<Vertices, Error>
A mesh whose vertices name where in the paint they read.
Any shader reads there, which is what dart:ui means by a color source
at a mesh’s coordinates: an image samples its texture, a gradient
measures its ramp, and a caller’s program receives them as uv beside
the clip position and chooses. This used to say “requires an image
paint”, which was true of neither the last two.
Sourcepub fn colored(
mode: VertexMode,
positions: Vec<Vec2>,
colors: Vec<Color>,
) -> Result<Vertices, Error>
pub fn colored( mode: VertexMode, positions: Vec<Vec2>, colors: Vec<Color>, ) -> Result<Vertices, Error>
A mesh whose vertices each carry a color.
The color multiplies whatever the paint produced, so a white paint
leaves the mesh’s own colors, and a gradient paint is shaded by them.
Multiplying is the only combination offered: dart:ui takes a blend
mode here, and every other mode either discards one of the two inputs
or is not expressible without a second value per fragment.
Sourcepub fn indexed(
mode: VertexMode,
positions: Vec<Vec2>,
texture_coords: Vec<Vec2>,
indices: Vec<u32>,
) -> Result<Vertices, Error>
pub fn indexed( mode: VertexMode, positions: Vec<Vec2>, texture_coords: Vec<Vec2>, indices: Vec<u32>, ) -> Result<Vertices, Error>
The same, with the triangles named by index rather than by order.
Sourcepub fn full(
mode: VertexMode,
positions: Vec<Vec2>,
texture_coords: Vec<Vec2>,
colors: Vec<Color>,
indices: Vec<u32>,
) -> Result<Vertices, Error>
pub fn full( mode: VertexMode, positions: Vec<Vec2>, texture_coords: Vec<Vec2>, colors: Vec<Color>, indices: Vec<u32>, ) -> Result<Vertices, Error>
Everything at once, for a caller who has all of it.
pub fn positions(&self) -> &[Vec2]
Sourcepub fn texture_coords(&self) -> &[Vec2]
pub fn texture_coords(&self) -> &[Vec2]
Texture coordinates, or empty where the mesh carries none.
Sourcepub fn indices(&self) -> &[u32]
pub fn indices(&self) -> &[u32]
Triangle indices, three per triangle, whatever mode built them.
pub fn is_empty(&self) -> bool
Trait Implementations§
impl StructuralPartialEq for Vertices
Auto Trait Implementations§
impl Forget for Vertices
impl Freeze for Verticeswhere
*const u8 is !null: Freeze,
PhantomData<Vec2>: Freeze,
PhantomData<Color>: Freeze,
PhantomData<u32>: Freeze,
impl Move for Vertices
impl RefUnwindSafe for Vertices
impl Send for Verticeswhere
RawVecInner: Send,
impl Sync for Verticeswhere
RawVecInner: Sync,
impl Unpin for Vertices
impl UnsafeUnpin for Verticeswhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Vec2>: UnsafeUnpin,
PhantomData<Color>: UnsafeUnpin,
PhantomData<u32>: UnsafeUnpin,
impl UnwindSafe for Verticeswhere
RawVecInner: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more