17 lines
431 B
GLSL
17 lines
431 B
GLSL
/**
|
|
* Converts a linear RGB color to an sRGB color.
|
|
*
|
|
* @param {vec3|vec4} linearIn The color in linear color space.
|
|
* @returns {vec3|vec4} The color in sRGB color space. The vector type matches the input.
|
|
*/
|
|
vec3 czm_linearToSrgb(vec3 linearIn)
|
|
{
|
|
return pow(linearIn, vec3(1.0/2.2));
|
|
}
|
|
|
|
vec4 czm_linearToSrgb(vec4 linearIn)
|
|
{
|
|
vec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2));
|
|
return vec4(srgbOut, linearIn.a);
|
|
}
|