bones_framework/render/line.rs
1//! Line rendering, useful for debugging.
2
3use crate::prelude::*;
4
5/// A component for rendering a 2D line path, made up of a list of straight line segments.
6#[derive(Clone, Debug, HasSchema)]
7pub struct Path2d {
8 /// The color of the path.
9 pub color: Color,
10 /// The list of points in the path
11 pub points: Vec<Vec2>,
12
13 /// The thickness of the line.
14 pub thickness: f32,
15
16 /// List of indexes into the `points` vector, for which that point should **not** beconnected to
17 /// the next point in the list.
18 ///
19 /// This allows you to make multiple, disconnected paths without needing to create more entities
20 /// with a [`Path2d`] component.
21 pub line_breaks: Vec<usize>,
22}
23
24impl Default for Path2d {
25 fn default() -> Self {
26 Self {
27 thickness: 1.0,
28 points: default(),
29 color: Color::WHITE,
30 line_breaks: default(),
31 }
32 }
33}