summaryrefslogtreecommitdiffstats
path: root/wgpu/src/primitive.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-28 04:41:09 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-04-28 04:41:09 +0200
commite65585ae17bf2fae1bbad1cde839d6f767a29b82 (patch)
tree49d36c227011d6aed771fa73bd66b26ac31a4142 /wgpu/src/primitive.rs
parent69c60d372c18c20856f733efd337ac302b7de926 (diff)
downloadiced-e65585ae17bf2fae1bbad1cde839d6f767a29b82.tar.gz
iced-e65585ae17bf2fae1bbad1cde839d6f767a29b82.tar.bz2
iced-e65585ae17bf2fae1bbad1cde839d6f767a29b82.zip
Clip and cull `Mesh2D` primitives in `iced_wgpu`
Diffstat (limited to 'wgpu/src/primitive.rs')
-rw-r--r--wgpu/src/primitive.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/wgpu/src/primitive.rs b/wgpu/src/primitive.rs
index e9c0bf46..e73227ef 100644
--- a/wgpu/src/primitive.rs
+++ b/wgpu/src/primitive.rs
@@ -1,5 +1,5 @@
use iced_native::{
- image, svg, Background, Color, Font, HorizontalAlignment, Rectangle,
+ image, svg, Background, Color, Font, HorizontalAlignment, Rectangle, Size,
Vector, VerticalAlignment,
};
@@ -72,7 +72,7 @@ pub enum Primitive {
},
/// A primitive that applies a translation
Translate {
- /// The top-left coordinate of the mesh
+ /// The translation vector
translation: Vector,
/// The primitive to translate
@@ -82,6 +82,11 @@ pub enum Primitive {
///
/// It can be used to render many kinds of geometry freely.
Mesh2D {
+ /// The size of the drawable region of the mesh.
+ ///
+ /// Any geometry that falls out of this region will be clipped.
+ size: Size,
+
/// The vertex and index buffers of the mesh
buffers: triangle::Mesh2D,
},