
Michael Fawcett wrote:
I have uploaded a small prototype that demonstrates the syntax mentioned in the thread below. It is in the Vault under Math - Geometry as swizzle_demo.zip.
http://article.gmane.org/gmane.comp.lib.boost.devel/149076/match=geometry+ve...
Here's a small example showing its use:
float4 b(1, 2, 3, 4);
float4 a = b.xxxx(); // a is now 1, 1, 1, 1 a = b.wwwz(); // a is now 4, 4, 4, 3 a = b.yzzw(); // a is now 2, 3, 3, 4 a = b.wzyx(); // a is now 4, 3, 2, 1
float4 c(10, 20, 30, 40); c.yz() = b.zy(); // c is now 10, 3, 2, 40
<snip>
Very cool! I know nothing about the PP library so it is very hard for me to decipher what the code is doing. If I were to write: float4 red( 1, 0, 0, 1 ); glColor4fv( (float*)&red ); // make color red glColor4fv( (float*)&red.xxxw() ); // make color white would this work? I'm guessing red would and white would not. Thanks, Michael Marcin