From 002787a482e047e644ee84ff07611fa7ddbf950f Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 21 Oct 2011 10:12:43 +0000 Subject: [PATCH] make sRGB conversions match entirely with GL_EXT_texture_sRGB spec git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11454 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=3f7c2dc6deafcfca2aadf029224435ff44725646 --- image.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/image.h b/image.h index 8c501c0d..1bca793c 100644 --- a/image.h +++ b/image.h @@ -49,8 +49,8 @@ void Image_HeightmapToNormalmap_BGRA(const unsigned char *inpixels, unsigned cha void Image_FixTransparentPixels_f(void); extern cvar_t r_fixtrans_auto; -#define Image_LinearFloatFromsRGB(c) (((c) < 11) ? (c) * 0.000302341331f : (float)pow(((c)*(1.0f/256.0f) + 0.055f)*(1.0f/1.0555f), 2.4f)) -#define Image_sRGBFloatFromLinear(c) (((c) < 1) ? (c) * 0.05046875f : 1.055f * (float)pow((c)*(1.0f/256.0f), 1.0f/2.4f) - 0.055f) +#define Image_LinearFloatFromsRGB(c) (((c) <= 10.3552f) ? (c) * 0.000302341331f : (float)pow(((c)*(1.0f/256.0f) + 0.055f)*(1.0f/1.0555f), 2.4f)) +#define Image_sRGBFloatFromLinear(c) (((c) < 0.8014848f) ? (c) * 0.05046875f : 1.055f * (float)pow((c)*(1.0f/256.0f), 1.0f/2.4f) - 0.055f) #define Image_sRGBFloatFromLinear_Lightmap(c) (Image_sRGBFloatFromLinear(c*2.0f)*0.5f) void Image_MakeLinearColorsFromsRGB(unsigned char *pout, const unsigned char *pin, int numpixels); -- 2.39.2