mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-09 01:41:06 +00:00
- moved the texture name to FGameTexture.
This commit is contained in:
parent
7dd108c960
commit
718949f74d
20 changed files with 69 additions and 93 deletions
|
@ -327,14 +327,14 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
||||||
}
|
}
|
||||||
|
|
||||||
auto orig = pic->GetTexture();
|
auto orig = pic->GetTexture();
|
||||||
auto tex = MakeGameTexture(orig, ETextureType::FontChar);
|
auto tex = MakeGameTexture(orig, nullptr, ETextureType::FontChar);
|
||||||
tex->CopySize(pic);
|
tex->CopySize(pic);
|
||||||
TexMan.AddGameTexture(tex);
|
TexMan.AddGameTexture(tex);
|
||||||
Chars[i].OriginalPic = tex;
|
Chars[i].OriginalPic = tex;
|
||||||
|
|
||||||
if (!noTranslate)
|
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);
|
Chars[i].TranslatedPic->CopySize(pic);
|
||||||
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
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].OriginY = -height * y;
|
||||||
part[0].Image = tex->GetTexture()->GetImage();
|
part[0].Image = tex->GetTexture()->GetImage();
|
||||||
FMultiPatchTexture *image = new FMultiPatchTexture(width, height, part, false, false);
|
FMultiPatchTexture *image = new FMultiPatchTexture(width, height, part, false, false);
|
||||||
FImageTexture *tex = new FImageTexture(image, "");
|
FImageTexture *tex = new FImageTexture(image);
|
||||||
tex->bMultiPatch = true;
|
tex->bMultiPatch = true;
|
||||||
tex->bMasked = true;
|
tex->bMasked = true;
|
||||||
tex->bTranslucent = -1;
|
tex->bTranslucent = -1;
|
||||||
tex->bWorldPanning = true;
|
tex->bWorldPanning = true;
|
||||||
tex->bNoDecals = false;
|
tex->bNoDecals = false;
|
||||||
tex->SourceLump = -1; // We do not really care.
|
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(0, 0, 0);
|
||||||
gtex->SetOffsets(1, 0, 0);
|
gtex->SetOffsets(1, 0, 0);
|
||||||
gtex->SetScale((float)Scale.X, (float)Scale.Y);
|
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);
|
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->SetUseType(ETextureType::FontChar);
|
||||||
Chars[i].OriginalPic->CopySize(*lump);
|
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->CopySize(*lump);
|
||||||
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
Chars[i].TranslatedPic->SetUseType(ETextureType::FontChar);
|
||||||
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
||||||
|
|
|
@ -289,7 +289,7 @@ public:
|
||||||
{
|
{
|
||||||
auto offset = hexdata.glyphmap[i];
|
auto offset = hexdata.glyphmap[i];
|
||||||
int size = hexdata.glyphdata[offset] / 16;
|
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;
|
Chars[i - FirstChar].XMove = size * spacing;
|
||||||
TexMan.AddGameTexture(Chars[i - FirstChar].TranslatedPic);
|
TexMan.AddGameTexture(Chars[i - FirstChar].TranslatedPic);
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ public:
|
||||||
{
|
{
|
||||||
auto offset = hexdata.glyphmap[i];
|
auto offset = hexdata.glyphmap[i];
|
||||||
int size = hexdata.glyphdata[offset] / 16;
|
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;
|
Chars[i - FirstChar].XMove = size * spacing;
|
||||||
TexMan.AddGameTexture(Chars[i - FirstChar].TranslatedPic);
|
TexMan.AddGameTexture(Chars[i - FirstChar].TranslatedPic);
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,7 @@ void FSingleLumpFont::LoadFON2 (int lump, const uint8_t *data)
|
||||||
}
|
}
|
||||||
else
|
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);
|
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -487,7 +487,7 @@ void FSingleLumpFont::LoadBMF(int lump, const uint8_t *data)
|
||||||
chardata[chari+2], // height
|
chardata[chari+2], // height
|
||||||
-(int8_t)chardata[chari+3], // x offset
|
-(int8_t)chardata[chari+3], // x offset
|
||||||
-(int8_t)chardata[chari+4] // y offset
|
-(int8_t)chardata[chari+4] // y offset
|
||||||
)), ETextureType::FontChar);
|
)), nullptr, ETextureType::FontChar);
|
||||||
Chars[chardata[chari] - FirstChar].TranslatedPic = tex;
|
Chars[chardata[chari] - FirstChar].TranslatedPic = tex;
|
||||||
TexMan.AddGameTexture(tex);
|
TexMan.AddGameTexture(tex);
|
||||||
}
|
}
|
||||||
|
@ -554,7 +554,7 @@ void FSingleLumpFont::CheckFON1Chars (double *luminosity)
|
||||||
|
|
||||||
if(!Chars[i].TranslatedPic)
|
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;
|
Chars[i].XMove = SpaceWidth;
|
||||||
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,13 +104,13 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FGameTexture
|
||||||
if (charlumps[i] != nullptr)
|
if (charlumps[i] != nullptr)
|
||||||
{
|
{
|
||||||
auto pic = charlumps[i];
|
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);
|
Chars[i].OriginalPic->CopySize(pic);
|
||||||
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
TexMan.AddGameTexture(Chars[i].OriginalPic);
|
||||||
|
|
||||||
if (!noTranslate)
|
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]);
|
Chars[i].TranslatedPic->CopySize(charlumps[i]);
|
||||||
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
TexMan.AddGameTexture(Chars[i].TranslatedPic);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
// 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;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -132,6 +132,6 @@ private:
|
||||||
FGameTexture *CreateShaderTexture(bool vertical, bool reverse)
|
FGameTexture *CreateShaderTexture(bool vertical, bool reverse)
|
||||||
{
|
{
|
||||||
FStringf name("BarShader%c%c", vertical ? 'v' : 'h', reverse ? 'r' : 'f');
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,4 +171,4 @@ protected:
|
||||||
|
|
||||||
class FTexture;
|
class FTexture;
|
||||||
|
|
||||||
FTexture* CreateImageTexture(FImageSource* img, const char *name = nullptr) noexcept;
|
FTexture* CreateImageTexture(FImageSource* img) noexcept;
|
||||||
|
|
|
@ -47,13 +47,12 @@
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
FImageTexture::FImageTexture(FImageSource *img, const char *name) noexcept
|
FImageTexture::FImageTexture(FImageSource *img) noexcept
|
||||||
: FTexture(name, img? img->LumpNum() : 0)
|
: FTexture(img? img->LumpNum() : 0)
|
||||||
{
|
{
|
||||||
mImage = img;
|
mImage = img;
|
||||||
if (img != nullptr)
|
if (img != nullptr)
|
||||||
{
|
{
|
||||||
if (name == nullptr) fileSystem.GetFileShortName(Name, img->LumpNum());
|
|
||||||
SetFromImage();
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ struct FPatchLookup
|
||||||
|
|
||||||
void FMultipatchTextureBuilder::MakeTexture(BuildInfo &buildinfo, ETextureType usetype)
|
void FMultipatchTextureBuilder::MakeTexture(BuildInfo &buildinfo, ETextureType usetype)
|
||||||
{
|
{
|
||||||
FImageTexture *tex = new FImageTexture(nullptr, buildinfo.Name);
|
FImageTexture *tex = new FImageTexture(nullptr);
|
||||||
tex->bMultiPatch = true;
|
tex->bMultiPatch = true;
|
||||||
tex->SetSize(buildinfo.Width, buildinfo.Height);
|
tex->SetSize(buildinfo.Width, buildinfo.Height);
|
||||||
tex->bMasked = true; // we do not really know yet.
|
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->bNoDecals = buildinfo.bNoDecals;
|
||||||
tex->SourceLump = buildinfo.DefinitionLump;
|
tex->SourceLump = buildinfo.DefinitionLump;
|
||||||
buildinfo.itex = tex;
|
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(0, buildinfo.LeftOffset[0], buildinfo.TopOffset[0]);
|
||||||
buildinfo.texture->SetOffsets(1, buildinfo.LeftOffset[1], buildinfo.TopOffset[1]);
|
buildinfo.texture->SetOffsets(1, buildinfo.LeftOffset[1], buildinfo.TopOffset[1]);
|
||||||
buildinfo.texture->SetScale((float)buildinfo.Scale.X, (float)buildinfo.Scale.X);
|
buildinfo.texture->SetScale((float)buildinfo.Scale.X, (float)buildinfo.Scale.X);
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
FSkyBox::FSkyBox(const char *name)
|
FSkyBox::FSkyBox(const char *name)
|
||||||
: FImageTexture(name)
|
: FImageTexture(nullptr)
|
||||||
{
|
{
|
||||||
FTextureID texid = TexMan.CheckForTexture(name, ETextureType::Wall);
|
FTextureID texid = TexMan.CheckForTexture(name, ETextureType::Wall);
|
||||||
if (texid.isValid())
|
if (texid.isValid())
|
||||||
|
|
|
@ -70,20 +70,14 @@ int r_spriteadjustSW, r_spriteadjustHW;
|
||||||
|
|
||||||
// Examines the lump contents to decide what type of texture to create,
|
// Examines the lump contents to decide what type of texture to create,
|
||||||
// and creates the texture.
|
// 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;
|
if (lumpnum == -1) return nullptr;
|
||||||
|
|
||||||
auto image = FImageSource::GetImage(lumpnum, allowflats);
|
auto image = FImageSource::GetImage(lumpnum, allowflats);
|
||||||
if (image != nullptr)
|
if (image != nullptr)
|
||||||
{
|
{
|
||||||
FTexture *tex = new FImageTexture(image);
|
return new FImageTexture(image);
|
||||||
if (tex != nullptr)
|
|
||||||
{
|
|
||||||
tex->Name = name;
|
|
||||||
tex->Name.ToUpper();
|
|
||||||
return tex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return nullptr;
|
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),
|
SourceLump(lumpnum),
|
||||||
bNoDecals(false), bNoRemap0(false), bWorldPanning(false),
|
bNoDecals(false), bNoRemap0(false), bWorldPanning(false),
|
||||||
|
@ -109,21 +103,6 @@ FTexture::FTexture (const char *name, int lumpnum)
|
||||||
bSkybox = false;
|
bSkybox = false;
|
||||||
bNoCompress = false;
|
bNoCompress = false;
|
||||||
bTranslucent = -1;
|
bTranslucent = -1;
|
||||||
|
|
||||||
|
|
||||||
if (name != NULL)
|
|
||||||
{
|
|
||||||
Name = name;
|
|
||||||
Name.ToUpper();
|
|
||||||
}
|
|
||||||
else if (lumpnum < 0)
|
|
||||||
{
|
|
||||||
Name = FString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fileSystem.GetFileShortName (Name, lumpnum);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FTexture::~FTexture ()
|
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();
|
id.SetInvalid();
|
||||||
TexelWidth = Base->GetWidth();
|
TexelWidth = Base->GetWidth();
|
||||||
|
|
|
@ -230,7 +230,7 @@ FTextureID FTextureManager::CheckForTexture (const char *name, ETextureType uset
|
||||||
if (tex == NO_TEXTURE) return FTextureID(-1);
|
if (tex == NO_TEXTURE) return FTextureID(-1);
|
||||||
if (tex != NULL) return tex->GetID();
|
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.
|
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)
|
if (tex != NULL)
|
||||||
{
|
{
|
||||||
tex->AddAutoMaterials();
|
tex->AddAutoMaterials();
|
||||||
|
@ -421,7 +421,7 @@ FTextureID FTextureManager::CreateTexture (int lumpnum, ETextureType usetype)
|
||||||
{
|
{
|
||||||
FString str;
|
FString str;
|
||||||
fileSystem.GetFileShortName(str, lumpnum);
|
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)
|
if (out != NULL)
|
||||||
{
|
{
|
||||||
|
@ -470,11 +470,11 @@ void FTextureManager::ReplaceTexture (FTextureID picnum, FGameTexture *newtextur
|
||||||
|
|
||||||
auto oldtexture = Textures[index].Texture;
|
auto oldtexture = Textures[index].Texture;
|
||||||
|
|
||||||
newtexture->GetTexture()->Name = oldtexture->GetName();
|
newtexture->SetName(oldtexture->GetName());
|
||||||
newtexture->SetUseType(oldtexture->GetUseType());
|
newtexture->SetUseType(oldtexture->GetUseType());
|
||||||
Textures[index].Texture = newtexture;
|
Textures[index].Texture = newtexture;
|
||||||
newtexture->SetID(oldtexture->GetID());
|
newtexture->SetID(oldtexture->GetID());
|
||||||
oldtexture->GetTexture()->Name = "";
|
oldtexture->SetName("");
|
||||||
AddGameTexture(oldtexture);
|
AddGameTexture(oldtexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ void FTextureManager::AddHiresTextures (int wadnum)
|
||||||
if (amount == 0)
|
if (amount == 0)
|
||||||
{
|
{
|
||||||
// A texture with this name does not yet exist
|
// 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)
|
if (newtex != NULL)
|
||||||
{
|
{
|
||||||
AddGameTexture(newtex);
|
AddGameTexture(newtex);
|
||||||
|
@ -594,13 +594,13 @@ void FTextureManager::AddHiresTextures (int wadnum)
|
||||||
{
|
{
|
||||||
for(unsigned int i = 0; i < tlist.Size(); i++)
|
for(unsigned int i = 0; i < tlist.Size(); i++)
|
||||||
{
|
{
|
||||||
FTexture * newtex = FTexture::CreateTexture ("", firsttx);
|
FTexture * newtex = FTexture::CreateTexture (firsttx);
|
||||||
if (newtex != NULL)
|
if (newtex != NULL)
|
||||||
{
|
{
|
||||||
auto oldtex = Textures[tlist[i].GetIndex()].Texture;
|
auto oldtex = Textures[tlist[i].GetIndex()].Texture;
|
||||||
|
|
||||||
// Replace the entire texture and adjust the scaling and offset factors.
|
// 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->SetWorldPanning(true);
|
||||||
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
||||||
gtex->SetOffsets(0, xs_RoundToInt(oldtex->GetDisplayLeftOffset(0) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(0) * gtex->GetScaleY()));
|
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)
|
(sl=oldtex->GetSourceLump()) >= 0 && fileSystem.GetFileNamespace(sl) == ns_sprites)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
FTexture * newtex = FTexture::CreateTexture ("", lumpnum);
|
FTexture * newtex = FTexture::CreateTexture (lumpnum);
|
||||||
if (newtex != NULL)
|
if (newtex != NULL)
|
||||||
{
|
{
|
||||||
// Replace the entire texture and adjust the scaling and offset factors.
|
// 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->SetWorldPanning(true);
|
||||||
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight());
|
||||||
gtex->SetOffsets(0, xs_RoundToInt(oldtex->GetDisplayLeftOffset(0) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(0) * gtex->GetScaleY()));
|
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)
|
if (lumpnum>=0)
|
||||||
{
|
{
|
||||||
auto newtex = MakeGameTexture(FTexture::CreateTexture(src, lumpnum), ETextureType::Override);
|
auto newtex = MakeGameTexture(FTexture::CreateTexture(lumpnum), src, ETextureType::Override);
|
||||||
|
|
||||||
if (newtex != NULL)
|
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.
|
// Try to create a texture from this lump and add it.
|
||||||
// Unfortunately we have to look at everything that comes through here...
|
// 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)
|
if (out != NULL)
|
||||||
{
|
{
|
||||||
|
@ -1116,11 +1116,11 @@ void FTextureManager::Init(void (*progressFunc_)(), void (*checkForHacks)(BuildI
|
||||||
DeleteAll();
|
DeleteAll();
|
||||||
//if (BuildTileFiles.Size() == 0) CountBuildTiles ();
|
//if (BuildTileFiles.Size() == 0) CountBuildTiles ();
|
||||||
|
|
||||||
auto nulltex = MakeGameTexture(new FImageTexture(CreateEmptyTexture(), ""), ETextureType::Null);
|
auto nulltex = MakeGameTexture(new FImageTexture(CreateEmptyTexture()), nullptr, ETextureType::Null);
|
||||||
AddGameTexture(nulltex);
|
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.
|
// 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);
|
emptytex->SetSize(1, 1);
|
||||||
AddGameTexture(emptytex);
|
AddGameTexture(emptytex);
|
||||||
// some special textures used in the game.
|
// 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
|
// 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);
|
texid = TexMan.AddGameTexture(RawTexture);
|
||||||
Textures[texidx].RawTexture = texid.GetIndex();
|
Textures[texidx].RawTexture = texid.GetIndex();
|
||||||
Textures[texid.GetIndex()].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.
|
// 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!
|
// 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->SetUseType(tex->GetUseType());
|
||||||
FrontSkyLayer->GetTexture()->bNoRemap0 = true;
|
FrontSkyLayer->GetTexture()->bNoRemap0 = true;
|
||||||
texid = TexMan.AddGameTexture(FrontSkyLayer, false);
|
texid = TexMan.AddGameTexture(FrontSkyLayer, false);
|
||||||
|
|
|
@ -250,7 +250,7 @@ class FTexture : public RefCountedBase
|
||||||
public:
|
public:
|
||||||
|
|
||||||
IHardwareTexture* GetHardwareTexture(int translation, int scaleflags);
|
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 ~FTexture ();
|
||||||
virtual FImageSource *GetImage() const { return nullptr; }
|
virtual FImageSource *GetImage() const { return nullptr; }
|
||||||
void CreateUpsampledTextureBuffer(FTextureBuffer &texbuffer, bool hasAlpha, bool checkonly);
|
void CreateUpsampledTextureBuffer(FTextureBuffer &texbuffer, bool hasAlpha, bool checkonly);
|
||||||
|
@ -268,7 +268,6 @@ public:
|
||||||
float GetShaderSpeed() const { return shaderspeed; }
|
float GetShaderSpeed() const { return shaderspeed; }
|
||||||
void SetRotations(int rot) { Rotations = int16_t(rot); }
|
void SetRotations(int rot) { Rotations = int16_t(rot); }
|
||||||
|
|
||||||
const FString &GetName() const { return Name; }
|
|
||||||
void SetNoDecals(bool on) { bNoDecals = on; }
|
void SetNoDecals(bool on) { bNoDecals = on; }
|
||||||
void SetWarpStyle(int style) { bWarped = style; }
|
void SetWarpStyle(int style) { bWarped = style; }
|
||||||
bool allowNoDecals() const { return bNoDecals; }
|
bool allowNoDecals() const { return bNoDecals; }
|
||||||
|
@ -319,8 +318,6 @@ protected:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
FString Name;
|
|
||||||
|
|
||||||
uint8_t bNoDecals:1; // Decals should not stick to texture
|
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 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
|
uint8_t bWorldPanning:1; // Texture is panned in world units rather than texels
|
||||||
|
@ -363,7 +360,7 @@ protected:
|
||||||
protected:
|
protected:
|
||||||
uint16_t Width, Height;
|
uint16_t Width, Height;
|
||||||
|
|
||||||
FTexture (const char *name = NULL, int lumpnum = -1);
|
FTexture (int lumpnum = -1);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FTextureBuffer CreateTexBuffer(int translation, int flags = 0);
|
FTextureBuffer CreateTexBuffer(int translation, int flags = 0);
|
||||||
|
@ -388,9 +385,8 @@ public:
|
||||||
class FCanvasTexture : public FTexture
|
class FCanvasTexture : public FTexture
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FCanvasTexture(const char* name, int width, int height)
|
FCanvasTexture(int width, int height)
|
||||||
{
|
{
|
||||||
Name = name;
|
|
||||||
Width = width;
|
Width = width;
|
||||||
Height = height;
|
Height = height;
|
||||||
|
|
||||||
|
@ -438,10 +434,9 @@ class FImageTexture : public FTexture
|
||||||
{
|
{
|
||||||
FImageSource* mImage;
|
FImageSource* mImage;
|
||||||
protected:
|
protected:
|
||||||
FImageTexture(const char *name) : FTexture(name) {}
|
|
||||||
void SetFromImage();
|
void SetFromImage();
|
||||||
public:
|
public:
|
||||||
FImageTexture(FImageSource* image, const char* name = nullptr) noexcept;
|
FImageTexture(FImageSource* image) noexcept;
|
||||||
virtual TArray<uint8_t> Get8BitPixels(bool alphatex);
|
virtual TArray<uint8_t> Get8BitPixels(bool alphatex);
|
||||||
|
|
||||||
void SetImage(FImageSource* img) // This is only for the multipatch texture builder!
|
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> AmbientOcclusion; // Ambient occlusion texture for PBR
|
||||||
RefCountedPtr<FTexture> CustomShaderTextures[MAX_CUSTOM_HW_SHADER_TEXTURES]; // Custom texture maps for custom hardware shaders
|
RefCountedPtr<FTexture> CustomShaderTextures[MAX_CUSTOM_HW_SHADER_TEXTURES]; // Custom texture maps for custom hardware shaders
|
||||||
|
|
||||||
|
FString Name;
|
||||||
FTextureID id;
|
FTextureID id;
|
||||||
|
|
||||||
uint16_t TexelWidth, TexelHeight;
|
uint16_t TexelWidth, TexelHeight;
|
||||||
|
@ -558,10 +554,12 @@ class FGameTexture
|
||||||
FMaterial* Material[4] = { };
|
FMaterial* Material[4] = { };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FGameTexture(FTexture* wrap);
|
FGameTexture(FTexture* wrap, const char *name);
|
||||||
~FGameTexture();
|
~FGameTexture();
|
||||||
FTextureID GetID() const { return id; }
|
FTextureID GetID() const { return id; }
|
||||||
void SetID(FTextureID newid) { id = newid; } // should only be called by the texture manager
|
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 GetScaleX() { return ScaleX; }
|
||||||
float GetScaleY() { return ScaleY; }
|
float GetScaleY() { return ScaleY; }
|
||||||
|
@ -628,7 +626,6 @@ public:
|
||||||
return Material[num];
|
return Material[num];
|
||||||
}
|
}
|
||||||
|
|
||||||
const FString& GetName() const { return Base->GetName(); }
|
|
||||||
void SetShaderSpeed(float speed) { Base->shaderspeed = speed; }
|
void SetShaderSpeed(float speed) { Base->shaderspeed = speed; }
|
||||||
void SetShaderIndex(int index) { Base->shaderindex = index; }
|
void SetShaderIndex(int index) { Base->shaderindex = index; }
|
||||||
void SetShaderLayers(MaterialLayers& lay)
|
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;
|
if (!tex) return nullptr;
|
||||||
auto t = new FGameTexture(tex);
|
auto t = new FGameTexture(tex, name);
|
||||||
t->SetUseType(useType);
|
t->SetUseType(useType);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
|
@ -880,7 +880,7 @@ void D_Display ()
|
||||||
if (vr_mode == 0 || vid_rendermode != 4)
|
if (vr_mode == 0 || vid_rendermode != 4)
|
||||||
{
|
{
|
||||||
// save the current screen if about to wipe
|
// save the current screen if about to wipe
|
||||||
wipe = MakeGameTexture(screen->WipeStartScreen(), ETextureType::SWCanvas);
|
wipe = MakeGameTexture(screen->WipeStartScreen(), nullptr, ETextureType::SWCanvas);
|
||||||
|
|
||||||
switch (wipegamestate)
|
switch (wipegamestate)
|
||||||
{
|
{
|
||||||
|
@ -1063,7 +1063,7 @@ void D_Display ()
|
||||||
GSnd->SetSfxPaused(true, 1);
|
GSnd->SetSfxPaused(true, 1);
|
||||||
I_FreezeTime(true);
|
I_FreezeTime(true);
|
||||||
screen->End2D();
|
screen->End2D();
|
||||||
auto wipend = MakeGameTexture(screen->WipeEndScreen(), ETextureType::SWCanvas);
|
auto wipend = MakeGameTexture(screen->WipeEndScreen(), nullptr, ETextureType::SWCanvas);
|
||||||
auto wiper = Wiper::Create(wipe_type);
|
auto wiper = Wiper::Create(wipe_type);
|
||||||
wiper->SetTextures(wipe, wipend);
|
wiper->SetTextures(wipe, wipend);
|
||||||
|
|
||||||
|
|
|
@ -709,8 +709,8 @@ void FTextureAnimator::ParseCameraTexture(FScanner &sc)
|
||||||
sc.MustGetNumber ();
|
sc.MustGetNumber ();
|
||||||
height = sc.Number;
|
height = sc.Number;
|
||||||
FTextureID picnum = TexMan.CheckForTexture (picname, ETextureType::Flat, texflags);
|
FTextureID picnum = TexMan.CheckForTexture (picname, ETextureType::Flat, texflags);
|
||||||
auto canvas = new FCanvasTexture(picname, width, height);
|
auto canvas = new FCanvasTexture(width, height);
|
||||||
FGameTexture *viewer = MakeGameTexture(canvas, ETextureType::Wall);
|
FGameTexture *viewer = MakeGameTexture(canvas, picname, ETextureType::Wall);
|
||||||
if (picnum.Exists())
|
if (picnum.Exists())
|
||||||
{
|
{
|
||||||
auto oldtex = TexMan.GameTexture(picnum);
|
auto oldtex = TexMan.GameTexture(picnum);
|
||||||
|
|
|
@ -157,7 +157,7 @@ void AddTiles(const FString& pathprefix, const void* tiles, FRemapTable *remap)
|
||||||
if (width <= 0 || height <= 0) continue;
|
if (width <= 0 || height <= 0) continue;
|
||||||
|
|
||||||
FStringf name("%sBTIL%04d", pathprefix.GetChars(), i);
|
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);
|
texnum = TexMan.AddGameTexture(tex);
|
||||||
tiledata += size;
|
tiledata += size;
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ static void ParseVavoomSkybox()
|
||||||
int facecount=0;
|
int facecount=0;
|
||||||
int maplump = -1;
|
int maplump = -1;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
FString s = sc.String;
|
||||||
FSkyBox * sb = new FSkyBox(sc.String);
|
FSkyBox * sb = new FSkyBox(sc.String);
|
||||||
sb->fliptop = true;
|
sb->fliptop = true;
|
||||||
sc.MustGetStringName("{");
|
sc.MustGetStringName("{");
|
||||||
|
@ -93,7 +94,7 @@ static void ParseVavoomSkybox()
|
||||||
auto tex = TexMan.FindGameTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny);
|
auto tex = TexMan.FindGameTexture(sc.String, ETextureType::Wall, FTextureManager::TEXMAN_TryAny);
|
||||||
if (tex == NULL)
|
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;
|
error = true;
|
||||||
}
|
}
|
||||||
sb->faces[facecount] = tex;
|
sb->faces[facecount] = tex;
|
||||||
|
@ -103,12 +104,12 @@ static void ParseVavoomSkybox()
|
||||||
}
|
}
|
||||||
if (facecount != 6)
|
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();
|
sb->SetSize();
|
||||||
if (!error)
|
if (!error)
|
||||||
{
|
{
|
||||||
TexMan.AddGameTexture(MakeGameTexture(sb, ETextureType::Override));
|
TexMan.AddGameTexture(MakeGameTexture(sb, s, ETextureType::Override));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -992,7 +993,6 @@ class GLDefsParser
|
||||||
sc.MustGetString();
|
sc.MustGetString();
|
||||||
|
|
||||||
FString s = sc.String;
|
FString s = sc.String;
|
||||||
s.ToUpper();
|
|
||||||
FSkyBox * sb = new FSkyBox(s);
|
FSkyBox * sb = new FSkyBox(s);
|
||||||
if (sc.CheckString("fliptop"))
|
if (sc.CheckString("fliptop"))
|
||||||
{
|
{
|
||||||
|
@ -1010,10 +1010,10 @@ class GLDefsParser
|
||||||
}
|
}
|
||||||
if (facecount != 3 && facecount != 6)
|
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();
|
sb->SetSize();
|
||||||
TexMan.AddGameTexture(MakeGameTexture(sb, ETextureType::Override));
|
TexMan.AddGameTexture(MakeGameTexture(sb, s, ETextureType::Override));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
|
@ -157,7 +157,7 @@ FVoxelModel::FVoxelModel(FVoxel *voxel, bool owned)
|
||||||
{
|
{
|
||||||
mVoxel = voxel;
|
mVoxel = voxel;
|
||||||
mOwningVoxel = owned;
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
|
@ -57,10 +57,11 @@ void FCanvasTextureInfo::Add (AActor *viewpoint, FTextureID picnum, double fov)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
texture = static_cast<FCanvasTexture *>(TexMan.GetGameTexture(picnum)->GetTexture());
|
auto gt = TexMan.GetGameTexture(picnum);
|
||||||
|
texture = static_cast<FCanvasTexture *>(gt->GetTexture());
|
||||||
if (!texture->bHasCanvas)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ SWSceneDrawer::SWSceneDrawer()
|
||||||
if (!texid.Exists())
|
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.
|
// 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);
|
texid = TexMan.AddGameTexture(tex);
|
||||||
}
|
}
|
||||||
PaletteTexture = TexMan.GetGameTexture(texid)->GetTexture();
|
PaletteTexture = TexMan.GetGameTexture(texid)->GetTexture();
|
||||||
|
@ -103,7 +103,7 @@ sector_t *SWSceneDrawer::RenderView(player_t *player)
|
||||||
{
|
{
|
||||||
// This manually constructs its own material here.
|
// This manually constructs its own material here.
|
||||||
fbtex.reset();
|
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);
|
GetSystemTexture()->AllocateBuffer(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor() ? 4 : 1);
|
||||||
auto mat = FMaterial::ValidateTexture(fbtex.get(), false);
|
auto mat = FMaterial::ValidateTexture(fbtex.get(), false);
|
||||||
mat->AddTextureLayer(PaletteTexture);
|
mat->AddTextureLayer(PaletteTexture);
|
||||||
|
|
Loading…
Reference in a new issue