From 59b1e90661ee9e479f404bae71029db824cc7b46 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 28 Apr 2020 03:18:31 +0200 Subject: Introduce `Translate` primitive in `iced_wgpu` --- wgpu/src/primitive.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'wgpu/src/primitive.rs') diff --git a/wgpu/src/primitive.rs b/wgpu/src/primitive.rs index 46d9e624..e9c0bf46 100644 --- a/wgpu/src/primitive.rs +++ b/wgpu/src/primitive.rs @@ -1,5 +1,5 @@ use iced_native::{ - image, svg, Background, Color, Font, HorizontalAlignment, Point, Rectangle, + image, svg, Background, Color, Font, HorizontalAlignment, Rectangle, Vector, VerticalAlignment, }; @@ -70,13 +70,18 @@ pub enum Primitive { /// The content of the clip content: Box, }, + /// A primitive that applies a translation + Translate { + /// The top-left coordinate of the mesh + translation: Vector, + + /// The primitive to translate + content: Box, + }, /// A low-level primitive to render a mesh of triangles. /// /// It can be used to render many kinds of geometry freely. Mesh2D { - /// The top-left coordinate of the mesh - origin: Point, - /// The vertex and index buffers of the mesh buffers: triangle::Mesh2D, }, @@ -85,9 +90,6 @@ pub enum Primitive { /// This can be useful if you are implementing a widget where primitive /// generation is expensive. Cached { - /// The origin of the coordinate system of the cached primitives - origin: Point, - /// The cached primitive cache: Arc, }, -- cgit From e65585ae17bf2fae1bbad1cde839d6f767a29b82 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 28 Apr 2020 04:41:09 +0200 Subject: Clip and cull `Mesh2D` primitives in `iced_wgpu` --- wgpu/src/primitive.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'wgpu/src/primitive.rs') 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, }, -- cgit