]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fix most Q3 & QL glow maps
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 25 May 2020 13:51:59 +0000 (13:51 +0000)
committerRudolf Polzer <divVerent@gmail.com>
Wed, 17 Mar 2021 13:39:08 +0000 (06:39 -0700)
From bones_was_here: "Very few glow maps work in unmodified Q3 maps as they do not use the _glow darkplaces convention, instead Q3 shaders specify the file name to use which is not currently supported.
Fortunately there is a naming convention started in id software's pak0 and continued in QL and most 3rd party maps.  It uses these forms: foo_texture.blend.ext and bar_texture_blend.ext
It's not possible to fix 100% of glow maps without parsing Q3 shaders and using the specified file name, but this is a big improvement.
This also fixes a few glow maps in nexcompat, which are originally Q3 textures that were not renamed to _glow."

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12573 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=9155ce9124c0d6f63a262291a95304e20e911243

gl_rmain.c

index 522cea20c8f9d6fca6eb4ec71d2608ff3ec667bc..7b2c7ac6f95677930af4cf7c6ce79a352df1eeda 100644 (file)
@@ -3424,9 +3424,10 @@ skinframe_t *R_SkinFrame_LoadExternal(const char *name, int textureflags, qboole
        }
 
        // _luma is supported only for tenebrae compatibility
+       // _blend and .blend are supported only for Q3 & QL compatibility, this hack can be removed if better Q3 shader support is implemented
        // _glow is the preferred name
        mymiplevel = savemiplevel;
-       if (skinframe->glow == NULL && ((pixels = loadimagepixelsbgra(va(vabuf, sizeof(vabuf), "%s_glow",  skinframe->basename), false, false, false, &mymiplevel)) || (pixels = loadimagepixelsbgra(va(vabuf, sizeof(vabuf), "%s_luma", skinframe->basename), false, false, false, &mymiplevel))))
+       if (skinframe->glow == NULL && ((pixels = loadimagepixelsbgra(va(vabuf, sizeof(vabuf), "%s_glow", skinframe->basename), false, false, false, &mymiplevel)) || (pixels = loadimagepixelsbgra(va(vabuf, sizeof(vabuf), "%s.blend", skinframe->basename), false, false, false, &mymiplevel)) || (pixels = loadimagepixelsbgra(va(vabuf, sizeof(vabuf), "%s_blend", skinframe->basename), false, false, false, &mymiplevel)) || (pixels = loadimagepixelsbgra(va(vabuf, sizeof(vabuf), "%s_luma", skinframe->basename), false, false, false, &mymiplevel))))
        {
                skinframe->glow = R_LoadTexture2D (r_main_texturepool, va(vabuf, sizeof(vabuf), "%s_glow", skinframe->basename), image_width, image_height, pixels, vid.sRGB3D ? TEXTYPE_SRGB_BGRA : TEXTYPE_BGRA, textureflags & (gl_texturecompression_glow.integer && gl_texturecompression.integer ? ~0 : ~TEXF_COMPRESS), mymiplevel, NULL);
 #ifndef USE_GLES2