S or /

SourceClass Mesh

from egui import Mesh
class Mesh:

Textured triangles in two dimensions.

Properties§

@property def indices(self, /) -> list[int]§
@indices.setter def indices(self, /, indices: Sequence[int]) -> None§
@property def texture_id(self, /) -> TextureId§
@texture_id.setter def texture_id(self, /, texture_id: TextureId) -> None§

Methods§

Sourcedef add_colored_rect(self, /, rect: Rect, color: Color32) -> None§

Uniformly colored rectangle.

Sourcedef add_rect_with_uv(self, /, rect: Rect, uv: Rect, color: Color32) -> None§

Rectangle with a texture and color.

Sourcedef add_triangle(self, /, a: int, b: int, c: int) -> None§

Add a triangle.

Sourcedef append(self, /, other: Mesh) -> None§

Append all the indices and vertices of other to self.

Panics when other mesh has a different texture.

Sourcedef append_ref(self, /, other: Mesh) -> None§

Append all the indices and vertices of other to self without taking ownership.

Panics when other mesh has a different texture.

Sourcedef bytes_used(self, /) -> int§

Returns the amount of memory used by the vertices and indices.

Sourcedef calc_bounds(self, /) -> Rect§

Calculate a bounding rectangle.

Sourcedef clear(self, /) -> None§

Restore to default state, but without freeing memory.

Sourcedef colored_vertex(self, /, pos: Pos2, color: Color32) -> None§

Add a colored vertex.

Panics when the mesh has assigned a texture.

@staticmethod def default() -> Mesh§
Sourcedef is_empty(self, /) -> bool§
Sourcedef is_valid(self, /) -> bool§

Are all indices within the bounds of the contained vertices?

Sourcedef reserve_triangles(self, /, additional_triangles: int) -> None§

Make room for this many additional triangles (will reserve 3x as many indices). See also reserve_vertices.

Sourcedef reserve_vertices(self, /, additional: int) -> None§

Make room for this many additional vertices. See also reserve_triangles.

Sourcedef rotate(self, /, angle: float, origin: Pos2) -> None§

Rotate by some angle about an origin, in-place.

Origin is a position in screen space.

Sourcedef split_to_u16(self, /) -> list[Mesh16]§

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.

Sourcedef transform(self, /, transform: TSTransform) -> None§

Transform the mesh in-place with the given transform.

Sourcedef translate(self, /, delta: Vec2) -> None§

Translate location by this much, in-place

Sourcedef triangles(self, /) -> list[tuple[int, int, int]]§

Iterate over the triangles of this mesh, returning vertex indices.

def vertices(self, /) -> list[MeshVertex]§
Source@staticmethod def with_texture(texture_id: TextureId) -> Mesh§