Representing floats with color?
Ok I've got a challenge for you, a nut to crack.:cool:
We have a color class with values r, g, b and a.
r,g,b and a each go from 0 to 255 as integers.
How do you make the color value represent any float value? Find some logic for how you could combine the four values to represent a float.
..or perhaps a reasonable value like between 0.0f and 1000000.0f. 2-3 decimals would be enough to store.
Will try to solve this myself in some way too...;)
Edit: Things got a bit easier... added a fourth "a" value since we have an alpha channel as well.