- Home /
Answer by MaT227 · Jul 02, 2013 at 03:30 PM
It's a simple answer! half4 is a four component vector, using half precision floating point coordinates. The extensions you've shown are quick ways to create new vectors using the values from myHalf.
myHalf.yyyy is a four component vector with the values: (myhalf.y, myhalf.y, myhalf.y, myhalf.y)
myHalf.xxzz is a four component vector with the values: (myhalf.y, myhalf.y, myhalf.z, myhalf.z)
myHalf.yw is a two component vector with the values: (myhalf.y, myhalf.w).
As told here.
Answer by equalsequals · Jul 02, 2013 at 03:34 PM
These are very handy short-hands!
The X,Y,Z,W (also seen as R,G,B,A) are the 4 parts to your 4-dimensional half.
Say you have a half4 of 1,.2,.5,0
:
myHalf.yyyy will give you a half4(.2,.2,.2,.2) a 4D half which all 4 parts are equal to the second part of the original. myHalf.xxzz would be half4(1,1,.5,.5) the first 2 are the first and the second 2 are the third.
Hope this helps!
==