uniform sampler1D colormap;
uniform vec4 conf;

vec4 linear_colormap(float value)
{
    float vmin = conf.x;
    float vmax = conf.y;
    float count = conf.z - 1.0;

    float invalid = conf.w;

    if (value == invalid) {
        return vec4(0.0, 0.0, 0.0, 0.0);
    }

    float v = clamp((value - vmin), vmin, vmax) / (vmax - vmin);
    vec4 result = texture(colormap, v);
    return result;
}
