2020-04-16 18:14:09 -07:00
|
|
|
use piet_gpu_derive::piet_gpu;
|
|
|
|
|
|
|
|
pub use self::scene::{
|
2020-04-17 16:01:37 -07:00
|
|
|
Bbox, PietCircle, PietFill, PietItem, PietStrokeLine, PietStrokePolyLine, Point, SimpleGroup,
|
2020-04-16 18:14:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
piet_gpu! {
|
|
|
|
#[rust_encode]
|
|
|
|
mod scene {
|
|
|
|
struct Bbox {
|
|
|
|
// TODO: this should be i16
|
|
|
|
bbox: [u16; 4],
|
|
|
|
}
|
|
|
|
struct Point {
|
|
|
|
xy: [f32; 2],
|
|
|
|
}
|
|
|
|
struct SimpleGroup {
|
|
|
|
n_items: u32,
|
|
|
|
// Note: both of the following items are actually arrays
|
|
|
|
items: Ref<PietItem>,
|
|
|
|
bboxes: Ref<Bbox>,
|
|
|
|
}
|
2020-04-17 16:01:37 -07:00
|
|
|
struct PietCircle {
|
|
|
|
rgba_color: u32,
|
|
|
|
center: Point,
|
|
|
|
radius: f32,
|
|
|
|
}
|
2020-04-16 18:14:09 -07:00
|
|
|
struct PietStrokeLine {
|
|
|
|
flags: u32,
|
|
|
|
rgba_color: u32,
|
|
|
|
width: f32,
|
|
|
|
start: Point,
|
|
|
|
end: Point,
|
|
|
|
}
|
|
|
|
struct PietFill {
|
|
|
|
flags: u32,
|
|
|
|
rgba_color: u32,
|
|
|
|
n_points: u32,
|
|
|
|
points: Ref<Point>,
|
|
|
|
}
|
|
|
|
struct PietStrokePolyLine {
|
|
|
|
rgba_color: u32,
|
|
|
|
width: f32,
|
|
|
|
n_points: u32,
|
|
|
|
points: Ref<Point>,
|
|
|
|
}
|
|
|
|
enum PietItem {
|
2020-04-17 16:01:37 -07:00
|
|
|
Circle(PietCircle),
|
2020-04-16 18:14:09 -07:00
|
|
|
Line(PietStrokeLine),
|
|
|
|
Fill(PietFill),
|
|
|
|
Poly(PietStrokePolyLine),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|