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!

Answers


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.


Need Your Help

How to use Push Notifications in Xamarin Forms

c# xamarin push-notification xamarin.forms pushsharp

I have an app using Xamarin.Forms targeting IOS, Android and WP 8.