This is an example of component separation, and it works as follows:
If the main types in the operands do not match, then the transforms from section 4.1.10 "Implicit conversions" are used to create the corresponding types. [...] After conversion, the following cases are possible:
[...]
- One operand is a scalar, and the other is a vector or matrix. In this case, the scalar operation is applied independently to each component of the vector or matrix, leading to the same vector or size matrix.
Given the expression:
vv vec3 (bR.r / bR); ^ float
The bR.r bR.r essentially advances to vec3 (bR.r, bR.r, bR.r) , and then the component separation is performed, which leads to vec3 (bR.r/bR.r, bR.r/bR.g, bR.r/bR.b) .
So this expression is equivalent to:
vec3 (1.0, bR.r/bR.g, bR.r/bR.b)
Andon M. coleman
source share