X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=image.c;h=92bfd18e9cd98a670fdd225915dcca4d3f5b5721;hp=cf6efab62efab753394587b5baa717a049c7ea21;hb=b6958185ecd637a78cccd19d9a02e8bbcb1630bd;hpb=b018e08eb7e80777e4a82ab90091ad284c080424 diff --git a/image.c b/image.c index cf6efab6..92bfd18e 100644 --- a/image.c +++ b/image.c @@ -604,6 +604,8 @@ qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth, int i; qbyte *f, *data = NULL; char basename[MAX_QPATH], name[MAX_QPATH], *c; + if (developer_memorydebug.integer) + Mem_CheckSentinelsGlobal(); Image_StripImageExtension(filename, basename); // strip filename extensions to allow replacement by other types // replace *'s with #, so commandline utils don't get confused when dealing with the external files for (c = basename;*c;c++) @@ -616,6 +618,8 @@ qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth, { Mem_Free(f); Con_DPrintf("loaded image %s (%dx%d)\n", name, image_width, image_height); + if (developer_memorydebug.integer) + Mem_CheckSentinelsGlobal(); return data; } } @@ -628,6 +632,8 @@ qbyte *loadimagepixels (const char *filename, qboolean complain, int matchwidth, Con_Printf (i == 0 ? "\"%s\"" : (imageformats[i+1].formatstring ? ", \"%s\"" : " or \"%s\".\n"), imageformats[i].formatstring); } } + if (developer_memorydebug.integer) + Mem_CheckSentinelsGlobal(); return NULL; } @@ -1389,7 +1395,7 @@ void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *ou /* dv[0][0] = iwidth; dv[0][1] = 0; - dv[0][2] = ((p1[0] + p1[1] + p1[2]) * ibumpscale) - ((p0[0] + p0[1] + p0[2]) * ibumpscale); + dv[0][2] = ((p0[0] + p0[1] + p0[2]) * ibumpscale) - ((p1[0] + p1[1] + p1[2]) * ibumpscale); dv[1][0] = 0; dv[1][1] = iheight; dv[1][2] = ((p2[0] + p2[1] + p2[2]) * ibumpscale) - ((p0[0] + p0[1] + p0[2]) * ibumpscale); @@ -1397,14 +1403,14 @@ void Image_HeightmapToNormalmap(const unsigned char *inpixels, unsigned char *ou n[1] = dv[0][2]*dv[1][0]-dv[0][0]*dv[1][2]; n[2] = dv[0][0]*dv[1][1]-dv[0][1]*dv[1][0]; */ - n[0] = ((p0[0] + p0[1] + p0[2]) - (p1[0] + p1[1] + p1[2])); + n[0] = ((p1[0] + p1[1] + p1[2]) - (p0[0] + p0[1] + p0[2])); n[1] = ((p0[0] + p0[1] + p0[2]) - (p2[0] + p2[1] + p2[2])); n[2] = ibumpscale; VectorNormalize(n); /* // this should work for the bottom right triangle if anyone wants // code for that for some reason - n[0] = ((p1[0] + p1[1] + p1[2]) - (p3[0] + p3[1] + p3[2])); + n[0] = ((p3[0] + p3[1] + p3[2]) - (p1[0] + p1[1] + p1[2])); n[1] = ((p2[0] + p2[1] + p2[2]) - (p3[0] + p3[1] + p3[2])); n[2] = ibumpscale; VectorNormalize(n);