Correct case for file.

Signed-off-by: Robin <rbarrand@amazon.com>
Signed-off-by: rbarrand <rbarrand@amazon.com>
This commit is contained in:
Robin
2021-09-13 22:51:55 -07:00
committed by rbarrand
parent 22dd71739f
commit 580716bef6
@@ -1,75 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: (Apache-2.0 OR MIT) AND Creative Commons 3.0
*
*/
// Ref: https://www.shadertoy.com/view/lsSXW1
// ported by Renaud Bédard (@renaudbedard) from original code from Tanner Helland
// http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
// color space functions translated from HLSL versions on Chilli Ant (by Ian Taylor)
// http://www.chilliant.com/rgb2hsv.html
// licensed and released under Creative Commons 3.0 Attribution
// https://creativecommons.org/licenses/by/3.0/
float3 HueToRgb(float hue)
{
return saturate(float3(abs(hue * 6.0f - 3.0f) - 1.0f,
2.0f - abs(hue * 6.0f - 2.0f),
2.0f - abs(hue * 6.0f - 4.0f)));
}
float3 RgbToHcv(float3 rgb)
{
// Based on work by Sam Hocevar and Emil Persson
const float4 p = (rgb.g < rgb.b) ? float4(rgb.bg, -1.0f, 2.0f/3.0f) : float4(rgb.gb, 0.0f, -1.0f/3.0f);
const float4 q1 = (rgb.r < p.x) ? float4(p.xyw, rgb.r) : float4(rgb.r, p.yzx);
const float c = q1.x - min(q1.w, q1.y);
const float h = abs((q1.w - q1.y) / (6.0f * c + 0.000001f ) + q1.z);
return float3(h, c, q1.x);
}
float3 RgbToHsl(float3 rgb)
{
rgb.xyz = max(rgb.xyz, 0.000001f);
const float3 hcv = RgbToHcv(rgb);
const float L = hcv.z - hcv.y * 0.5f;
const float S = hcv.y / (1.0f - abs(L * 2.0f - 1.0f) + 0.000001f);
return float3(hcv.x, S, L);
}
float3 HslToRgb(float3 hsl)
{
const float3 rgb = HueToRgb(hsl.x);
const float c = (1.0f - abs(2.0f * hsl.z - 1.0f)) * hsl.y;
return (rgb - 0.5f) * c + hsl.z;
}
// Color temperature
float3 KelvinToRgb(float kelvin)
{
float3 ret;
kelvin = clamp(kelvin, 1000.0f, 40000.0f) / 100.0f;
if(kelvin <= 66.0f)
{
ret.r = 1.0f;
ret.g = saturate(0.39008157876901960784f * log(kelvin) - 0.63184144378862745098f);
}
else
{
float t = max(kelvin - 60.0f, 0.0f);
ret.r = saturate(1.29293618606274509804f * pow(t, -0.1332047592f));
ret.g = saturate(1.12989086089529411765f * pow(t, -0.0755148492f));
}
if(kelvin >= 66.0f)
ret.b = 1.0f;
else if(kelvin < 19.0f)
ret.b = 0.0f;
else
ret.b = saturate(0.54320678911019607843f * log(kelvin - 10.0f) - 1.19625408914f);
return ret;
}