MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / SRGBToLinear

Function SRGBToLinear

SampleFramework11/v1.02/SF11_Math.h:592–603  ·  view source on GitHub ↗

sRGB -> linear conversion

Source from the content-addressed store, hash-verified

590
591// sRGB -> linear conversion
592inline Float3 SRGBToLinear(Float3 color)
593{
594 Float3 x = color / 12.92f;
595 Float3 y = Pow((color + 0.055f) / 1.055f, 2.4f);
596
597 Float3 clr = color;
598 clr.x = color.x <= 0.04045f ? x.x : y.x;
599 clr.y = color.y <= 0.04045f ? x.y : y.y;
600 clr.z = color.z <= 0.04045f ? x.z : y.z;
601
602 return clr;
603}
604
605inline float ComputeLuminance(Float3 color)
606{

Callers

nothing calls this directly

Calls 1

PowFunction · 0.70

Tested by

no test coverage detected