mat /= float and mat *= float are defined for matrices. But its unclear why other component-wise built-in functions like mix aren’t. Seems like they easily could be. Would be useful and shorten shader code.
Focus for most ops (eg sqrt,sin,floor, min) generally is on vectors. Having them also support matrices seems redundant to me. Though interaction of matrices and floats doesn’t seem important enough, either.
Right. It’s not a huge deal. Just noticed while coding up some DQ skinning I had to break out the individual vectors and mix separately, but only for functions not operators.
Compiles without error for me, should work.[/QUOTE]
Definitely an option. And that’s a perfect example of what seems odd to me. The built-in operators all support component-wise operation on matrices, but the built-in functions (that do component-wise operation on vectors) don’t do component-wise operation on matrices. Cg is like that too, so it’s not like GLSL needs to catch-up there. Also, the expression you provide above is the exact definition of mix(), and it works for matrices, …so why shouldn’t mix() “just work” in this case (aside from the language currently precludes it)? Anyway…
Seems odd for sure; HLSL specifies that it’s equivalent (lerp (matrix1, matrix2, factor)) is acceptable too (and has been since SM1 days), so while it’s not a show-stopper it would definitely be nice to clean up the GLSL spec with this.