Struct comfy_wgpu::epaint::Mesh
pub struct Mesh {
pub indices: Vec<u32, Global>,
pub vertices: Vec<Vertex, Global>,
pub texture_id: TextureId,
}Expand description
Textured triangles in two dimensions.
Fields§
§indices: Vec<u32, Global>Draw as triangles (i.e. the length is always multiple of three).
If you only support 16-bit indices you can use Mesh::split_to_u16.
egui is NOT consistent with what winding order it uses, so turn off backface culling.
vertices: Vec<Vertex, Global>The vertex data indexed by indices.
texture_id: TextureIdThe texture to use when drawing these triangles.
Implementations§
§impl Mesh
impl Mesh
pub fn with_texture(texture_id: TextureId) -> Mesh
pub fn clear(&mut self)
pub fn clear(&mut self)
Restore to default state, but without freeing memory.
pub fn bytes_used(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn calc_bounds(&self) -> Rect
pub fn calc_bounds(&self) -> Rect
Calculate a bounding rectangle.
pub fn append_ref(&mut self, other: &Mesh)
pub fn append_ref(&mut self, other: &Mesh)
Append all the indices and vertices of other to self without
taking ownership.
pub fn colored_vertex(&mut self, pos: Pos2, color: Color32)
pub fn add_triangle(&mut self, a: u32, b: u32, c: u32)
pub fn add_triangle(&mut self, a: u32, b: u32, c: u32)
Add a triangle.
pub fn reserve_triangles(&mut self, additional_triangles: usize)
pub fn reserve_triangles(&mut self, additional_triangles: usize)
Make room for this many additional triangles (will reserve 3x as many indices).
See also reserve_vertices.
pub fn reserve_vertices(&mut self, additional: usize)
pub fn reserve_vertices(&mut self, additional: usize)
Make room for this many additional vertices.
See also reserve_triangles.
pub fn add_rect_with_uv(&mut self, rect: Rect, uv: Rect, color: Color32)
pub fn add_rect_with_uv(&mut self, rect: Rect, uv: Rect, color: Color32)
Rectangle with a texture and color.
pub fn add_colored_rect(&mut self, rect: Rect, color: Color32)
pub fn add_colored_rect(&mut self, rect: Rect, color: Color32)
Uniformly colored rectangle.
pub fn split_to_u16(self) -> Vec<Mesh16, Global>
pub fn split_to_u16(self) -> Vec<Mesh16, Global>
This is for platforms that only support 16-bit index buffers.
Splits this mesh into many smaller meshes (if needed) where the smaller meshes have 16-bit indices.
Trait Implementations§
impl Eq for Mesh
impl StructuralEq for Mesh
impl StructuralPartialEq for Mesh
Auto Trait Implementations§
impl RefUnwindSafe for Mesh
impl Send for Mesh
impl Sync for Mesh
impl Unpin for Mesh
impl UnwindSafe for Mesh
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.