fix(lines): accept f32 colors

This commit is contained in:
Nova
2022-11-26 00:43:04 -05:00
parent 5874eaef78
commit 6ef154e9b3

View File

@@ -21,7 +21,7 @@ static LINES_REGISTRY: Registry<Lines> = Registry::new();
struct LinePointRaw { struct LinePointRaw {
point: Vector3<f32>, point: Vector3<f32>,
thickness: f32, thickness: f32,
color: [u8; 4], color: [f32; 4],
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@@ -61,7 +61,7 @@ impl Lines {
.map(|p| SkLinePoint { .map(|p| SkLinePoint {
point: transform_mat.transform_point3a(Vec3A::from(p.point)).into(), point: transform_mat.transform_point3a(Vec3A::from(p.point)).into(),
thickness: p.thickness, thickness: p.thickness,
color: Color32::from_slice(&p.color), color: Color32::from_slice(p.color.map(|c| (c / 255.0) as u8).as_slice()),
}) })
.collect(); .collect();
if data.cyclic && !points.is_empty() { if data.cyclic && !points.is_empty() {