If I encode all colors into one single float value (RGB) as:
//Each Channels are from 0 - 255
red << 16 | green << 8 | blue;
How can I retrieve those color channels back in AGAL? There doesn’t seem to be any bitwise operators.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should not need to do this. Use BYTES_4 input in a vertex stream and your packed color will be unpacked for you automatically! Textures do the same thing. Constant registers are 4 float all the time anyway. You should start to think of colors as 4 vectors with 4 values in the [0..1] range.
That said, remember that a bit shift is just a division and truncation. x>>1 is the same as trunc(x/2.0). AGAL does not have truncation but fractional part, and trunc(x) is the same as x-frac(x) for positive x.