r/badcode • u/DinnerPlz • Oct 30 '21
other language I sure do love the blue component of my boolean value. (This doesn't work without it)[HLSL]
37
Upvotes
r/badcode • u/DinnerPlz • Oct 30 '21
7
u/Sir_Awesomness Oct 30 '21
I know it's GLSL not HLSL but I made a thing in shadertoy that is essentially the same thing but without the .b and it compiles: https://www.shadertoy.com/view/fld3zr
It's potentially where you've got the brackets, I only have 2 after the float4.
3
u/SnakeFang12 Oct 31 '21
Logical operators are component-wise on vectors, so the equality evaluates to a bool3, and the ternary selects from the choices for each channel separately. You most likely want to wrap the comparison in all() rather than ignore the first two channels.
8
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Oct 30 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!