summaryrefslogtreecommitdiffstats
path: root/graphics/src/layer/mesh.rs
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/src/layer/mesh.rs')
-rw-r--r--graphics/src/layer/mesh.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/graphics/src/layer/mesh.rs b/graphics/src/layer/mesh.rs
index 8a6b1d70..0946317e 100644
--- a/graphics/src/layer/mesh.rs
+++ b/graphics/src/layer/mesh.rs
@@ -37,3 +37,15 @@ impl <'a> Into<Style> for Gradient {
}
}
}
+
+/// Returns the number of total vertices & total indices of all [`Mesh`]es.
+pub fn attribute_count_of<'a>(meshes: &'a [Mesh<'a>]) -> (usize, usize) {
+ meshes
+ .iter()
+ .map(|Mesh { buffers, .. }| {
+ (buffers.vertices.len(), buffers.indices.len())
+ })
+ .fold((0, 0), |(total_v, total_i), (v, i)| {
+ (total_v + v, total_i + i)
+ })
+}