From 30432cbade3d9b25c4df62656a7494db3f4ea82a Mon Sep 17 00:00:00 2001 From: shan Date: Wed, 5 Oct 2022 10:49:58 -0700 Subject: Readjusted namespaces, removed Geometry example as it's no longer relevant. --- graphics/src/layer/quad.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 graphics/src/layer/quad.rs (limited to 'graphics/src/layer/quad.rs') diff --git a/graphics/src/layer/quad.rs b/graphics/src/layer/quad.rs new file mode 100644 index 00000000..4380fb6c --- /dev/null +++ b/graphics/src/layer/quad.rs @@ -0,0 +1,30 @@ +/// A colored rectangle with a border. +/// +/// This type can be directly uploaded to GPU memory. +#[derive(Debug, Clone, Copy)] +#[repr(C)] +pub struct Quad { + /// The position of the [`Quad`]. + pub position: [f32; 2], + + /// The size of the [`Quad`]. + pub size: [f32; 2], + + /// The color of the [`Quad`], in __linear RGB__. + pub color: [f32; 4], + + /// The border color of the [`Quad`], in __linear RGB__. + pub border_color: [f32; 4], + + /// The border radius of the [`Quad`]. + pub border_radius: f32, + + /// The border width of the [`Quad`]. + pub border_width: f32, +} + +#[allow(unsafe_code)] +unsafe impl bytemuck::Zeroable for Quad {} + +#[allow(unsafe_code)] +unsafe impl bytemuck::Pod for Quad {} \ No newline at end of file -- cgit From cb7c4676543cd508dfae8d4dcbd9cc8b61b1a94e Mon Sep 17 00:00:00 2001 From: shan Date: Thu, 6 Oct 2022 07:28:05 -0700 Subject: Fixed lint issues & cleaned up some documentation. --- graphics/src/layer/quad.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'graphics/src/layer/quad.rs') diff --git a/graphics/src/layer/quad.rs b/graphics/src/layer/quad.rs index 4380fb6c..4def8427 100644 --- a/graphics/src/layer/quad.rs +++ b/graphics/src/layer/quad.rs @@ -27,4 +27,4 @@ pub struct Quad { unsafe impl bytemuck::Zeroable for Quad {} #[allow(unsafe_code)] -unsafe impl bytemuck::Pod for Quad {} \ No newline at end of file +unsafe impl bytemuck::Pod for Quad {} -- cgit