Implement Geometry2D primitive
This commit is contained in:
parent
26de688e68
commit
0d620b7701
13 changed files with 528 additions and 4 deletions
20
core/src/geometry.rs
Normal file
20
core/src/geometry.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/// A two-dimensional vertex which has a color
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Vertex2D {
|
||||
/// The vertex position
|
||||
pub position: [f32; 2],
|
||||
/// The vertex color in rgba
|
||||
pub color: [f32; 4],
|
||||
}
|
||||
|
||||
/// A set of [`Vertex2D`] and indices for drawing some 2D geometry on the GPU.
|
||||
///
|
||||
/// [`Vertex2D`]: struct.Vertex2D.html
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Geometry2D {
|
||||
/// The vertices for this geometry
|
||||
pub vertices: Vec<Vertex2D>,
|
||||
/// The indices for this geometry
|
||||
pub indices: Vec<u16>,
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ mod length;
|
|||
mod point;
|
||||
mod rectangle;
|
||||
mod vector;
|
||||
mod geometry;
|
||||
|
||||
pub use align::{Align, HorizontalAlignment, VerticalAlignment};
|
||||
pub use background::Background;
|
||||
|
|
@ -32,6 +33,7 @@ pub use length::Length;
|
|||
pub use point::Point;
|
||||
pub use rectangle::Rectangle;
|
||||
pub use vector::Vector;
|
||||
pub use geometry::{Vertex2D, Geometry2D};
|
||||
|
||||
#[cfg(feature = "command")]
|
||||
mod command;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue