File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,17 @@ float4 PS_Chromaticity(CShade_VS2PS_Quad Input) : SV_TARGET0
67
67
Chromaticity.rg = CColor_GetHSVfromRGB (Color).rg;
68
68
break ;
69
69
case 13 : // CoCg (XY)
70
- Chromaticity.rg = CColor_GetYCOCGfromRGB (Gamma, true ).yz + 0.5 ;
70
+ Chromaticity.rg = CColor_GetYCOCGfromRGB (Gamma, true ).yz;
71
71
break ;
72
72
case 14 : // OKLab (AB)
73
- Chromaticity.rg = CColor_GetOKLABfromRGB (Color).yz + 0.5 ;
73
+ Chromaticity.rg = CColor_GetOKLABfromRGB (Color).yz;
74
+ Chromaticity.rg = (Chromaticity.rg + 0.4 ) / 0.8 ;
74
75
break ;
75
76
case 15 : // OKLch (CH)
76
- Chromaticity.rg = CColor_GetOKLCHfromRGB (Color, true ).yz;
77
+ const float Pi2 = CMath_GetPi () * 2.0 ;
78
+ Chromaticity.rg = CColor_GetOKLCHfromRGB (Color).yz;
79
+ Chromaticity.r /= length (float2 (0.4 , 0.4 ));
80
+ Chromaticity.g /= Pi2;
77
81
break ;
78
82
default : // No Chromaticity
79
83
Chromaticity.rgb = 0.0 ;
Original file line number Diff line number Diff line change 393
393
return LMS;
394
394
}
395
395
396
- float3 CColor_GetOKLCHfromOKLAB (float3 OKLab, bool Normalize )
396
+ float3 CColor_GetOKLCHfromOKLAB (float3 OKLab)
397
397
{
398
- const float Pi2 = CMath_GetPi () * 2.0 ;
399
398
float3 OKLch = 0.0 ;
400
399
OKLch.x = OKLab.x;
401
400
OKLch.y = length (OKLab.yz);
402
401
OKLch.z = atan2 (OKLab.z, OKLab.y);
403
- OKLch.z = (Normalize) ? OKLch.z / Pi2 : OKLch.z;
404
402
return OKLch;
405
403
}
406
404
413
411
return OKLab;
414
412
}
415
413
416
- float3 CColor_GetOKLCHfromRGB (float3 Color, bool Normalize )
414
+ float3 CColor_GetOKLCHfromRGB (float3 Color)
417
415
{
418
- return CColor_GetOKLCHfromOKLAB (CColor_GetOKLABfromRGB (Color), Normalize );
416
+ return CColor_GetOKLCHfromOKLAB (CColor_GetOKLABfromRGB (Color));
419
417
}
420
418
421
419
float3 CColor_GetRGBfromOKLCH (float3 OKLch)
569
567
Color.y += Tint;
570
568
571
569
// Convert OKLab to OKLch
572
- Color = CColor_GetOKLCHfromOKLAB (Color, false );
570
+ Color = CColor_GetOKLCHfromOKLAB (Color);
573
571
574
572
// Apply lightness
575
573
Color.x *= Lightness;
You can’t perform that action at this time.
0 commit comments