We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d875811 commit 684a294Copy full SHA for 684a294
1 file changed
webgpu/shaders/colormap.wgsl
@@ -25,9 +25,11 @@ fn getColor(value: f32) -> vec4<f32> {
25
26
v = clamp(v, 0.0, 1.0);
27
28
- var colorIndex = v * (Nf - 1.0);
+ var colorIndex: f32;
29
if (u_cmap_uniforms.discrete == 1u) {
30
- colorIndex = floor(colorIndex);
+ colorIndex = min(floor(v * Nf), Nf - 1.0);
31
+ } else {
32
+ colorIndex = v * (Nf - 1.0);
33
}
34
35
var uv = vec2f(0.5, 0.5);
0 commit comments