- made adjustments to the texture loading code to account for the recent changes to handle long texture names.

This commit is contained in:
Christoph Oelckers 2014-05-15 19:27:22 +02:00
parent 4e64ad847b
commit 03d4f23a6e
5 changed files with 14 additions and 49 deletions

View File

@ -141,14 +141,7 @@ FTexture * LoadSkin(const char * path, const char * fn)
int texlump = FindGFXFile(buffer); int texlump = FindGFXFile(buffer);
if (texlump>=0) if (texlump>=0)
{ {
FTextureID texno = TexMan.FindTextureByLumpNum(texlump); return TexMan.FindTexture(Wads.GetLumpFullName(texlump), FTexture::TEX_Any, FTextureManager::TEXMAN_TryAny);
if (!texno.isValid())
{
FTexture *tex = FTexture::CreateTexture("", texlump, FTexture::TEX_Override);
TexMan.AddTexture(tex);
return tex;
}
return TexMan[texno];
} }
else else
{ {

View File

@ -855,7 +855,7 @@ void FMaterial::Bind(int cm, int clampmode, int translation, int overrideshader)
FTexture *layer; FTexture *layer;
if (mTextureLayers[i].animated) if (mTextureLayers[i].animated)
{ {
FTextureID id = mTextureLayers[i].texture->GetID(); FTextureID id = mTextureLayers[i].texture->id;
layer = TexMan(id); layer = TexMan(id);
ValidateSysTexture(layer, false); ValidateSysTexture(layer, false);
} }

View File

@ -205,15 +205,13 @@ void gl_ParseVavoomSkybox()
sc.MustGetString(); sc.MustGetString();
maplump = Wads.CheckNumForFullName(sc.String, true); 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); FTexture *tex = TexMan.FindTexture(sc.String, FTexture::TEX_Wall, FTextureManager::TEXMAN_TryAny);
if (!tex.isValid()) 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("}"); sc.MustGetStringName("}");
} }
facecount++; facecount++;

View File

@ -696,8 +696,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
bool disable_fullbright=false; bool disable_fullbright=false;
bool thiswad = false; bool thiswad = false;
bool iwad = false; bool iwad = false;
int maplump = -1; FTexture *bmtex = NULL;
FString maplumpname;
sc.MustGetString(); sc.MustGetString();
if (sc.Compare("texture")) type = FTexture::TEX_Wall; if (sc.Compare("texture")) type = FTexture::TEX_Wall;
@ -734,17 +733,15 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
{ {
sc.MustGetString(); sc.MustGetString();
if (maplump >= 0) if (bmtex != NULL)
{ {
Printf("Multiple brightmap definitions in texture %s\n", tex? tex->Name : "(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)"); Printf("Brightmap '%s' not found in texture '%s'\n", sc.String, tex? tex->Name : "(null)");
maplumpname = sc.String;
} }
} }
if (!tex) if (!tex)
@ -764,7 +761,7 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
if (!useme) return; if (!useme) return;
} }
if (maplump != -1) if (bmtex != NULL)
{ {
if (tex->bWarped != 0) if (tex->bWarped != 0)
{ {
@ -772,31 +769,8 @@ void gl_ParseBrightmap(FScanner &sc, int deflump)
return; return;
} }
// Brightmap textures are stored in the texture manager so that multiple bmtex->gl_info.bBrightmap = true;
// instances of the same textures can be avoided. tex->gl_info.Brightmap = bmtex;
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;
} }
tex->gl_info.bBrightmapDisablesFullbright = disable_fullbright; tex->gl_info.bBrightmapDisablesFullbright = disable_fullbright;
} }

View File

@ -183,7 +183,7 @@ void CheckBench()
FString compose; FString compose;
compose.Format("Map %s: \"%s\",\nx = %1.4f, y = %1.4f, z = %1.4f, angle = %1.4f, pitch = %1.4f\n", 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)); ANGLE_TO_FLOAT(viewangle), ANGLE_TO_FLOAT(viewpitch));
AppendRenderStats(compose); AppendRenderStats(compose);