Remove toLinearVec3 from ColorUtils

toGamma22Vec3 should probably stay since that is a valid conversion from linear to a gamma space of 2.2.
This commit is contained in:
Geenz 2016-04-26 17:00:59 -04:00
parent a1171a33fd
commit ae5ef6d948

View file

@ -21,8 +21,7 @@ class ColorUtils {
public:
inline static glm::vec3 toVec3(const xColor& color);
// Convert from gamma 2.2 space to linear
inline static glm::vec3 toLinearVec3(const glm::vec3& srgb);
// Convert to gamma 2.2 space from linear
inline static glm::vec3 toGamma22Vec3(const glm::vec3& linear);
// Convert from sRGB gamma space to linear.
@ -42,12 +41,6 @@ inline glm::vec3 ColorUtils::toVec3(const xColor& color) {
return glm::vec3(color.red * ONE_OVER_255, color.green * ONE_OVER_255, color.blue * ONE_OVER_255);
}
inline glm::vec3 ColorUtils::toLinearVec3(const glm::vec3& srgb) {
const float GAMMA_22 = 2.2f;
// Couldn't find glm::pow(vec3, vec3) ? so did it myself...
return glm::vec3(glm::pow(srgb.x, GAMMA_22), glm::pow(srgb.y, GAMMA_22), glm::pow(srgb.z, GAMMA_22));
}
inline glm::vec3 ColorUtils::toGamma22Vec3(const glm::vec3& linear) {
const float INV_GAMMA_22 = 1.0f / 2.2f;
// Couldn't find glm::pow(vec3, vec3) ? so did it myself...