2021-02-12 23:44:51 +00:00
|
|
|
uniform half4 colorGreen, colorRed;
|
|
|
|
|
|
|
|
half4 main() {
|
|
|
|
float4 value = colorGreen.gggg * 2.5;
|
|
|
|
float4 whole, fraction;
|
|
|
|
bool4 ok;
|
|
|
|
|
|
|
|
// 2.5 equals 2 + 0.5.
|
|
|
|
fraction.x = modf(value.x, whole.x);
|
|
|
|
ok.x = whole.x == 2 && fraction.x == 0.5;
|
|
|
|
fraction.xy = modf(value.xy, whole.xy);
|
|
|
|
ok.y = whole.y == 2 && fraction.y == 0.5;
|
|
|
|
fraction.xyz = modf(value.xyz, whole.xyz);
|
|
|
|
ok.z = whole.z == 2 && fraction.z == 0.5;
|
|
|
|
fraction.xyzw = modf(value.xyzw, whole.xyzw);
|
|
|
|
ok.w = whole.w == 2 && fraction.w == 0.5;
|
|
|
|
|
|
|
|
return all(ok) ? colorGreen : colorRed;
|
|
|
|
}
|