1use vek::*;
2
3#[derive(Copy, Clone, Debug, Default)]
4pub struct Way {
5 pub offset: Vec2<i8>,
7 pub neighbors: u8,
9}
10
11impl Way {
12 pub fn is_way(&self) -> bool { self.neighbors != 0 }
13
14 pub fn clear(&mut self) { self.neighbors = 0; }
15}
16
17#[derive(Copy, Clone, Debug)]
18pub struct Path {
19 pub width: f32, }
21
22impl Default for Path {
23 fn default() -> Self { Self { width: 5.0 } }
24}
25
26impl Lerp for Path {
27 type Output = Self;
28
29 fn lerp_unclamped(from: Self, to: Self, factor: f32) -> Self::Output {
30 Self {
31 width: Lerp::lerp(from.width, to.width, factor),
32 }
33 }
34}
35
36impl Path {
37 pub fn head_space(&self, dist: f32) -> i32 { (8 - (dist * 0.25).powi(6).round() as i32).max(1) }
41
42 pub fn surface_color(&self, col: Rgb<u8>) -> Rgb<u8> { col.map(|e| (e as f32 * 0.7) as u8) }
44}