From aec7c7012b72c33284cd70b9aa313c6873104eb2 Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 9 Dec 2008 11:39:06 +0000 Subject: [PATCH] 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 --- gl_rmain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.39.2