This commit is contained in:
Andras Schmelczer 2026-05-17 14:12:01 +01:00
commit 80ed37298b
73 changed files with 3619 additions and 1295 deletions

View file

@ -1,6 +1,6 @@
struct Settings {
agentCount: f32,
padding0: f32,
eraserMaskAlphaThreshold: f32,
padding1: f32,
padding2: f32,
};
@ -18,21 +18,20 @@ fn main(
return;
}
var agent = agents[id];
if agent.colorIndex < 0.0 {
let colorIndex = agents[id].colorIndex;
if colorIndex < 0.0 {
return;
}
let maskSize = vec2<i32>(textureDimensions(eraserMask));
let maskPosition = clamp(
vec2<i32>(agent.position),
vec2<i32>(agents[id].position),
vec2<i32>(0, 0),
maskSize - vec2<i32>(1, 1)
);
let maskSample = textureLoad(eraserMask, maskPosition, 0);
if maskSample.a < 0.5 {
agent.colorIndex = -1.0;
agents[id] = agent;
if maskSample.a < settings.eraserMaskAlphaThreshold {
agents[id].colorIndex = -1.0;
}
}