Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a simple question. what are the meaning of :

half4 myHalf;
myHalf.yyyy;
myHalf.xxzz;
// or
myHalf.yw

Thanks a lot !

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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.x, myhalf.x, myhalf.z, myhalf.z)

myHalf.yw is a two component vector with the values: (myhalf.y, myhalf.w).

share|improve this answer
    
Thank you a lot, it was simple ! –  MaT Jul 2 '13 at 15:27
1  
This is also referring to as "swizzling". –  Josh Petrie Jul 2 '13 at 20:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.