- separated the image converters from the texture offsets.

Mostly done, except for FMultiPatchTexture and FFontChar1 + 2.
Note that this commit leaks those image objects!
This commit is contained in:
Christoph Oelckers 2018-12-09 07:39:05 +01:00
parent 5eab944157
commit 583a740441
21 changed files with 90 additions and 184 deletions

View file

@ -1119,7 +1119,6 @@ set (PCH_SOURCES
textures/formats/emptytexture.cpp
textures/formats/shadertexture.cpp
textures/formats/tgatexture.cpp
textures/formats/worldtexture.cpp
textures/hires/hqresize.cpp
textures/hires/hirestex.cpp
xlat/parse_xlat.cpp

View file

@ -32,6 +32,7 @@
#include "textures/bitmap.h"
#include "g_levellocals.h"
#include "models.h"
#include "image.h"
#ifdef _MSC_VER
#pragma warning(disable:4244) // warning C4244: conversion from 'double' to 'float', possible loss of data
@ -46,13 +47,12 @@
//
//===========================================================================
class FVoxelTexture : public FWorldTexture
class FVoxelTexture : public FImageSource
{
public:
FVoxelTexture(FVoxel *voxel);
int CopyPixels(FBitmap *bmp) override;
bool UseBasePalette() override { return false; }
TArray<uint8_t> Get8BitPixels(bool alphatex) override;
protected:
@ -70,7 +70,7 @@ FVoxelTexture::FVoxelTexture(FVoxel *vox)
SourceVox = vox;
Width = 16;
Height = 16;
bNoCompress = true;
//bNoCompress = true;
}
//===========================================================================
@ -156,7 +156,7 @@ FVoxelModel::FVoxelModel(FVoxel *voxel, bool owned)
{
mVoxel = voxel;
mOwningVoxel = owned;
mPalette = TexMan.AddTexture(new FVoxelTexture(voxel));
mPalette = TexMan.AddTexture(new FImageTexture(new FVoxelTexture(voxel)));
}
//===========================================================================

View file

@ -40,6 +40,7 @@
#include "w_wad.h"
#include "textures/textures.h"
#include "imagehelpers.h"
#include "image.h"
//==========================================================================
//
@ -47,7 +48,7 @@
//
//==========================================================================
class FAutomapTexture : public FWorldTexture
class FAutomapTexture : public FImageSource
{
public:
FAutomapTexture(int lumpnum);
@ -65,9 +66,9 @@ public:
FTexture *AutomapTexture_TryCreate(FileReader &data, int lumpnum)
{
if (data.GetLength() < 320) return NULL;
if (!Wads.CheckLumpName(lumpnum, "AUTOPAGE")) return NULL;
return new FAutomapTexture(lumpnum);
if (data.GetLength() < 320) return nullptr;
if (!Wads.CheckLumpName(lumpnum, "AUTOPAGE")) return nullptr;
return new FImageTexture(new FAutomapTexture(lumpnum));
}
//==========================================================================
@ -77,10 +78,11 @@ FTexture *AutomapTexture_TryCreate(FileReader &data, int lumpnum)
//==========================================================================
FAutomapTexture::FAutomapTexture (int lumpnum)
: FWorldTexture(NULL, lumpnum)
: FImageSource(lumpnum)
{
Width = 320;
Height = uint16_t(Wads.LumpLength(lumpnum) / 320);
bUseGamePalette = true;
}
//==========================================================================

View file

@ -39,17 +39,17 @@
#include "r_data/r_translate.h"
#include "bitmap.h"
#include "v_video.h"
#include "image.h"
class FBrightmapTexture : public FWorldTexture
class FBrightmapTexture : public FImageSource
{
public:
FBrightmapTexture (FTexture *source);
FBrightmapTexture (FImageSource *source);
int CopyPixels(FBitmap *bmp) override;
bool UseBasePalette() override { return false; }
protected:
FTexture *SourcePic;
FImageSource *SourcePic;
};
//===========================================================================
@ -60,17 +60,12 @@ protected:
//
//===========================================================================
FBrightmapTexture::FBrightmapTexture (FTexture *source)
FBrightmapTexture::FBrightmapTexture (FImageSource *source)
{
Name = "";
SourcePic = source;
CopySize(source);
bNoDecals = true;
Rotations = 0xffff;
UseType = ETextureType::Override;
Width = source->GetWidth();
Height = source->GetHeight();
bMasked = false;
id.SetInvalid();
SourceLump = -1;
}
int FBrightmapTexture::CopyPixels(FBitmap *bmp)
@ -79,7 +74,7 @@ int FBrightmapTexture::CopyPixels(FBitmap *bmp)
return 0;
}
FTexture *CreateBrightmapTexture(FTexture *tex)
FTexture *CreateBrightmapTexture(FImageSource *tex)
{
return new FBrightmapTexture(tex);
return new FImageTexture(new FBrightmapTexture(tex));
}

View file

@ -44,6 +44,7 @@
#include "textures/textures.h"
#include "r_data/sprites.h"
#include "resourcefiles/resourcefile.h"
#include "image.h"
//==========================================================================
@ -52,13 +53,12 @@
//
//==========================================================================
class FBuildTexture : public FWorldTexture
class FBuildTexture : public FImageSource
{
public:
FBuildTexture (const FString &pathprefix, int tilenum, const uint8_t *pixels, int translation, int width, int height, int left, int top);
TArray<uint8_t> Get8BitPixels(bool alphatex) override;
int CopyPixels(FBitmap *bmp) override;
bool UseBasePalette() override { return false; }
protected:
const uint8_t *RawPixels;
@ -77,10 +77,8 @@ FBuildTexture::FBuildTexture(const FString &pathprefix, int tilenum, const uint8
{
Width = width;
Height = height;
_LeftOffset[1] = _LeftOffset[0] = left;
_TopOffset[1] = _TopOffset[0] = top;
Name.Format("%sBTIL%04d", pathprefix.GetChars(), tilenum);
UseType = ETextureType::Override;
LeftOffset = left;
TopOffset = top;
}
TArray<uint8_t> FBuildTexture::Get8BitPixels(bool alphatex)
@ -136,9 +134,12 @@ void FTextureManager::AddTiles (const FString &pathprefix, const void *tiles, in
if (width <= 0 || height <= 0) continue;
tex = new FBuildTexture (pathprefix, i, tiledata, translation, width, height, xoffs, yoffs);
tex = new FImageTexture(new FBuildTexture (pathprefix, i, tiledata, translation, width, height, xoffs, yoffs));
texnum = AddTexture (tex);
tiledata += size;
tex->Name.Format("%sBTIL%04d", pathprefix.GetChars(), i);
tex->UseType = ETextureType::Override;
// reactivate only if the texture counter works here.
//StartScreen->Progress();

View file

@ -54,6 +54,7 @@
#include "bitmap.h"
#include "v_video.h"
#include "imagehelpers.h"
#include "image.h"
// Since we want this to compile under Linux too, we need to define this
// stuff ourselves instead of including a DirectX header.
@ -152,7 +153,7 @@ struct DDSFileHeader
//
//==========================================================================
class FDDSTexture : public FWorldTexture
class FDDSTexture : public FImageSource
{
enum
{
@ -273,7 +274,7 @@ FTexture *DDSTexture_TryCreate (FileReader &data, int lumpnum)
{
return NULL;
}
return new FDDSTexture (data, lumpnum, &surfdesc);
return new FImageTexture(new FDDSTexture (data, lumpnum, &surfdesc));
}
//==========================================================================
@ -283,13 +284,11 @@ FTexture *DDSTexture_TryCreate (FileReader &data, int lumpnum)
//==========================================================================
FDDSTexture::FDDSTexture (FileReader &lump, int lumpnum, void *vsurfdesc)
: FWorldTexture(NULL, lumpnum)
: FImageSource(lumpnum)
{
DDSURFACEDESC2 *surf = (DDSURFACEDESC2 *)vsurfdesc;
UseType = ETextureType::MiscPatch;
bMasked = false;
Width = uint16_t(surf->Width);
Height = uint16_t(surf->Height);

View file

@ -39,6 +39,7 @@
#include "files.h"
#include "w_wad.h"
#include "textures/textures.h"
#include "image.h"
//==========================================================================
//
@ -46,7 +47,7 @@
//
//==========================================================================
class FEmptyTexture : public FWorldTexture
class FEmptyTexture : public FImageSource
{
public:
FEmptyTexture (int lumpnum);
@ -67,7 +68,7 @@ FTexture *EmptyTexture_TryCreate(FileReader & file, int lumpnum)
if (file.Read(check, 8) != 8) return NULL;
if (memcmp(check, "\0\0\0\0\0\0\0\0", 8)) return NULL;
return new FEmptyTexture(lumpnum);
return new FImageTexture(new FEmptyTexture(lumpnum));
}
//==========================================================================
@ -77,10 +78,11 @@ FTexture *EmptyTexture_TryCreate(FileReader & file, int lumpnum)
//==========================================================================
FEmptyTexture::FEmptyTexture (int lumpnum)
: FWorldTexture(NULL, lumpnum)
: FImageSource(lumpnum)
{
bMasked = true;
Width = Height = 1;
bUseGamePalette = true;
}
//==========================================================================

View file

@ -38,6 +38,7 @@
#include "w_wad.h"
#include "textures/textures.h"
#include "imagehelpers.h"
#include "image.h"
//==========================================================================
//
@ -45,7 +46,7 @@
//
//==========================================================================
class FFlatTexture : public FWorldTexture
class FFlatTexture : public FImageSource
{
public:
FFlatTexture (int lumpnum);
@ -63,7 +64,7 @@ public:
FTexture *FlatTexture_TryCreate(FileReader & file, int lumpnum)
{
return new FFlatTexture(lumpnum);
return new FImageTexture(new FFlatTexture(lumpnum));
}
//==========================================================================
@ -73,7 +74,7 @@ FTexture *FlatTexture_TryCreate(FileReader & file, int lumpnum)
//==========================================================================
FFlatTexture::FFlatTexture (int lumpnum)
: FWorldTexture(NULL, lumpnum)
: FImageSource(lumpnum)
{
int area;
int bits;
@ -91,6 +92,7 @@ FFlatTexture::FFlatTexture (int lumpnum)
case 256*256: bits = 8; break;
}
bUseGamePalette = true;
bMasked = false;
bTranslucent = false;
Width = Height = 1 << bits;

View file

@ -39,6 +39,7 @@
#include "v_video.h"
#include "bitmap.h"
#include "imagehelpers.h"
#include "image.h"
bool checkIMGZPalette(FileReader &file);
@ -50,7 +51,7 @@ bool checkIMGZPalette(FileReader &file);
//
//==========================================================================
class FIMGZTexture : public FWorldTexture
class FIMGZTexture : public FImageSource
{
struct ImageHeader
{
@ -69,8 +70,6 @@ public:
FIMGZTexture (int lumpnum, uint16_t w, uint16_t h, int16_t l, int16_t t, bool isalpha);
TArray<uint8_t> Get8BitPixels(bool alphatex) override;
int CopyPixels(FBitmap *bmp) override;
bool UseBasePalette() override { return !isalpha; }
};
@ -95,7 +94,7 @@ FTexture *IMGZTexture_TryCreate(FileReader & file, int lumpnum)
l = file.ReadInt16();
t = file.ReadInt16();
ispalette = checkIMGZPalette(file);
return new FIMGZTexture(lumpnum, w, h, l, t, !ispalette);
return new FImageTexture(new FIMGZTexture(lumpnum, w, h, l, t, !ispalette));
}
//==========================================================================
@ -105,14 +104,14 @@ FTexture *IMGZTexture_TryCreate(FileReader & file, int lumpnum)
//==========================================================================
FIMGZTexture::FIMGZTexture (int lumpnum, uint16_t w, uint16_t h, int16_t l, int16_t t, bool _isalpha)
: FWorldTexture(NULL, lumpnum)
: FImageSource(lumpnum)
{
Wads.GetLumpName (Name, lumpnum);
Width = w;
Height = h;
_LeftOffset[1] = _LeftOffset[0] = l;
_TopOffset[1] = _TopOffset[0] = t;
LeftOffset = l;
TopOffset = t;
isalpha = _isalpha;
bUseGamePalette = !isalpha;
}
//==========================================================================
@ -203,7 +202,7 @@ TArray<uint8_t> FIMGZTexture::Get8BitPixels(bool alphatex)
int FIMGZTexture::CopyPixels(FBitmap *bmp)
{
if (!isalpha) return FTexture::CopyPixels(bmp);
if (!isalpha) return FImageSource::CopyPixels(bmp);
else return CopyTranslatedPixels(bmp, translationtables[TRANSLATION_Standard][STD_Grayscale]->Palette);
}

View file

@ -46,6 +46,7 @@ extern "C"
#include "bitmap.h"
#include "v_video.h"
#include "imagehelpers.h"
#include "image.h"
struct FLumpSourceMgr : public jpeg_source_mgr
@ -179,13 +180,12 @@ void JPEG_OutputMessage (j_common_ptr cinfo)
//
//==========================================================================
class FJPEGTexture : public FWorldTexture
class FJPEGTexture : public FImageSource
{
public:
FJPEGTexture (int lumpnum, int width, int height);
int CopyPixels(FBitmap *bmp) override;
bool UseBasePalette() override;
TArray<uint8_t> Get8BitPixels(bool alphatex) override;
};
@ -236,7 +236,7 @@ FTexture *JPEGTexture_TryCreate(FileReader & data, int lumpnum)
{
return NULL;
}
return new FJPEGTexture (lumpnum, BigShort(first4bytes.w[1]), BigShort(first4bytes.w[0]));
return new FImageTexture(new FJPEGTexture (lumpnum, BigShort(first4bytes.w[1]), BigShort(first4bytes.w[0])));
}
//==========================================================================
@ -246,9 +246,8 @@ FTexture *JPEGTexture_TryCreate(FileReader & data, int lumpnum)
//==========================================================================
FJPEGTexture::FJPEGTexture (int lumpnum, int width, int height)
: FWorldTexture(NULL, lumpnum)
: FImageSource(lumpnum)
{
UseType = ETextureType::MiscPatch;
bMasked = false;
Width = width;
@ -463,13 +462,3 @@ int FJPEGTexture::CopyPixels(FBitmap *bmp)
return 0;
}
//===========================================================================
//
//
//===========================================================================
bool FJPEGTexture::UseBasePalette()
{
return false;
}

View file

@ -146,7 +146,7 @@ struct FPatchLookup
//
//==========================================================================
class FMultiPatchTexture : public FWorldTexture
class FMultiPatchTexture : public FTexture
{
public:
FMultiPatchTexture (const void *texdef, FPatchLookup *patchlookup, int maxpatchnum, bool strife, int deflump);

View file

@ -40,6 +40,7 @@
#include "bitmap.h"
#include "v_video.h"
#include "imagehelpers.h"
#include "image.h"
//==========================================================================
//
@ -79,13 +80,12 @@ struct PCXHeader
//
//==========================================================================
class FPCXTexture : public FWorldTexture
class FPCXTexture : public FImageSource
{
public:
FPCXTexture (int lumpnum, PCXHeader &);
int CopyPixels(FBitmap *bmp) override;
bool UseBasePalette() override;
protected:
void ReadPCX1bit (uint8_t *dst, FileReader & lump, PCXHeader *hdr);
@ -132,7 +132,7 @@ FTexture * PCXTexture_TryCreate(FileReader & file, int lumpnum)
file.Seek(0, FileReader::SeekSet);
file.Read(&hdr, sizeof(hdr));
return new FPCXTexture(lumpnum, hdr);
return new FImageTexture(new FPCXTexture(lumpnum, hdr));
}
//==========================================================================
@ -142,7 +142,7 @@ FTexture * PCXTexture_TryCreate(FileReader & file, int lumpnum)
//==========================================================================
FPCXTexture::FPCXTexture(int lumpnum, PCXHeader & hdr)
: FWorldTexture(NULL, lumpnum)
: FImageSource(lumpnum)
{
bMasked = false;
Width = LittleShort(hdr.xmax) - LittleShort(hdr.xmin) + 1;
@ -513,13 +513,3 @@ int FPCXTexture::CopyPixels(FBitmap *bmp)
return 0;
}
//===========================================================================
//
//
//===========================================================================
bool FPCXTexture::UseBasePalette()
{
return false;
}

View file

@ -40,6 +40,7 @@
#include "m_png.h"
#include "bitmap.h"
#include "imagehelpers.h"
#include "image.h"
//==========================================================================
//
@ -47,7 +48,7 @@
//
//==========================================================================
class FPNGTexture : public FWorldTexture
class FPNGTexture : public FImageSource
{
public:
FPNGTexture (FileReader &lump, int lumpnum, const FString &filename, int width, int height, uint8_t bitdepth, uint8_t colortype, uint8_t interlace);
@ -141,7 +142,7 @@ FTexture *PNGTexture_TryCreate(FileReader & data, int lumpnum)
}
}
return new FPNGTexture (data, lumpnum, FString(), width, height, bitdepth, colortype, interlace);
return new FImageTexture(new FPNGTexture (data, lumpnum, FString(), width, height, bitdepth, colortype, interlace));
}
//==========================================================================

View file

@ -40,6 +40,7 @@
#include "bitmap.h"
#include "textures/textures.h"
#include "imagehelpers.h"
#include "image.h"
//==========================================================================
@ -48,7 +49,7 @@
//
//==========================================================================
class FRawPageTexture : public FWorldTexture
class FRawPageTexture : public FImageSource
{
int mPaletteLump = -1;
public:
@ -73,9 +74,9 @@ static bool CheckIfRaw(FileReader & data)
int height;
int width;
foo = (patch_t *)M_Malloc (data.GetLength());
data.Seek (0, FileReader::SeekSet);
data.Read (foo, data.GetLength());
data.Seek(0, FileReader::SeekSet);
auto bits = data.Read(data.GetLength());
foo = (patch_t *)bits.Data();;
height = LittleShort(foo->height);
width = LittleShort(foo->width);
@ -98,7 +99,6 @@ static bool CheckIfRaw(FileReader & data)
}
else if (ofs >= 64000-1) // Need one byte for an empty column
{
M_Free (foo);
return true;
}
else
@ -109,29 +109,24 @@ static bool CheckIfRaw(FileReader & data)
{
if (foo2[ofs] == 255)
{
M_Free (foo);
return true;
}
ofs += foo2[ofs+1] + 4;
}
if (ofs >= 64000)
{
M_Free (foo);
return true;
}
}
}
if (gapAtStart || (x != width))
{
M_Free (foo);
return true;
}
M_Free(foo);
return false;
}
else
{
M_Free (foo);
return true;
}
}
@ -144,8 +139,8 @@ static bool CheckIfRaw(FileReader & data)
FTexture *RawPageTexture_TryCreate(FileReader & file, int lumpnum)
{
if (!CheckIfRaw(file)) return NULL;
return new FRawPageTexture(lumpnum);
if (!CheckIfRaw(file)) return nullptr;
return new FImageTexture(new FRawPageTexture(lumpnum));
}
@ -156,17 +151,20 @@ FTexture *RawPageTexture_TryCreate(FileReader & file, int lumpnum)
//==========================================================================
FRawPageTexture::FRawPageTexture (int lumpnum)
: FWorldTexture(NULL, lumpnum)
: FImageSource(lumpnum)
{
Width = 320;
Height = 200;
// Special case hack for Heretic's E2 end pic. This is not going to be exposed as an editing feature because the implications would be horrible.
FString Name;
Wads.GetLumpName(Name, lumpnum);
if (Name.CompareNoCase("E2END") == 0 && gameinfo.gametype == GAME_Heretic)
{
mPaletteLump = Wads.CheckNumForName("E2PAL");
if (Wads.LumpLength(mPaletteLump) < 768) mPaletteLump = -1;
}
else bUseGamePalette = true;
}
//==========================================================================
@ -206,7 +204,7 @@ TArray<uint8_t> FRawPageTexture::Get8BitPixels(bool alphatex)
int FRawPageTexture::CopyPixels(FBitmap *bmp)
{
if (mPaletteLump < 0) return FTexture::CopyPixels(bmp);
if (mPaletteLump < 0) return FImageSource::CopyPixels(bmp);
else
{
FMemLump lump = Wads.ReadLump(SourceLump);

View file

@ -40,16 +40,16 @@
#include "w_wad.h"
#include "bitmap.h"
#include "imagehelpers.h"
#include "image.h"
class FBarShader : public FWorldTexture
class FBarShader : public FImageSource
{
public:
FBarShader(bool vertical, bool reverse)
{
int i;
Name.Format("BarShader%c%c", vertical ? 'v' : 'h', reverse ? 'r' : 'f');
Width = vertical ? 2 : 256;
Height = vertical ? 256 : 2;
bMasked = false;
@ -126,12 +126,6 @@ public:
return 0;
}
bool UseBasePalette() override
{
return false;
}
private:
uint8_t Pixels[512];
};
@ -139,5 +133,6 @@ private:
FTexture *CreateShaderTexture(bool vertical, bool reverse)
{
return new FBarShader(vertical, reverse);
FStringf name("BarShader%c%c", vertical ? 'v' : 'h', reverse ? 'r' : 'f');
auto tex = new FImageTexture(new FBarShader(vertical, reverse), name.GetChars());
}

View file

@ -40,6 +40,7 @@
#include "bitmap.h"
#include "v_video.h"
#include "imagehelpers.h"
#include "image.h"
//==========================================================================
@ -75,13 +76,12 @@ struct TGAHeader
//
//==========================================================================
class FTGATexture : public FWorldTexture
class FTGATexture : public FImageSource
{
public:
FTGATexture (int lumpnum, TGAHeader *);
int CopyPixels(FBitmap *bmp) override;
bool UseBasePalette() override;
protected:
void ReadCompressed(FileReader &lump, uint8_t * buffer, int bytesperpixel);
@ -119,7 +119,7 @@ FTexture *TGATexture_TryCreate(FileReader & file, int lumpnum)
hdr.width = LittleShort(hdr.width);
hdr.height = LittleShort(hdr.height);
return new FTGATexture(lumpnum, &hdr);
return new FImageTexture(new FTGATexture(lumpnum, &hdr));
}
//==========================================================================
@ -129,9 +129,8 @@ FTexture *TGATexture_TryCreate(FileReader & file, int lumpnum)
//==========================================================================
FTGATexture::FTGATexture (int lumpnum, TGAHeader * hdr)
: FWorldTexture(NULL, lumpnum)
: FImageSource(lumpnum)
{
Wads.GetLumpName (Name, lumpnum);
Width = hdr->width;
Height = hdr->height;
// Alpha channel is used only for 32 bit RGBA and paletted images with RGBA palettes.
@ -534,13 +533,3 @@ int FTGATexture::CopyPixels(FBitmap *bmp)
delete [] sbuffer;
return transval;
}
//===========================================================================
//
//
//===========================================================================
bool FTGATexture::UseBasePalette()
{
return false;
}

View file

@ -1,49 +0,0 @@
/*
** worldtexture.cpp
** Intermediate class for some common code for several classes
**
**---------------------------------------------------------------------------
** Copyright 2018 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
**
*/
#include "textures.h"
//==========================================================================
//
//
//
//==========================================================================
FWorldTexture::FWorldTexture(const char *name, int lumpnum)
: FTexture(name, lumpnum)
{
}

View file

@ -81,12 +81,13 @@ public:
//
//==========================================================================
class FImageTexture : public FWorldTexture
class FImageTexture : public FTexture
{
FImageSource *mImage;
public:
FImageTexture (FImageSource *image);
FImageTexture (FImageSource *image, const char *name = nullptr);
virtual TArray<uint8_t> Get8BitPixels(bool alphatex);
FImageSource *GetImage() const { return mImage; }
bool UseBasePalette() override;

View file

@ -48,8 +48,8 @@
//
//==========================================================================
FImageTexture::FImageTexture(FImageSource *img)
: FWorldTexture(nullptr, img->LumpNum())
FImageTexture::FImageTexture(FImageSource *img, const char *name)
: FWorldTexture(name, img->LumpNum())
{
mImage = img;
Wads.GetLumpName (Name, img->LumpNum());

View file

@ -49,8 +49,9 @@
#include "hwrenderer/textures/hw_ihwtexture.h"
#include "swrenderer/textures/r_swtexture.h"
#include "imagehelpers.h"
#include "image.h"
FTexture *CreateBrightmapTexture(FTexture*);
FTexture *CreateBrightmapTexture(FImageSource*);
// Make sprite offset adjustment user-configurable per renderer.
int r_spriteadjustSW, r_spriteadjustHW;
@ -537,7 +538,7 @@ void FTexture::CreateDefaultBrightmap()
{
// Create a brightmap
DPrintf(DMSG_NOTIFY, "brightmap created for texture '%s'\n", Name.GetChars());
Brightmap = CreateBrightmapTexture(this);
Brightmap = CreateBrightmapTexture(static_cast<FImageTexture*>(this)->GetImage());
bBrightmapChecked = true;
TexMan.AddTexture(Brightmap);
return;

View file

@ -670,14 +670,6 @@ public:
};
// base class for everything that can be used as a world texture.
// This intermediate class encapsulates the buffers for the software renderer.
class FWorldTexture : public FTexture
{
protected:
FWorldTexture(const char *name = nullptr, int lumpnum = -1);
};
// A texture that doesn't really exist
class FDummyTexture : public FTexture
{