more
This commit is contained in:
parent
2fe3c69963
commit
6bc125be1c
104 changed files with 3084 additions and 2410 deletions
|
|
@ -3,6 +3,8 @@ struct Settings {
|
|||
eraserMaskAlphaThreshold: f32,
|
||||
maskWidth: u32,
|
||||
maskHeight: u32,
|
||||
boundsMin: vec2<f32>,
|
||||
boundsMax: vec2<f32>,
|
||||
};
|
||||
|
||||
@group(1) @binding(0) var<uniform> settings: Settings;
|
||||
|
|
@ -23,9 +25,18 @@ fn main(
|
|||
return;
|
||||
}
|
||||
|
||||
let position = agents[id].position;
|
||||
let outsideBounds = position.x < settings.boundsMin.x ||
|
||||
position.y < settings.boundsMin.y ||
|
||||
position.x > settings.boundsMax.x ||
|
||||
position.y > settings.boundsMax.y;
|
||||
if outsideBounds {
|
||||
return;
|
||||
}
|
||||
|
||||
let maskSize = vec2<i32>(i32(settings.maskWidth), i32(settings.maskHeight));
|
||||
let maskPosition = clamp(
|
||||
vec2<i32>(agents[id].position),
|
||||
vec2<i32>(position),
|
||||
vec2<i32>(0, 0),
|
||||
maskSize - vec2<i32>(1, 1)
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue