diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index 6b4edcb9d..a055523fc 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -69,6 +69,7 @@ CUSTOM_CVAR(Bool, gl_notexturefill, false, 0) void gl_CreateSections(); +void AddAutoBrightmaps(); //----------------------------------------------------------------------------- // @@ -364,6 +365,7 @@ void gl_RecalcVertexHeights(vertex_t * v) void gl_InitData() { AdjustSpriteOffsets(); + AddAutoBrightmaps(); } //========================================================================== diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index fbed6b383..63e29d240 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -665,11 +665,13 @@ void gl_ParseBrightmap(FScanner &sc, int deflump) if (bmtex != NULL) { + /* I do not think this is needed any longer if (tex->bWarped != 0) { Printf("Cannot combine warping with brightmap on texture '%s'\n", tex->Name.GetChars()); return; } + */ bmtex->bMasked = false; tex->gl_info.Brightmap = bmtex; @@ -677,6 +679,33 @@ void gl_ParseBrightmap(FScanner &sc, int deflump) tex->gl_info.bDisableFullbright = disable_fullbright; } +//========================================================================== +// +// +// +//========================================================================== + +void AddAutoBrightmaps() +{ + int num = Wads.GetNumLumps(); + for (unsigned i = 0; i < num; i++) + { + const char *name = Wads.GetLumpFullName(i); + if (strstr(name, "brightmaps/auto/") == name) + { + TArray list; + FString texname = ExtractFileBase(name, false); + TexMan.ListTextures(texname, list); + auto bmtex = TexMan.FindTexture(name, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny); + for (auto texid : list) + { + bmtex->bMasked = false; + TexMan[texid]->gl_info.Brightmap = bmtex; + } + } + } +} + //========================================================================== // // Parses a GLBoom+ detail texture definition