Fix previous commit

This commit is contained in:
Grant Sanderson 2021-01-10 08:38:47 -08:00
parent 92b0953081
commit 8d14b66583
2 changed files with 2 additions and 2 deletions

View file

@ -160,7 +160,7 @@ def get_colormap_code(colormap="viridis"):
for n in np.linspace(0, len(rgbs) - 1, 9)
]
data = ",".join(
"vec3({}, {}, {}),".format(*color)
"vec3({}, {}, {})".format(*color)
for color in sparse_rgbs
)
return f"vec3[9]({data})"

View file

@ -1,5 +1,5 @@
vec3 float_to_color(float value, float min_val, float max_val, vec3[9] colormap_data){
float alpha = smoothstep(min_val, max_val, value);
float alpha = clamp((value - min_val) / (max_val - min_val), 0.0, 1.0);
int disc_alpha = min(int(alpha * 8), 7);
return mix(
colormap_data[disc_alpha],