// World Evils - emission on the block's own face.
//
// Colour-agnostic on purpose: strength comes from brightness only, never from a
// channel test. Solas's own torch_lantern.glsl hardcodes an ORANGE test
// (r > 0.8 && g > 0.5 || r > 0.6 && b < 0.2) and scores a green flame at
// exactly zero, which is why the cursed torch could never work on that id.
//
// The small factors are load-bearing. Solas ends with
//     albedo *= ... + emission * EMISSION_STRENGTH        (EMISSION_STRENGTH 5)
// so emission 0.5 multiplies the albedo by 2.5 and pushes every channel past
// 1.0 - white, whatever colour it started as. Reference: Solas's amethyst is
// pow6(lAlbedo) * 0.4, which lands near x1.06 and keeps its colour.
else if (material == 91 || material == 92) {
    // Shadow Orb / Crimson Heart: the whole block glows.
    emission = pow3(lAlbedo) * 0.30;
}
else if (material == 93 || material == 94) {
    // Evil torches and lanterns: the flame only. The stick is dark wood and the
    // cage is grey iron, so bright+saturated separates them without a hue.
    float weMx = max(albedo.r, max(albedo.g, albedo.b));
    float weMn = min(albedo.r, min(albedo.g, albedo.b));
    float weSat = weMx > 0.001 ? (weMx - weMn) / weMx : 0.0;
    emission = float(weMx > 0.55 && weSat > 0.30) * pow2(lAlbedo) * 0.20;
}
else if (material == 95) {
    // Astral torch / lantern / campfire: the flame only, on the same
    // bright-and-saturated test the other two evils' lights use. The Astral's
    // flame is cyan where theirs are gold and green, which is exactly why the
    // test cannot be a hue.
    float weMx = max(albedo.r, max(albedo.g, albedo.b));
    float weMn = min(albedo.r, min(albedo.g, albedo.b));
    float weSat = weMx > 0.001 ? (weMx - weMn) / weMx : 0.0;
    emission = float(weMx > 0.55 && weSat > 0.30) * pow2(lAlbedo) * 0.20;
}
else if (material == 96) {
    // Astral Beacon and Astral Ore: the whole block glows, as the orbs do.
    // Slightly under them - the ore is rock with light in it, not a lamp.
    emission = pow3(lAlbedo) * 0.24;
}
else if (material == 97) {
    // Hallowed grass: the teal, not the dirt. The top face is entirely the
    // colour that glows and the side is mostly not, so this is picked out the
    // same way the evils' torch flames are - by being saturated and clearly not
    // brown, rather than by naming a hue.
    float weMx = max(albedo.r, max(albedo.g, albedo.b));
    float weMn = min(albedo.r, min(albedo.g, albedo.b));
    float weSat = weMx > 0.001 ? (weMx - weMn) / weMx : 0.0;
    float weTeal = float(weSat > 0.25 && albedo.g > albedo.r * 1.2 && albedo.b > albedo.r * 1.2);
    // Well under the torches. This is ground you walk on for miles, and a floor
    // that lights the sky is a floor nobody can look at.
    emission = weTeal * pow2(lAlbedo) * 0.10;
}
