Trying to mix the colors in gl_rmain.c for textureavg +pants shirt in showsurfaces3
MayEpper created issue xonotic-data.pk3dir#1376 (closed) on 2013-01-09T06:40:19Z:
Sometimes a base texture is some color other than white/gray, I was trying to mix that in when coming up with the color of a model in r_showsurfaces 3 but it’s not working correctly. what’s the right way to do it?
in static void R_DrawTextureSurfaceList_ShowSurfaces the regular way only takes into account the pants and shirt color: if (rsurface.texture~~>pantstexture || rsurface.texture~~>shirttexture) { c[0] = 0.5 * (rsurface.colormap_pantscolor[0] * 0.3 + rsurface.colormap_shirtcolor[0] * 0.7); c[1] = 0.5 * (rsurface.colormap_pantscolor[1] * 0.3 + rsurface.colormap_shirtcolor[1] * 0.7); c[2] = 0.5 * (rsurface.colormap_pantscolor[2] * 0.3 + rsurface.colormap_shirtcolor[2] * 0.7); }
I tried various ways but they don’t work right when underlying texture is not white/gray/black:
if (rsurface.texture~~>pantstexture || rsurface.texture~~>shirttexture) { c[0] = (rsurface.texture~~>currentskinframe~~>avgcolor[0]*0.25) + (0.25 * (rsurface.colormap_pantscolor[0] * 0.3 + rsurface.colormap_shirtcolor[0] * 0.7)); c[1] = (rsurface.texture~~>currentskinframe~~>avgcolor[0]*0.25) + (0.25 * (rsurface.colormap_pantscolor[1] * 0.3 + rsurface.colormap_shirtcolor[1] * 0.7)); c[2] = (rsurface.texture~~>currentskinframe~~>avgcolor[0]*0.25) + (0.25 * (rsurface.colormap_pantscolor[2] * 0.3 + rsurface.colormap_shirtcolor[2] * 0.7)); }
What is the correct way to do this?