pub struct GpuBoids;Expand description
Boids flocking as a GpuAgentModel, seeded through BoidsModel::init.
Trait Implementations§
Source§impl GpuAgentModel for GpuBoids
impl GpuAgentModel for GpuBoids
Source§const BUFFERS: &'static [BufferSpec] = BUFFER_SPECS
const BUFFERS: &'static [BufferSpec] = BUFFER_SPECS
Position, velocity and colour, each double buffered, since a boid reads its neighbours’ current values while writing its own next values.
Source§const REPLAYS_EXACTLY: bool = false
const REPLAYS_EXACTLY: bool = false
The neighbour index leaves the order of boids within a cell to the GPU.
Source§const REDUCE: ReduceSpec
const REDUCE: ReduceSpec
Reduction of three lanes: speed, x velocity and y velocity.
Source§const ID: &'static str = "gpu_boids"
const ID: &'static str = "gpu_boids"
Stable id that identifies the model in a model set, on the command line and in a spec file.
Source§const DESCRIPTION: &'static str = "A simulation of flocking behavior in a group of boids, stepped entirely on the GPU"
const DESCRIPTION: &'static str = "A simulation of flocking behavior in a group of boids, stepped entirely on the GPU"
One-line description shown in the UI.
Source§const STATS: &'static [StatDescriptor] = BoidsModel::STATS
const STATS: &'static [StatDescriptor] = BoidsModel::STATS
Stat series for the history chart. Declared once, so
Self::stats returns bare values.Source§const POS_BUFFER: usize = POS
const POS_BUFFER: usize = POS
Index into
Self::BUFFERS of the vec2<f32> positions that the view draws.Source§const COLOR_BUFFER: usize = COLOR
const COLOR_BUFFER: usize = COLOR
Index into
Self::BUFFERS of the packed RGBA that the view draws.Source§const INDEX: bool = true
const INDEX: bool = true
Whether the engine rebuilds a neighbour index from the positions before every step. Read more
Source§const STEP_PASSES: &'static [PassSpec]
const STEP_PASSES: &'static [PassSpec]
Passes of one step, run in declaration order.
Source§const ACTIONS: &'static [GpuAgentAction]
const ACTIONS: &'static [GpuAgentAction]
One-off passes the user can trigger. Each gets a button in the Parameters panel.
Source§fn param_descriptors() -> Vec<ParamDescriptor>
fn param_descriptors() -> Vec<ParamDescriptor>
Returns the full descriptor list. Read more
Source§fn dims(params: &[ParamValue]) -> (u32, Extent)
fn dims(params: &[ParamValue]) -> (u32, Extent)
Returns the population and the world extent for these params. The engine clamps the population and each
axis of the extent to at least 1.
Source§fn buffer_lens(geom: &Geometry) -> Vec<usize>
fn buffer_lens(geom: &Geometry) -> Vec<usize>
Returns the length in
u32-sized elements of each buffer, one per Self::BUFFERS entry.Source§fn seed_buffers(
geom: &Geometry,
params: &[ParamValue],
seed: Option<u64>,
) -> Vec<Vec<u8>>
fn seed_buffers( geom: &Geometry, params: &[ParamValue], seed: Option<u64>, ) -> Vec<Vec<u8>>
Returns the initial contents of each buffer as raw bytes, one vector per
Self::BUFFERS entry. Read moreSource§fn index_cell_size(params: &[ParamValue]) -> f32
fn index_cell_size(params: &[ParamValue]) -> f32
Returns the neighbour index’s cell size for these params. Read more
Source§fn pass_params_bytes(
pass: PassId,
ctx: PassCtx<'_>,
params: &[ParamValue],
) -> Vec<u8> ⓘ
fn pass_params_bytes( pass: PassId, ctx: PassCtx<'_>, params: &[ParamValue], ) -> Vec<u8> ⓘ
Returns the uniform block of
pass as raw bytes. Read moreSource§fn stats(sums: &[f32], _counters: &[u32], geom: &Geometry) -> Vec<StatValue>
fn stats(sums: &[f32], _counters: &[u32], geom: &Geometry) -> Vec<StatValue>
Turns the reduction and the counters into values, in
Self::STATS order. Read moreSource§const COUNTERS: usize = 0
const COUNTERS: usize = 0
Number of persistent
u32 counters that a kernel accumulates into. Read moreSource§const DISPLAY: Option<DisplaySpec> = None
const DISPLAY: Option<DisplaySpec> = None
Display pass, for a model that draws a grid layer under its agents.
Auto Trait Implementations§
impl Freeze for GpuBoids
impl RefUnwindSafe for GpuBoids
impl Send for GpuBoids
impl Sync for GpuBoids
impl Unpin for GpuBoids
impl UnsafeUnpin for GpuBoids
impl UnwindSafe for GpuBoids
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more