Group all solid triangles independently of color

This commit is contained in:
Héctor Ramón Jiménez 2022-11-14 00:02:42 +01:00
parent 5b0dfcd0b0
commit 33c3c0c0aa
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
23 changed files with 1343 additions and 1084 deletions

View file

@ -166,10 +166,27 @@ impl<'a> Layer<'a> {
border_color: border_color.into_linear(),
});
}
Primitive::Mesh2D {
Primitive::SolidMesh { buffers, size } => {
let layer = &mut layers[current_layer];
let bounds = Rectangle::new(
Point::new(translation.x, translation.y),
*size,
);
// Only draw visible content
if let Some(clip_bounds) = layer.bounds.intersection(&bounds) {
layer.meshes.push(Mesh::Solid {
origin: Point::new(translation.x, translation.y),
buffers,
clip_bounds,
});
}
}
Primitive::GradientMesh {
buffers,
size,
style,
gradient,
} => {
let layer = &mut layers[current_layer];
@ -180,11 +197,11 @@ impl<'a> Layer<'a> {
// Only draw visible content
if let Some(clip_bounds) = layer.bounds.intersection(&bounds) {
layer.meshes.push(Mesh {
layer.meshes.push(Mesh::Gradient {
origin: Point::new(translation.x, translation.y),
buffers,
clip_bounds,
style,
gradient,
});
}
}