3 ms·
Is it actually necessary to specify `a` as a floating-point literal? Will it not be implicitly converted?
by zahlman 1y ago
Is it actually necessary to specify `a` as a floating-point literal? Will it not be implicitly converted?
- ux 1y agoYeah. If you want implicit conversion, you need to specify a constructor like float(cond), but that would be longer than the ternary form. I thought about using a vec3() but vec3(...).x is still too long and using the vec3 directly doesn't look viable. Declaring a bool adds more characters as well. There is also step() giving the same number of chars: a=step(.001,h), but it's not more optimal: https://iquilezles.org/articles/gpuconditionals/ https://iquilezles.org/articles/gpuconditionals/ If you see a way to make it shorter, feel free to share :)