GPUMaterial: Fix issue with coloramp and constant interpolation

It was not respecting the clamp to edge texture param because we use
texelFetch directly in this case.
This commit is contained in:
Clément Foucault 2018-09-10 18:29:14 +02:00
parent 9ac72ab69d
commit 766d9c2937
1 changed files with 2 additions and 1 deletions

View File

@ -820,7 +820,8 @@ void valtorgb(float fac, sampler1DArray colormap, float layer, out vec4 outcol,
void valtorgb_nearest(float fac, sampler1DArray colormap, float layer, out vec4 outcol, out float outalpha)
{
outcol = texelFetch(colormap, ivec2(fac * textureSize(colormap, 0).x, layer), 0);
fac = clamp(fac, 0.0, 1.0);
outcol = texelFetch(colormap, ivec2(fac * (textureSize(colormap, 0).x - 1), layer), 0);
outalpha = outcol.a;
}