AGAL Opcode mul and dp4
I am trying to dive into code AGAL and have some questions which are interesting for me.
The first question is about opcodes mul and dp4 If I am right, mul does the following
mul ft0, ft0, ft5 means ft0 = ft0 * ft5 which in fact is ft0.r*ft5.r +ft0.g*ft5.g+ft0.b*ft5.b+ft0.a*ft5.a
dp4 ft0, ft0, ft5 does the same as mul, but you can change an order by using another component order, for instance ft0.argb? Thank you in advance!
No, you wrong. mil means ft0 = ft0 * ft5 = [ft0.r*ft5.r, ft0.g*ft5.g, ft0.b*ft5.b, ft0.a*ft5.a]. You get a vector. dp4 returns scalar (ft0.r*ft5.r + ft0.g*ft5.g + ft0.b*ft5.b + ft0.a*ft5.a). And yes, you can change an "order" - it's called swizzling.