This is segment of code of 3dcpptutorials ray tracing. Can someone explain me how this lines of code works ?
As I understand it, if it's less than 0, it stores 0 and if it's greater than 1, then 255 and if it's between, then value * 255, something like that. Am I correct ?
colorbuffer[2] = Color.r <= 0.0f ? 0 : Color.r >= 1.0 ? 255 : (BYTE)(Color.r * 255);
colorbuffer[1] = Color.g <= 0.0f ? 0 : Color.g >= 1.0 ? 255 : (BYTE)(Color.g * 255);
colorbuffer[0] = Color.b <= 0.0f ? 0 : Color.b >= 1.0 ? 255 : (BYTE)(Color.b * 255);
0.0to1.0to an integer value between0and255.