From 34bd1e95c2b651239fca97accfb195e4fa2e1dff Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Wed, 11 Mar 2026 15:24:45 -0400 Subject: [PATCH] Add powder material deposit logic for surface placement --- src/shaders/antsCompute.frag | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/shaders/antsCompute.frag b/src/shaders/antsCompute.frag index c4f7926..a377a55 100644 --- a/src/shaders/antsCompute.frag +++ b/src/shaders/antsCompute.frag @@ -246,6 +246,21 @@ void main() { } } + // deposit carried powder material when standing on air with solid ground below + if (isCarrying == 1. && int(cargoMaterialId) != MAT_FOOD) { + float cellMatId = texture(tWorld, roundUvToCellCenter(pos)).x; + if (int(cellMatId) == MAT_AIR) { + vec2 belowPos = pos - vec2(0., cellSize); + float belowMatId = texture(tWorld, roundUvToCellCenter(belowPos)).x; + if (int(belowMatId) != MAT_AIR || belowPos.y <= 0.) { + isCarrying = 0.; + // keep cargoMaterialId set so discretize can read it this frame + angle += PI; + storage = getMaxScentStorage(vUv); + } + } + } + FragColor = vec4( pos.x, pos.y,