- moved the texture name to FGameTexture.

This commit is contained in:
Christoph Oelckers 2020-04-18 01:00:38 +02:00
parent 7dd108c960
commit 718949f74d
20 changed files with 69 additions and 93 deletions

View file

@ -327,14 +327,14 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
}
auto orig = pic->GetTexture();
auto tex = MakeGameTexture(orig, ETextureType::FontChar);
auto tex = MakeGameTexture(orig, nullptr, ETextureType::FontChar);
tex->CopySize(pic);
TexMan.AddGameTexture(tex);
Chars[i].OriginalPic = tex;
if (!noTranslate)
{
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1(orig->GetImage()), ""), ETextureType::FontChar);
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1(orig->GetImage())), nullptr, ETextureType::FontChar);
Chars[i].TranslatedPic->CopySize(pic);
TexMan.AddGameTexture(Chars[i].TranslatedPic);
}
@ -410,14 +410,14 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
part[0].OriginY = -height * y;
part[0].Image = tex->GetTexture()->GetImage();
FMultiPatchTexture *image = new FMultiPatchTexture(width, height, part, false, false);
FImageTexture *tex = new FImageTexture(image, "");
FImageTexture *tex = new FImageTexture(image);
tex->bMultiPatch = true;
tex->bMasked = true;
tex->bTranslucent = -1;
tex->bWorldPanning = true;
tex->bNoDecals = false;
tex->SourceLump = -1; // We do not really care.
auto gtex = MakeGameTexture(tex, ETextureType::FontChar);
auto gtex = MakeGameTexture(tex, nullptr, ETextureType::FontChar);
gtex->SetOffsets(0, 0, 0);
gtex->SetOffsets(1, 0, 0);
gtex->SetScale((float)Scale.X, (float)Scale.Y);
@ -451,10 +451,10 @@ void FFont::ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height
auto b = pic->Get8BitPixels(false);
Chars[i].OriginalPic = MakeGameTexture(pic, ETextureType::FontChar);
Chars[i].OriginalPic = MakeGameTexture(pic, nullptr, ETextureType::FontChar);
Chars[i].OriginalPic->SetUseType(ETextureType::FontChar);
Chars[i].OriginalPic->CopySize(*lump);
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1(pic->GetImage()), ""), ETextureType::FontChar);
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1(pic->GetImage())), nullptr, ETextureType::FontChar);
Chars[i].TranslatedPic->CopySize(*lump);
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
TexMan.AddGameTexture(Chars[i].OriginalPic);

View file

@ -289,7 +289,7 @@ public:
{
auto offset = hexdata.glyphmap[i];
int size = hexdata.glyphdata[offset] / 16;
Chars[i - FirstChar].TranslatedPic = MakeGameTexture(new FImageTexture(new FHexFontChar (&hexdata.glyphdata[offset+1], size, size * 9, 16)), ETextureType::FontChar);
Chars[i - FirstChar].TranslatedPic = MakeGameTexture(new FImageTexture(new FHexFontChar (&hexdata.glyphdata[offset+1], size, size * 9, 16)), nullptr, ETextureType::FontChar);
Chars[i - FirstChar].XMove = size * spacing;
TexMan.AddGameTexture(Chars[i - FirstChar].TranslatedPic);
}
@ -361,7 +361,7 @@ public:
{
auto offset = hexdata.glyphmap[i];
int size = hexdata.glyphdata[offset] / 16;
Chars[i - FirstChar].TranslatedPic = MakeGameTexture(new FImageTexture(new FHexFontChar2(&hexdata.glyphdata[offset + 1], size, 2 + size * 8, 18)), ETextureType::FontChar);
Chars[i - FirstChar].TranslatedPic = MakeGameTexture(new FImageTexture(new FHexFontChar2(&hexdata.glyphdata[offset + 1], size, 2 + size * 8, 18)), nullptr, ETextureType::FontChar);
Chars[i - FirstChar].XMove = size * spacing;
TexMan.AddGameTexture(Chars[i - FirstChar].TranslatedPic);
}

View file

@ -353,7 +353,7 @@ void FSingleLumpFont::LoadFON2 (int lump, const uint8_t *data)
}
else
{
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar2 (lump, int(data_p - data), widths2[i], FontHeight)), ETextureType::FontChar);
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar2 (lump, int(data_p - data), widths2[i], FontHeight)), nullptr, ETextureType::FontChar);
TexMan.AddGameTexture(Chars[i].TranslatedPic);
do
{
@ -487,7 +487,7 @@ void FSingleLumpFont::LoadBMF(int lump, const uint8_t *data)
chardata[chari+2], // height
-(int8_t)chardata[chari+3], // x offset
-(int8_t)chardata[chari+4] // y offset
)), ETextureType::FontChar);
)), nullptr, ETextureType::FontChar);
Chars[chardata[chari] - FirstChar].TranslatedPic = tex;
TexMan.AddGameTexture(tex);
}
@ -554,7 +554,7 @@ void FSingleLumpFont::CheckFON1Chars (double *luminosity)
if(!Chars[i].TranslatedPic)
{
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar2 (Lump, int(data_p - data), SpaceWidth, FontHeight)), ETextureType::FontChar);
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar2 (Lump, int(data_p - data), SpaceWidth, FontHeight)), nullptr, ETextureType::FontChar);
Chars[i].XMove = SpaceWidth;
TexMan.AddGameTexture(Chars[i].TranslatedPic);
}

View file

@ -104,13 +104,13 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture
if (charlumps[i] != nullptr)
{
auto pic = charlumps[i];
Chars[i].OriginalPic = MakeGameTexture(pic->GetTexture(), ETextureType::FontChar);
Chars[i].OriginalPic = MakeGameTexture(pic->GetTexture(), nullptr, ETextureType::FontChar);
Chars[i].OriginalPic->CopySize(pic);
TexMan.AddGameTexture(Chars[i].OriginalPic);
if (!noTranslate)
{
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1 (charlumps[i]->GetTexture()->GetImage()), ""), ETextureType::FontChar);
Chars[i].TranslatedPic = MakeGameTexture(new FImageTexture(new FFontChar1 (charlumps[i]->GetTexture()->GetImage())), nullptr, ETextureType::FontChar);
Chars[i].TranslatedPic->CopySize(charlumps[i]);
TexMan.AddGameTexture(Chars[i].TranslatedPic);
}

View file

@ -609,7 +609,7 @@ FGameTexture *PNGTexture_CreateFromFile(PNGHandle *png, const FString &filename)
// Reject anything that cannot be put into a savegame picture by GZDoom itself.
if (compression != 0 || filter != 0 || interlace > 0 || bitdepth != 8 || (colortype != 2 && colortype != 3)) return nullptr;
else return MakeGameTexture(new FPNGFileTexture (png->File, width, height, colortype), ETextureType::Override);
else return MakeGameTexture(new FPNGFileTexture (png->File, width, height, colortype), nullptr, ETextureType::Override);
}
//==========================================================================

View file

@ -132,6 +132,6 @@ private:
FGameTexture *CreateShaderTexture(bool vertical, bool reverse)
{
FStringf name("BarShader%c%c", vertical ? 'v' : 'h', reverse ? 'r' : 'f');
return MakeGameTexture(CreateImageTexture(new FBarShader(vertical, reverse), name.GetChars()), ETextureType::Override);
return MakeGameTexture(CreateImageTexture(new FBarShader(vertical, reverse)), name.GetChars(), ETextureType::Override);
}

View file

@ -171,4 +171,4 @@ protected:
class FTexture;
FTexture* CreateImageTexture(FImageSource* img, const char *name = nullptr) noexcept;
FTexture* CreateImageTexture(FImageSource* img) noexcept;

View file

@ -47,13 +47,12 @@
//
//==========================================================================
FImageTexture::FImageTexture(FImageSource *img, const char *name) noexcept
: FTexture(name, img? img->LumpNum() : 0)
FImageTexture::FImageTexture(FImageSource *img) noexcept
: FTexture(img? img->LumpNum() : 0)
{
mImage = img;
if (img != nullptr)
{
if (name == nullptr) fileSystem.GetFileShortName(Name, img->LumpNum());
SetFromImage();
}
}
@ -109,8 +108,8 @@ bool FImageTexture::DetermineTranslucency()
}
FTexture* CreateImageTexture(FImageSource* img, const char *name) noexcept
FTexture* CreateImageTexture(FImageSource* img) noexcept
{
return new FImageTexture(img, name);
return new FImageTexture(img);
}

View file

@ -137,7 +137,7 @@ struct FPatchLookup
void FMultipatchTextureBuilder::MakeTexture(BuildInfo &buildinfo, ETextureType usetype)
{
FImageTexture *tex = new FImageTexture(nullptr, buildinfo.Name);
FImageTexture *tex = new FImageTexture(nullptr);
tex->bMultiPatch = true;
tex->SetSize(buildinfo.Width, buildinfo.Height);
tex->bMasked = true; // we do not really know yet.
@ -145,7 +145,7 @@ void FMultipatchTextureBuilder::MakeTexture(BuildInfo &buildinfo, ETextureType u
tex->bNoDecals = buildinfo.bNoDecals;
tex->SourceLump = buildinfo.DefinitionLump;
buildinfo.itex = tex;
buildinfo.texture = MakeGameTexture(tex, usetype);
buildinfo.texture = MakeGameTexture(tex, buildinfo.Name, usetype);
buildinfo.texture->SetOffsets(0, buildinfo.LeftOffset[0], buildinfo.TopOffset[0]);
buildinfo.texture->SetOffsets(1, buildinfo.LeftOffset[1], buildinfo.TopOffset[1]);
buildinfo.texture->SetScale((float)buildinfo.Scale.X, (float)buildinfo.Scale.X);

View file

@ -35,7 +35,7 @@
//-----------------------------------------------------------------------------
FSkyBox::FSkyBox(const char *name)
: FImageTexture(name)
: FImageTexture(nullptr)
{
FTextureID texid = TexMan.CheckForTexture(name, ETextureType::Wall);
if (texid.isValid())

View file

@ -70,20 +70,14 @@ int r_spriteadjustSW, r_spriteadjustHW;
// Examines the lump contents to decide what type of texture to create,
// and creates the texture.
FTexture * FTexture::CreateTexture(const char *name, int lumpnum, bool allowflats)
FTexture * FTexture::CreateTexture(int lumpnum, bool allowflats)
{
if (lumpnum == -1) return nullptr;
auto image = FImageSource::GetImage(lumpnum, allowflats);
if (image != nullptr)
{
FTexture *tex = new FImageTexture(image);
if (tex != nullptr)
{
tex->Name = name;
tex->Name.ToUpper();
return tex;
}
return new FImageTexture(image);
}
return nullptr;
}
@ -94,7 +88,7 @@ FTexture * FTexture::CreateTexture(const char *name, int lumpnum, bool allowflat
//
//==========================================================================
FTexture::FTexture (const char *name, int lumpnum)
FTexture::FTexture (int lumpnum)
:
SourceLump(lumpnum),
bNoDecals(false), bNoRemap0(false), bWorldPanning(false),
@ -109,21 +103,6 @@ FTexture::FTexture (const char *name, int lumpnum)
bSkybox = false;
bNoCompress = false;
bTranslucent = -1;
if (name != NULL)
{
Name = name;
Name.ToUpper();
}
else if (lumpnum < 0)
{
Name = FString();
}
else
{
fileSystem.GetFileShortName (Name, lumpnum);
}
}
FTexture::~FTexture ()
@ -971,7 +950,7 @@ FWrapperTexture::FWrapperTexture(int w, int h, int bits)
}
FGameTexture::FGameTexture(FTexture* wrap) : Base(wrap)
FGameTexture::FGameTexture(FTexture* wrap, const char *name) : Base(wrap), Name(name)
{
id.SetInvalid();
TexelWidth = Base->GetWidth();

View file

@ -230,7 +230,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, ETextureType uset
if (tex == NO_TEXTURE) return FTextureID(-1);
if (tex != NULL) return tex->GetID();
if (flags & TEXMAN_DontCreate) return FTextureID(-1); // we only want to check, there's no need to create a texture if we don't have one yet.
tex = MakeGameTexture(FTexture::CreateTexture("", lump), ETextureType::Override);
tex = MakeGameTexture(FTexture::CreateTexture(lump), nullptr, ETextureType::Override);
if (tex != NULL)
{
tex->AddAutoMaterials();
@ -421,7 +421,7 @@ FTextureID FTextureManager::CreateTexture (int lumpnum, ETextureType usetype)
{
FString str;
fileSystem.GetFileShortName(str, lumpnum);
auto out = MakeGameTexture(FTexture::CreateTexture(str, lumpnum, usetype == ETextureType::Flat), usetype);
auto out = MakeGameTexture(FTexture::CreateTexture(lumpnum, usetype == ETextureType::Flat), str, usetype);
if (out != NULL)
{
@ -470,11 +470,11 @@ void FTextureManager::ReplaceTexture (FTextureID picnum, FGameTexture *newtextur
auto oldtexture = Textures[index].Texture;
newtexture->GetTexture()->Name = oldtexture->GetName();
newtexture->SetName(oldtexture->GetName());
newtexture->SetUseType(oldtexture->GetUseType());
Textures[index].Texture = newtexture;
newtexture->SetID(oldtexture->GetID());
oldtexture->GetTexture()->Name = "";
oldtexture->SetName("");
AddGameTexture(oldtexture);
}
@ -584,7 +584,7 @@ void FTextureManager::AddHiresTextures (int wadnum)
if (amount == 0)
{
// A texture with this name does not yet exist
auto newtex = MakeGameTexture(FTexture::CreateTexture (Name, firsttx), ETextureType::Override);
auto newtex = MakeGameTexture(FTexture::CreateTexture(firsttx), Name, ETextureType::Override);
if (newtex != NULL)
{
AddGameTexture(newtex);
@ -594,13 +594,13 @@ void FTextureManager::AddHiresTextures (int wadnum)
{
for(unsigned int i = 0; i < tlist.Size(); i++)
{
FTexture * newtex = FTexture::CreateTexture ("", firsttx);
FTexture * newtex = FTexture::CreateTexture (firsttx);
if (newtex != NULL)
{
auto oldtex = Textures[tlist[i].GetIndex()].Texture;
// Replace the entire texture and adjust the scaling and offset factors.
auto gtex = MakeGameTexture(newtex, ETextureType::Override);
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
gtex->SetWorldPanning(true);
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
gtex->SetOffsets(0, xs_RoundToInt(oldtex->GetDisplayLeftOffset(0) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(0) * gtex->GetScaleY()));
@ -692,11 +692,11 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
(sl=oldtex->GetSourceLump()) >= 0 && fileSystem.GetFileNamespace(sl) == ns_sprites)
)
{
FTexture * newtex = FTexture::CreateTexture ("", lumpnum);
FTexture * newtex = FTexture::CreateTexture (lumpnum);
if (newtex != NULL)
{
// Replace the entire texture and adjust the scaling and offset factors.
auto gtex = MakeGameTexture(newtex, ETextureType::Override);
auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override);
gtex->SetWorldPanning(true);
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
gtex->SetOffsets(0, xs_RoundToInt(oldtex->GetDisplayLeftOffset(0) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(0) * gtex->GetScaleY()));
@ -730,7 +730,7 @@ void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build
if (lumpnum>=0)
{
auto newtex = MakeGameTexture(FTexture::CreateTexture(src, lumpnum), ETextureType::Override);
auto newtex = MakeGameTexture(FTexture::CreateTexture(lumpnum), src, ETextureType::Override);
if (newtex != NULL)
{
@ -950,7 +950,7 @@ void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &b
// Try to create a texture from this lump and add it.
// Unfortunately we have to look at everything that comes through here...
auto out = MakeGameTexture(FTexture::CreateTexture(Name, i), skin ? ETextureType::SkinGraphic : ETextureType::MiscPatch);
auto out = MakeGameTexture(FTexture::CreateTexture(i), Name, skin ? ETextureType::SkinGraphic : ETextureType::MiscPatch);
if (out != NULL)
{
@ -1116,11 +1116,11 @@ void FTextureManager::Init(void (*progressFunc_)(), void (*checkForHacks)(BuildI
DeleteAll();
//if (BuildTileFiles.Size() == 0) CountBuildTiles ();
auto nulltex = MakeGameTexture(new FImageTexture(CreateEmptyTexture(), ""), ETextureType::Null);
auto nulltex = MakeGameTexture(new FImageTexture(CreateEmptyTexture()), nullptr, ETextureType::Null);
AddGameTexture(nulltex);
// This is for binding to unused texture units, because accessing an unbound texture unit is undefined. It's a one pixel empty texture.
auto emptytex = MakeGameTexture(new FImageTexture(CreateEmptyTexture(), ""), ETextureType::Override);
auto emptytex = MakeGameTexture(new FImageTexture(CreateEmptyTexture()), nullptr, ETextureType::Override);
emptytex->SetSize(1, 1);
AddGameTexture(emptytex);
// some special textures used in the game.
@ -1235,7 +1235,7 @@ FTextureID FTextureManager::GetRawTexture(FTextureID texid)
}
// Todo: later this can just link to the already existing texture for this source graphic, once it can be retrieved through the image's SourceLump index
auto RawTexture = MakeGameTexture(new FImageTexture(source, ""), ETextureType::Wall);
auto RawTexture = MakeGameTexture(new FImageTexture(source), nullptr, ETextureType::Wall);
texid = TexMan.AddGameTexture(RawTexture);
Textures[texidx].RawTexture = texid.GetIndex();
Textures[texid.GetIndex()].RawTexture = texid.GetIndex();
@ -1268,7 +1268,7 @@ FTextureID FTextureManager::GetFrontSkyLayer(FTextureID texid)
// Set this up so that it serializes to the same info as the base texture - this is needed to restore it on load.
// But do not link the new texture into the hash chain!
auto FrontSkyLayer = MakeGameTexture(new FImageTexture(image, tex->GetName()), ETextureType::Wall);
auto FrontSkyLayer = MakeGameTexture(new FImageTexture(image), tex->GetName(), ETextureType::Wall);
FrontSkyLayer->SetUseType(tex->GetUseType());
FrontSkyLayer->GetTexture()->bNoRemap0 = true;
texid = TexMan.AddGameTexture(FrontSkyLayer, false);

View file

@ -250,7 +250,7 @@ class FTexture : public RefCountedBase
public:
IHardwareTexture* GetHardwareTexture(int translation, int scaleflags);
static FTexture *CreateTexture(const char *name, int lumpnum, bool allowflats = false);
static FTexture *CreateTexture(int lumpnum, bool allowflats = false);
virtual ~FTexture ();
virtual FImageSource *GetImage() const { return nullptr; }
void CreateUpsampledTextureBuffer(FTextureBuffer &texbuffer, bool hasAlpha, bool checkonly);
@ -268,7 +268,6 @@ public:
float GetShaderSpeed() const { return shaderspeed; }
void SetRotations(int rot) { Rotations = int16_t(rot); }
const FString &GetName() const { return Name; }
void SetNoDecals(bool on) { bNoDecals = on; }
void SetWarpStyle(int style) { bWarped = style; }
bool allowNoDecals() const { return bNoDecals; }
@ -319,8 +318,6 @@ protected:
protected:
FString Name;
uint8_t bNoDecals:1; // Decals should not stick to texture
uint8_t bNoRemap0:1; // Do not remap color 0 (used by front layer of parallax skies)
uint8_t bWorldPanning:1; // Texture is panned in world units rather than texels
@ -363,7 +360,7 @@ protected:
protected:
uint16_t Width, Height;
FTexture (const char *name = NULL, int lumpnum = -1);
FTexture (int lumpnum = -1);
public:
FTextureBuffer CreateTexBuffer(int translation, int flags = 0);
@ -388,9 +385,8 @@ public:
class FCanvasTexture : public FTexture
{
public:
FCanvasTexture(const char* name, int width, int height)
FCanvasTexture(int width, int height)
{
Name = name;
Width = width;
Height = height;
@ -438,10 +434,9 @@ class FImageTexture : public FTexture
{
FImageSource* mImage;
protected:
FImageTexture(const char *name) : FTexture(name) {}
void SetFromImage();
public:
FImageTexture(FImageSource* image, const char* name = nullptr) noexcept;
FImageTexture(FImageSource* image) noexcept;
virtual TArray<uint8_t> Get8BitPixels(bool alphatex);
void SetImage(FImageSource* img) // This is only for the multipatch texture builder!
@ -543,6 +538,7 @@ class FGameTexture
RefCountedPtr<FTexture> AmbientOcclusion; // Ambient occlusion texture for PBR
RefCountedPtr<FTexture> CustomShaderTextures[MAX_CUSTOM_HW_SHADER_TEXTURES]; // Custom texture maps for custom hardware shaders
FString Name;
FTextureID id;
uint16_t TexelWidth, TexelHeight;
@ -558,10 +554,12 @@ class FGameTexture
FMaterial* Material[4] = { };
public:
FGameTexture(FTexture* wrap);
FGameTexture(FTexture* wrap, const char *name);
~FGameTexture();
FTextureID GetID() const { return id; }
void SetID(FTextureID newid) { id = newid; } // should only be called by the texture manager
const FString& GetName() const { return Name; }
void SetName(const char* name) { Name = name; } // should only be called by setup code.
float GetScaleX() { return ScaleX; }
float GetScaleY() { return ScaleY; }
@ -628,7 +626,6 @@ public:
return Material[num];
}
const FString& GetName() const { return Base->GetName(); }
void SetShaderSpeed(float speed) { Base->shaderspeed = speed; }
void SetShaderIndex(int index) { Base->shaderindex = index; }
void SetShaderLayers(MaterialLayers& lay)
@ -724,10 +721,10 @@ public:
}
};
inline FGameTexture* MakeGameTexture(FTexture* tex, ETextureType useType)
inline FGameTexture* MakeGameTexture(FTexture* tex, const char *name, ETextureType useType)
{
if (!tex) return nullptr;
auto t = new FGameTexture(tex);
auto t = new FGameTexture(tex, name);
t->SetUseType(useType);
return t;
}

View file

@ -880,7 +880,7 @@ void D_Display ()
if (vr_mode == 0 || vid_rendermode != 4)
{
// save the current screen if about to wipe
wipe = MakeGameTexture(screen->WipeStartScreen(), ETextureType::SWCanvas);
wipe = MakeGameTexture(screen->WipeStartScreen(), nullptr, ETextureType::SWCanvas);
switch (wipegamestate)
{
@ -1063,7 +1063,7 @@ void D_Display ()
GSnd->SetSfxPaused(true, 1);
I_FreezeTime(true);
screen->End2D();
auto wipend = MakeGameTexture(screen->WipeEndScreen(), ETextureType::SWCanvas);
auto wipend = MakeGameTexture(screen->WipeEndScreen(), nullptr, ETextureType::SWCanvas);
auto wiper = Wiper::Create(wipe_type);
wiper->SetTextures(wipe, wipend);

View file

@ -709,8 +709,8 @@ void FTextureAnimator::ParseCameraTexture(FScanner &sc)
sc.MustGetNumber ();
height = sc.Number;
FTextureID picnum = TexMan.CheckForTexture (picname, ETextureType::Flat, texflags);
auto canvas = new FCanvasTexture(picname, width, height);
FGameTexture *viewer = MakeGameTexture(canvas, ETextureType::Wall);
auto canvas = new FCanvasTexture(width, height);
FGameTexture *viewer = MakeGameTexture(canvas, picname, ETextureType::Wall);
if (picnum.Exists())
{
auto oldtex = TexMan.GameTexture(picnum);

View file

@ -157,7 +157,7 @@ void AddTiles(const FString& pathprefix, const void* tiles, FRemapTable *remap)
if (width <= 0 || height <= 0) continue;
FStringf name("%sBTIL%04d", pathprefix.GetChars(), i);
auto tex = MakeGameTexture(new FImageTexture(new FBuildTexture(pathprefix, i, tiledata, remap, width, height, xoffs, yoffs), name), ETextureType::Override);
auto tex = MakeGameTexture(new FImageTexture(new FBuildTexture(pathprefix, i, tiledata, remap, width, height, xoffs, yoffs)), name, ETextureType::Override);
texnum = TexMan.AddGameTexture(tex);
tiledata += size;

View file

@ -77,6 +77,7 @@ static void ParseVavoomSkybox()
int facecount=0;
int maplump = -1;
bool error = false;
FString s = sc.String;
FSkyBox * sb = new FSkyBox(sc.String);
sb->fliptop = true;
sc.MustGetStringName("{");
@ -93,7 +94,7 @@ static void ParseVavoomSkybox()
auto tex = TexMan.FindGameTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny);
if (tex == NULL)
{
sc.ScriptMessage("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, sb->GetName().GetChars());
sc.ScriptMessage("Texture '%s' not found in Vavoom skybox '%s'\n", sc.String, s.GetChars());
error = true;
}
sb->faces[facecount] = tex;
@ -103,12 +104,12 @@ static void ParseVavoomSkybox()
}
if (facecount != 6)
{
sc.ScriptError("%s: Skybox definition requires 6 faces", sb->GetName().GetChars());
sc.ScriptError("%s: Skybox definition requires 6 faces", s.GetChars());
}
sb->SetSize();
if (!error)
{
TexMan.AddGameTexture(MakeGameTexture(sb, ETextureType::Override));
TexMan.AddGameTexture(MakeGameTexture(sb, s, ETextureType::Override));
}
}
}
@ -992,7 +993,6 @@ class GLDefsParser
sc.MustGetString();
FString s = sc.String;
s.ToUpper();
FSkyBox * sb = new FSkyBox(s);
if (sc.CheckString("fliptop"))
{
@ -1010,10 +1010,10 @@ class GLDefsParser
}
if (facecount != 3 && facecount != 6)
{
sc.ScriptError("%s: Skybox definition requires either 3 or 6 faces", sb->GetName().GetChars());
sc.ScriptError("%s: Skybox definition requires either 3 or 6 faces", s.GetChars());
}
sb->SetSize();
TexMan.AddGameTexture(MakeGameTexture(sb, ETextureType::Override));
TexMan.AddGameTexture(MakeGameTexture(sb, s, ETextureType::Override));
}
//===========================================================================

View file

@ -157,7 +157,7 @@ FVoxelModel::FVoxelModel(FVoxel *voxel, bool owned)
{
mVoxel = voxel;
mOwningVoxel = owned;
mPalette = TexMan.AddGameTexture(MakeGameTexture(new FImageTexture(new FVoxelTexture(voxel)), ETextureType::Override));
mPalette = TexMan.AddGameTexture(MakeGameTexture(new FImageTexture(new FVoxelTexture(voxel)), nullptr, ETextureType::Override));
}
//===========================================================================

View file

@ -57,10 +57,11 @@ void FCanvasTextureInfo::Add (AActor *viewpoint, FTextureID picnum, double fov)
{
return;
}
texture = static_cast<FCanvasTexture *>(TexMan.GetGameTexture(picnum)->GetTexture());
auto gt = TexMan.GetGameTexture(picnum);
texture = static_cast<FCanvasTexture *>(gt->GetTexture());
if (!texture->bHasCanvas)
{
Printf ("%s is not a valid target for a camera\n", texture->Name.GetChars());
Printf ("%s is not a valid target for a camera\n", gt->GetName().GetChars());
return;
}

View file

@ -76,7 +76,7 @@ SWSceneDrawer::SWSceneDrawer()
if (!texid.Exists())
{
// We need to wrap this in a game texture object to have it managed by the texture manager, even though it will never be used as a material.
auto tex = MakeGameTexture(new FImageTexture(new FSWPaletteTexture, "@@palette@@"), ETextureType::Special);
auto tex = MakeGameTexture(new FImageTexture(new FSWPaletteTexture), "@@palette@@", ETextureType::Special);
texid = TexMan.AddGameTexture(tex);
}
PaletteTexture = TexMan.GetGameTexture(texid)->GetTexture();
@ -103,7 +103,7 @@ sector_t *SWSceneDrawer::RenderView(player_t *player)
{
// This manually constructs its own material here.
fbtex.reset();
fbtex.reset(MakeGameTexture(new FWrapperTexture(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor()), ETextureType::SWCanvas));
fbtex.reset(MakeGameTexture(new FWrapperTexture(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor()), nullptr, ETextureType::SWCanvas));
GetSystemTexture()->AllocateBuffer(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor() ? 4 : 1);
auto mat = FMaterial::ValidateTexture(fbtex.get(), false);
mat->AddTextureLayer(PaletteTexture);