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

Function SRGBToLinear

SampleFramework12/v1.00/SF12_Math.h:640–651  ·  view source on GitHub ↗

sRGB -> linear conversion

Source from the content-addressed store, hash-verified

638
639// sRGB -> linear conversion
640inline Float3 SRGBToLinear(Float3 color)
641{
642 Float3 x = color / 12.92f;
643 Float3 y = Pow((color + 0.055f) / 1.055f, 2.4f);
644
645 Float3 clr = color;
646 clr.x = color.x <= 0.04045f ? x.x : y.x;
647 clr.y = color.y <= 0.04045f ? x.y : y.y;
648 clr.z = color.z <= 0.04045f ? x.z : y.z;
649
650 return clr;
651}
652
653inline float ComputeLuminance(Float3 color)
654{

Callers

nothing calls this directly

Calls 1

PowFunction · 0.70

Tested by

no test coverage detected