From bde73fc530fc54397c090da48ca631f9fb921516 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 29 Mar 2017 23:13:11 +0200 Subject: [PATCH] - added automatic brightmaps. Everything in the brightmaps/auto directory will automatically be assigned to the same-named texture. --- src/gl/data/gl_data.cpp | 2 ++ src/gl/textures/gl_texture.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) 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