summaryrefslogtreecommitdiffstats
path: root/wgpu/src/layer/mesh.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-05-19 04:37:58 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-19 04:37:58 +0200
commitcc5d11f1a6fca90ea57e3fb3a69587c65281b6b9 (patch)
tree349d98171b467b7738874a5ef99ce536512c10eb /wgpu/src/layer/mesh.rs
parent8e8b1e1eacc4e2c19c9878625f423c8e09e2d3b9 (diff)
parentf7ed645eddd96f7964268367e24abcb5bb78a979 (diff)
downloadiced-cc5d11f1a6fca90ea57e3fb3a69587c65281b6b9.tar.gz
iced-cc5d11f1a6fca90ea57e3fb3a69587c65281b6b9.tar.bz2
iced-cc5d11f1a6fca90ea57e3fb3a69587c65281b6b9.zip
Merge pull request #1846 from bungoboingo/feat/background-gradients
[Feature] Gradients for Backgrounds
Diffstat (limited to 'wgpu/src/layer/mesh.rs')
-rw-r--r--wgpu/src/layer/mesh.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/wgpu/src/layer/mesh.rs b/wgpu/src/layer/mesh.rs
index 9dd14391..b7dd9a0b 100644
--- a/wgpu/src/layer/mesh.rs
+++ b/wgpu/src/layer/mesh.rs
@@ -1,5 +1,5 @@
//! A collection of triangle primitives.
-use crate::core::{Gradient, Point, Rectangle};
+use crate::core::{Point, Rectangle};
use crate::graphics::primitive;
/// A mesh of triangles.
@@ -22,13 +22,10 @@ pub enum Mesh<'a> {
origin: Point,
/// The vertex and index buffers of the [`Mesh`].
- buffers: &'a primitive::Mesh2D<primitive::Vertex2D>,
+ buffers: &'a primitive::Mesh2D<primitive::GradientVertex2D>,
/// The clipping bounds of the [`Mesh`].
clip_bounds: Rectangle<f32>,
-
- /// The gradient to apply to the [`Mesh`].
- gradient: &'a Gradient,
},
}
@@ -65,9 +62,15 @@ pub struct AttributeCount {
/// The total amount of solid vertices.
pub solid_vertices: usize,
+ /// The total amount of solid meshes.
+ pub solids: usize,
+
/// The total amount of gradient vertices.
pub gradient_vertices: usize,
+ /// The total amount of gradient meshes.
+ pub gradients: usize,
+
/// The total amount of indices.
pub indices: usize,
}
@@ -79,10 +82,12 @@ pub fn attribute_count_of<'a>(meshes: &'a [Mesh<'a>]) -> AttributeCount {
.fold(AttributeCount::default(), |mut count, mesh| {
match mesh {
Mesh::Solid { buffers, .. } => {
+ count.solids += 1;
count.solid_vertices += buffers.vertices.len();
count.indices += buffers.indices.len();
}
Mesh::Gradient { buffers, .. } => {
+ count.gradients += 1;
count.gradient_vertices += buffers.vertices.len();
count.indices += buffers.indices.len();
}