From: divverent Date: Tue, 6 Sep 2011 17:26:51 +0000 (+0000) Subject: DDS support: convert DXT3/DXT5 to DXT1 when requesting non-alpha (correctness) X-Git-Tag: xonotic-v0.6.0~163^2~225 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=dc4219418b6d44180d5b467189262d79d0b99d14 DDS support: convert DXT3/DXT5 to DXT1 when requesting non-alpha (correctness) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11327 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_textures.c b/gl_textures.c index 180447ff..3a5b20fc 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -2199,6 +2199,18 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen return NULL; } + // when requesting a non-alpha texture and we have DXT3/5, convert to DXT1 + if(!(flags & TEXF_ALPHA) && (textype == TEXTYPE_DXT3 || textype == TEXTYPE_DXT5)) + { + textype = TEXTYPE_DXT1; + bytesperblock = 8; + ddssize -= 128; + ddssize /= 2; + for (i = 0;i < ddssize;i += bytesperblock) + memcpy(&ddspixels[i], &ddspixels[(i<<1)+8], 8); + ddssize += 128; + } + force_swdecode = false; if(bytesperblock) {