Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epaint: add some missing inline docs #4815

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/epaint/src/mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl Mesh {
self.vertices = Default::default();
}

/// Returns the amount of memory used by the vertices and indices.
pub fn bytes_used(&self) -> usize {
std::mem::size_of::<Self>()
+ self.vertices.len() * std::mem::size_of::<Vertex>()
Expand Down Expand Up @@ -107,6 +108,8 @@ impl Mesh {
}

/// Append all the indices and vertices of `other` to `self`.
///
/// Panics when `other` mesh has a different texture.
pub fn append(&mut self, other: Self) {
crate::profile_function!();
debug_assert!(other.is_valid());
Expand All @@ -120,6 +123,8 @@ impl Mesh {

/// Append all the indices and vertices of `other` to `self` without
/// taking ownership.
///
/// Panics when `other` mesh has a different texture.
pub fn append_ref(&mut self, other: &Self) {
debug_assert!(other.is_valid());

Expand All @@ -138,6 +143,9 @@ impl Mesh {
self.vertices.extend(other.vertices.iter());
}

/// Add a colored vertex.
///
/// Panics when the mesh has assigned a texture.
#[inline(always)]
pub fn colored_vertex(&mut self, pos: Pos2, color: Color32) {
debug_assert!(self.texture_id == TextureId::default());
Expand Down
Loading