LGTM
This commit is contained in:
parent
b1acdff594
commit
4e92913925
8 changed files with 734 additions and 115 deletions
28
src/pipelines/agents/agent-generation/agent-resize.wgsl
Normal file
28
src/pipelines/agents/agent-generation/agent-resize.wgsl
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
struct ResizeSettings {
|
||||
scale: vec2<f32>,
|
||||
agentCount: f32,
|
||||
padding: f32,
|
||||
};
|
||||
|
||||
@group(1) @binding(0) var<uniform> resizeSettings: ResizeSettings;
|
||||
|
||||
@compute @workgroup_size(64)
|
||||
fn main(
|
||||
@builtin(global_invocation_id) global_id: vec3<u32>,
|
||||
@builtin(num_workgroups) workgroup_count: vec3<u32>
|
||||
) {
|
||||
let id = get_id(global_id, workgroup_count);
|
||||
|
||||
if id >= u32(resizeSettings.agentCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
var agent = agents[id];
|
||||
agent.position *= resizeSettings.scale;
|
||||
|
||||
if agent.targetPosition.x >= 0.0 && agent.targetPosition.y >= 0.0 {
|
||||
agent.targetPosition *= resizeSettings.scale;
|
||||
}
|
||||
|
||||
agents[id] = agent;
|
||||
}
|
||||
|
|
@ -1,7 +1,10 @@
|
|||
struct Agent {
|
||||
position: vec2<f32>,
|
||||
angle: f32,
|
||||
generation: f32,
|
||||
colorIndex: f32,
|
||||
targetPosition: vec2<f32>,
|
||||
targetAngle: f32,
|
||||
introDelay: f32,
|
||||
}
|
||||
|
||||
@group(1) @binding(1) var<storage, read_write> agents: array<Agent>;
|
||||
|
|
|
|||
Loading…
Reference in a new issue