]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
make sRGB conversions match entirely with GL_EXT_texture_sRGB spec
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 21 Oct 2011 10:12:43 +0000 (10:12 +0000)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 21 Oct 2011 11:34:14 +0000 (13:34 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11454 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=3f7c2dc6deafcfca2aadf029224435ff44725646

image.h

diff --git a/image.h b/image.h
index 8c501c0dafd30c1f69e89a7efed10e04c3fc69ef..1bca793cb7cd8855be1edb4cc5444615746aa0e9 100644 (file)
--- 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);