henad_models/boids/lanes.rs
1use henad_compute::agent_lanes;
2
3// --8<-- [start:lanes]
4agent_lanes! {
5 /// Lanes of a flock.
6 ///
7 /// Position and velocity are double buffered, since a boid reads its neighbours' current
8 /// values while writing its own next values. Colour is written in place, as each boid writes
9 /// only its own slot.
10 pub struct BoidLanes {
11 read BoidRead;
12 chunk BoidChunk;
13 /// Horizontal position in world units.
14 dual pos_x / next_pos_x: f32,
15 /// Vertical position in world units.
16 dual pos_y / next_pos_y: f32,
17 /// Horizontal velocity in world units per tick.
18 dual vel_x / next_vel_x: f32,
19 /// Vertical velocity in world units per tick.
20 dual vel_y / next_vel_y: f32,
21 /// Heading octant of the velocity, an index into [`HEADING_PALETTE`](super::HEADING_PALETTE).
22 plain color: u8 = 0,
23 }
24 color = color;
25}
26// --8<-- [end:lanes]