Add powder material deposit logic for surface placement

This commit is contained in:
Jared Miller 2026-03-11 15:24:45 -04:00
parent 43d3e56aee
commit 34bd1e95c2
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C

View file

@ -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,