From: divverent Date: Tue, 9 Dec 2008 11:39:06 +0000 (+0000) Subject: make color averaging use 64bit integers, instead of 32bit ones, as they wrap on 512x5... X-Git-Tag: xonotic-v0.1.0preview~2005 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=aec7c7012b72c33284cd70b9aa313c6873104eb2;p=xonotic%2Fdarkplaces.git make color averaging use 64bit integers, instead of 32bit ones, as they wrap on 512x512 images git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8585 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 9ce70aa2..e9171124 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -1907,7 +1907,7 @@ skinframe_t *R_SkinFrame_Find(const char *name, int textureflags, int comparewid #define R_SKINFRAME_LOAD_AVERAGE_COLORS(cnt, getpixel) \ { \ - unsigned long avgcolor[5], wsum; \ + unsigned long long avgcolor[5], wsum; \ int pix, comp, w; \ avgcolor[0] = 0; \ avgcolor[1] = 0; \ @@ -2016,6 +2016,7 @@ skinframe_t *R_SkinFrame_LoadExternal_CheckAlpha(const char *name, int texturefl } R_SKINFRAME_LOAD_AVERAGE_COLORS(basepixels_width * basepixels_height, basepixels[4 * pix + comp]); + //Con_Printf("Texture %s has average colors %f %f %f alpha %f\n", name, skinframe->avgcolor[0], skinframe->avgcolor[1], skinframe->avgcolor[2], skinframe->avgcolor[3]); // _norm is the name used by tenebrae and has been adopted as standard if (loadnormalmap)