From 03d4f23a6e94b9c6d89ac3dcea2b187014d1384c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 15 May 2014 19:27:22 +0200 Subject: [PATCH] - made adjustments to the texture loading code to account for the recent changes to handle long texture names. --- src/gl/models/gl_models.cpp | 9 +------ src/gl/textures/gl_material.cpp | 2 +- src/gl/textures/gl_skyboxtexture.cpp | 10 +++---- src/gl/textures/gl_texture.cpp | 40 +++++----------------------- src/gl/utility/gl_clock.cpp | 2 +- 5 files changed, 14 insertions(+), 49 deletions(-) diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index 39668cd02..808cbff95 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -141,14 +141,7 @@ FTexture * LoadSkin(const char * path, const char * fn) int texlump = FindGFXFile(buffer); if (texlump>=0) { - FTextureID texno = TexMan.FindTextureByLumpNum(texlump); - if (!texno.isValid()) - { - FTexture *tex = FTexture::CreateTexture("", texlump, FTexture::TEX_Override); - TexMan.AddTexture(tex); - return tex; - } - return TexMan[texno]; + return TexMan.FindTexture(Wads.GetLumpFullName(texlump), FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny); } else { diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 9cb3ef523..008e6e8cd 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -855,7 +855,7 @@ void FMaterial::Bind(int cm, int clampmode, int translation, int overrideshader) FTexture *layer; if (mTextureLayers[i].animated) { - FTextureID id = mTextureLayers[i].texture->GetID(); + FTextureID id = mTextureLayers[i].texture->id; layer = TexMan(id); ValidateSysTexture(layer, false); } diff --git a/src/gl/textures/gl_skyboxtexture.cpp b/src/gl/textures/gl_skyboxtexture.cpp index f9918dff2..2db39c7a0 100644 --- a/src/gl/textures/gl_skyboxtexture.cpp +++ b/src/gl/textures/gl_skyboxtexture.cpp @@ -205,15 +205,13 @@ void gl_ParseVavoomSkybox() sc.MustGetString(); maplump = Wads.CheckNumForFullName(sc.String, true); - if (maplump==-1) - Printf("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->Name); - FTextureID tex = TexMan.FindTextureByLumpNum(maplump); - if (!tex.isValid()) + FTexture *tex = TexMan.FindTexture(sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_TryAny); + if (tex != NULL) { - tex = TexMan.CreateTexture(maplump, FTexture::TEX_MiscPatch); + Printf("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->Name); } - sb->faces[facecount] = TexMan[tex]; + sb->faces[facecount] = tex; sc.MustGetStringName("}"); } facecount++; diff --git a/src/gl/textures/gl_texture.cpp b/src/gl/textures/gl_texture.cpp index 68c33f125..29cafe27b 100644 --- a/src/gl/textures/gl_texture.cpp +++ b/src/gl/textures/gl_texture.cpp @@ -696,8 +696,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump) bool disable_fullbright=false; bool thiswad = false; bool iwad = false; - int maplump = -1; - FString maplumpname; + FTexture *bmtex = NULL; sc.MustGetString(); if (sc.Compare("texture")) type = FTexture::TEX_Wall; @@ -734,17 +733,15 @@ void gl_ParseBrightmap(FScanner &sc, int deflump) { sc.MustGetString(); - if (maplump >= 0) + if (bmtex != NULL) { Printf("Multiple brightmap definitions in texture %s\n", tex? tex->Name : "(null)"); } - maplump = Wads.CheckNumForFullName(sc.String, true); + bmtex = TexMan.FindTexture(sc.String, FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny); - if (maplump==-1) + if (bmtex == NULL) Printf("Brightmap '%s' not found in texture '%s'\n", sc.String, tex? tex->Name : "(null)"); - - maplumpname = sc.String; } } if (!tex) @@ -764,7 +761,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump) if (!useme) return; } - if (maplump != -1) + if (bmtex != NULL) { if (tex->bWarped != 0) { @@ -772,31 +769,8 @@ void gl_ParseBrightmap(FScanner &sc, int deflump) return; } - // Brightmap textures are stored in the texture manager so that multiple - // instances of the same textures can be avoided. - FTexture *brightmap; - FTextureID brightmapId = TexMan.FindTextureByLumpNum(maplump); - - if (!brightmapId.isValid()) - { - // a texture for this lump has not been created yet. - brightmap = FTexture::CreateTexture(maplump, tex->UseType); - if (!brightmap) - { - Printf("Unable to create texture from '%s' in brightmap definition for '%s'\n", - maplumpname.GetChars(), tex->Name); - return; - } - brightmap->gl_info.bBrightmap = true; - brightmap->Name[0] = 0; // brightmaps don't have names - TexMan.AddTexture(brightmap); - } - else - { - brightmap = TexMan[brightmapId]; - } - - tex->gl_info.Brightmap = brightmap; + bmtex->gl_info.bBrightmap = true; + tex->gl_info.Brightmap = bmtex; } tex->gl_info.bBrightmapDisablesFullbright = disable_fullbright; } diff --git a/src/gl/utility/gl_clock.cpp b/src/gl/utility/gl_clock.cpp index 7ad32f8ee..7759f5582 100644 --- a/src/gl/utility/gl_clock.cpp +++ b/src/gl/utility/gl_clock.cpp @@ -183,7 +183,7 @@ void CheckBench() FString compose; compose.Format("Map %s: \"%s\",\nx = %1.4f, y = %1.4f, z = %1.4f, angle = %1.4f, pitch = %1.4f\n", - level.mapname, level.LevelName.GetChars(), FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz), + level.MapName.GetChars(), level.LevelName.GetChars(), FIXED2FLOAT(viewx), FIXED2FLOAT(viewy), FIXED2FLOAT(viewz), ANGLE_TO_FLOAT(viewangle), ANGLE_TO_FLOAT(viewpitch)); AppendRenderStats(compose);