Replace bit-packed cell flags in the R channel with a direct material ID float pass-through. Food clearing now writes MAT_AIR instead of clearing a bit.
26 lines
708 B
GLSL
26 lines
708 B
GLSL
precision highp float;
|
|
precision highp int;
|
|
|
|
in vec2 vUv;
|
|
|
|
out vec4 FragColor;
|
|
|
|
uniform sampler2D tLastState;
|
|
uniform sampler2D tDiscreteAnts;
|
|
|
|
void main() {
|
|
vec4 lastState = texture(tLastState, vUv);
|
|
vec4 discreteAnts = texture(tDiscreteAnts, vUv);
|
|
|
|
float materialId = lastState.x;
|
|
float scentToHome = min(SCENT_MAX_PER_CELL, lastState.y + discreteAnts.x);
|
|
float scentToFood = min(SCENT_MAX_PER_CELL, lastState.z + discreteAnts.y);
|
|
float repellent = min(REPELLENT_MAX_PER_CELL, lastState.w);
|
|
|
|
// ant picked up food from this cell
|
|
if (discreteAnts.z == 1.) {
|
|
materialId = float(MAT_AIR);
|
|
}
|
|
|
|
FragColor = vec4(materialId, scentToHome, scentToFood, repellent);
|
|
}
|