Add operator [ ]
redorav opened this issue · comments
Emilio López commented
For vectors and matrices. Vectors return a float1, matrices a float4
Emilio López commented
I think this solution will necessarily be less efficient than using the swizzles directly, because doing something like
vector[0] = vector[1]
will swizzle twice. Since these kinds of operations are SIMD-unfriendly anyway, it won't be such a big deal. In the case of matrices, returning a float4 is enough and won't incur in any penalty. As a bonus, if a matrix does something like matrix[0][0], this will use the [] operator of the matrix and the [] operator of the vector, and it will be able to index a single float1
Emilio López commented
Close in favor of #63