From: havoc Date: Mon, 23 Apr 2007 19:39:18 +0000 (+0000) Subject: modified Mod_LoadSkinFrame to not attempt to generate a fogging mask if X-Git-Tag: xonotic-v0.1.0preview~3277 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a87383b8e9eb3e1c47a62db9c8a3120eb073b8d3;p=xonotic%2Fdarkplaces.git modified Mod_LoadSkinFrame to not attempt to generate a fogging mask if not given the TEXF_ALPHA flag (in which case the fog mask would not be used anyway) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7160 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_shared.c b/model_shared.c index 090c93d1..a796f3f7 100644 --- a/model_shared.c +++ b/model_shared.c @@ -1070,22 +1070,25 @@ int Mod_LoadSkinFrame(skinframe_t *skinframe, const char *basename, int texturef basepixels_height = image_height; skinframe->base = R_LoadTexture2D (loadmodel->texturepool, basename, basepixels_width, basepixels_height, basepixels, TEXTYPE_RGBA, textureflags, NULL); - for (j = 3;j < basepixels_width * basepixels_height * 4;j += 4) - if (basepixels[j] < 255) - break; - if (j < basepixels_width * basepixels_height * 4) + if (textureflags & TEXF_ALPHA) { - // has transparent pixels - pixels = (unsigned char *)Mem_Alloc(loadmodel->mempool, image_width * image_height * 4); - for (j = 0;j < image_width * image_height * 4;j += 4) + for (j = 3;j < basepixels_width * basepixels_height * 4;j += 4) + if (basepixels[j] < 255) + break; + if (j < basepixels_width * basepixels_height * 4) { - pixels[j+0] = 255; - pixels[j+1] = 255; - pixels[j+2] = 255; - pixels[j+3] = basepixels[j+3]; + // has transparent pixels + pixels = (unsigned char *)Mem_Alloc(loadmodel->mempool, image_width * image_height * 4); + for (j = 0;j < image_width * image_height * 4;j += 4) + { + pixels[j+0] = 255; + pixels[j+1] = 255; + pixels[j+2] = 255; + pixels[j+3] = basepixels[j+3]; + } + skinframe->fog = R_LoadTexture2D (loadmodel->texturepool, va("%s_mask", basename), image_width, image_height, pixels, TEXTYPE_RGBA, textureflags, NULL); + Mem_Free(pixels); } - skinframe->fog = R_LoadTexture2D (loadmodel->texturepool, va("%s_mask", basename), image_width, image_height, pixels, TEXTYPE_RGBA, textureflags, NULL); - Mem_Free(pixels); } // _luma is supported for tenebrae compatibility