mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- started separating the texture class from the image format handlers.
This commit is contained in:
parent
e35d88e039
commit
5eab944157
16 changed files with 297 additions and 129 deletions
|
@ -1098,6 +1098,8 @@ set (PCH_SOURCES
|
|||
textures/anim_switches.cpp
|
||||
textures/bitmap.cpp
|
||||
textures/texture.cpp
|
||||
textures/image.cpp
|
||||
textures/imagetexture.cpp
|
||||
textures/texturemanager.cpp
|
||||
textures/skyboxtexture.cpp
|
||||
textures/formats/automaptexture.cpp
|
||||
|
|
|
@ -386,6 +386,8 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p
|
|||
{
|
||||
noaccel = true;
|
||||
}
|
||||
#if 0
|
||||
// The HW 2D drawer should be able to handle this without problems
|
||||
// If the main colormap has fixed lights, and this sprite is being drawn with that
|
||||
// colormap, disable acceleration so that the lights can remain fixed.
|
||||
PolyCameraLight *cameraLight = PolyCameraLight::Instance();
|
||||
|
@ -395,6 +397,7 @@ void RenderPolyPlayerSprites::RenderSprite(PolyRenderThread *thread, DPSprite *p
|
|||
{
|
||||
noaccel = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
TArray<uint8_t> Get8BitPixels(bool alphatex) override;
|
||||
int CopyPixels(FBitmap *bmp) override;
|
||||
bool UseBasePalette() override { return false; }
|
||||
FTextureFormat GetFormat() override { return TEX_RGB; }
|
||||
|
||||
protected:
|
||||
const uint8_t *RawPixels;
|
||||
|
|
|
@ -163,7 +163,6 @@ class FDDSTexture : public FWorldTexture
|
|||
public:
|
||||
FDDSTexture (FileReader &lump, int lumpnum, void *surfdesc);
|
||||
|
||||
FTextureFormat GetFormat () override;
|
||||
TArray<uint8_t> Get8BitPixels(bool alphatex) override;
|
||||
|
||||
protected:
|
||||
|
@ -375,30 +374,6 @@ void FDDSTexture::CalcBitShift (uint32_t mask, uint8_t *lshiftp, uint8_t *rshift
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTextureFormat FDDSTexture::GetFormat()
|
||||
{
|
||||
#if 0
|
||||
switch (Format)
|
||||
{
|
||||
case ID_DXT1: return TEX_DXT1;
|
||||
case ID_DXT2: return TEX_DXT2;
|
||||
case ID_DXT3: return TEX_DXT3;
|
||||
case ID_DXT4: return TEX_DXT4;
|
||||
case ID_DXT5: return TEX_DXT5;
|
||||
default: return TEX_RGB;
|
||||
}
|
||||
#else
|
||||
// For now, create a true color texture to preserve all colors.
|
||||
return TEX_RGB;
|
||||
#endif
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
TArray<uint8_t> FDDSTexture::Get8BitPixels(bool alphatex)
|
||||
{
|
||||
auto lump = Wads.OpenLumpReader (SourceLump);
|
||||
|
|
|
@ -71,7 +71,6 @@ public:
|
|||
int CopyPixels(FBitmap *bmp) override;
|
||||
|
||||
bool UseBasePalette() override { return !isalpha; }
|
||||
FTextureFormat GetFormat() override { return isalpha ? TEX_RGB : TEX_Pal; } // should be TEX_Gray instead of TEX_RGB. Maybe later when all is working.
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -184,7 +184,6 @@ class FJPEGTexture : public FWorldTexture
|
|||
public:
|
||||
FJPEGTexture (int lumpnum, int width, int height);
|
||||
|
||||
FTextureFormat GetFormat () override;
|
||||
int CopyPixels(FBitmap *bmp) override;
|
||||
bool UseBasePalette() override;
|
||||
TArray<uint8_t> Get8BitPixels(bool alphatex) override;
|
||||
|
@ -262,17 +261,6 @@ FJPEGTexture::FJPEGTexture (int lumpnum, int width, int height)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTextureFormat FJPEGTexture::GetFormat()
|
||||
{
|
||||
return TEX_RGB;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
TArray<uint8_t> FJPEGTexture::Get8BitPixels(bool doalpha)
|
||||
{
|
||||
auto lump = Wads.OpenLumpReader (SourceLump);
|
||||
|
|
|
@ -153,7 +153,6 @@ public:
|
|||
FMultiPatchTexture (FScanner &sc, ETextureType usetype);
|
||||
~FMultiPatchTexture ();
|
||||
|
||||
FTextureFormat GetFormat() override;
|
||||
bool UseBasePalette() override;
|
||||
virtual void SetFrontSkyLayer () override;
|
||||
|
||||
|
@ -523,22 +522,6 @@ int FMultiPatchTexture::CopyPixels(FBitmap *bmp)
|
|||
return retv;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FMultiPatchTexture :: GetFormat
|
||||
//
|
||||
// only returns 'paletted' if all patches use the base palette.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FTextureFormat FMultiPatchTexture::GetFormat()
|
||||
{
|
||||
if (bComplex) return TEX_RGB;
|
||||
if (NumParts == 1) return Parts[0].Texture->GetFormat();
|
||||
return UseBasePalette() ? TEX_Pal : TEX_RGB;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FMultipatchTexture::UseBasePalette
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "v_palette.h"
|
||||
#include "v_video.h"
|
||||
#include "bitmap.h"
|
||||
#include "image.h"
|
||||
#include "imagehelpers.h"
|
||||
|
||||
|
||||
|
@ -57,18 +58,16 @@ bool checkPatchForAlpha(const void *buffer, uint32_t length);
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
class FPatchTexture : public FWorldTexture
|
||||
class FPatchTexture : public FImageSource
|
||||
{
|
||||
bool badflag = false;
|
||||
bool isalpha = false;
|
||||
bool bNoRemap0 = false; // Unfortunately this was done as a very bad hack in ZDoom and will need impovement
|
||||
public:
|
||||
FPatchTexture (int lumpnum, patch_t *header, bool isalphatex);
|
||||
TArray<uint8_t> Get8BitPixels(bool alphatex) override;
|
||||
int CopyPixels(FBitmap *bmp) override;
|
||||
void DetectBadPatches();
|
||||
|
||||
bool UseBasePalette() override { return !isalpha; }
|
||||
FTextureFormat GetFormat() override { return isalpha ? TEX_RGB : TEX_Pal; } // should be TEX_Gray instead of TEX_RGB. Maybe later when all is working.
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
|
@ -81,11 +80,10 @@ static bool CheckIfPatch(FileReader & file, bool &isalpha)
|
|||
{
|
||||
if (file.GetLength() < 13) return false; // minimum length of a valid Doom patch
|
||||
|
||||
uint8_t *data = new uint8_t[file.GetLength()];
|
||||
file.Seek(0, FileReader::SeekSet);
|
||||
file.Read(data, file.GetLength());
|
||||
auto data = file.Read(file.GetLength());
|
||||
|
||||
const patch_t *foo = (const patch_t *)data;
|
||||
const patch_t *foo = (const patch_t *)data.Data();
|
||||
|
||||
int height = LittleShort(foo->height);
|
||||
int width = LittleShort(foo->width);
|
||||
|
@ -108,7 +106,6 @@ static bool CheckIfPatch(FileReader & file, bool &isalpha)
|
|||
}
|
||||
else if (ofs >= (uint32_t)(file.GetLength())) // Need one byte for an empty column (but there's patches that don't know that!)
|
||||
{
|
||||
delete [] data;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -116,12 +113,10 @@ static bool CheckIfPatch(FileReader & file, bool &isalpha)
|
|||
{
|
||||
// only check this if the texture passed validation.
|
||||
// Here is a good point because we already have a valid buffer of the lump's data.
|
||||
isalpha = checkPatchForAlpha(data, (uint32_t)file.GetLength());
|
||||
isalpha = checkPatchForAlpha(data.Data(), (uint32_t)file.GetLength());
|
||||
}
|
||||
delete[] data;
|
||||
return !gapAtStart;
|
||||
}
|
||||
delete [] data;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -142,7 +137,7 @@ FTexture *PatchTexture_TryCreate(FileReader & file, int lumpnum)
|
|||
header.height = file.ReadUInt16();
|
||||
header.leftoffset = file.ReadInt16();
|
||||
header.topoffset = file.ReadInt16();
|
||||
return new FPatchTexture(lumpnum, &header, isalpha);
|
||||
return new FImageTexture(new FPatchTexture(lumpnum, &header, isalpha));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -152,13 +147,14 @@ FTexture *PatchTexture_TryCreate(FileReader & file, int lumpnum)
|
|||
//==========================================================================
|
||||
|
||||
FPatchTexture::FPatchTexture (int lumpnum, patch_t * header, bool isalphatex)
|
||||
: FWorldTexture(NULL, lumpnum)
|
||||
: FImageSource(lumpnum)
|
||||
{
|
||||
bUseGamePalette = !isalphatex;
|
||||
isalpha = isalphatex;
|
||||
Width = header->width;
|
||||
Height = header->height;
|
||||
_LeftOffset[1] = _LeftOffset[0] = header->leftoffset;
|
||||
_TopOffset[1] = _TopOffset[0] = header->topoffset;
|
||||
LeftOffset = header->leftoffset;
|
||||
TopOffset = header->topoffset;
|
||||
DetectBadPatches();
|
||||
}
|
||||
|
||||
|
@ -267,7 +263,7 @@ TArray<uint8_t> FPatchTexture::Get8BitPixels(bool alphatex)
|
|||
|
||||
int FPatchTexture::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);
|
||||
}
|
||||
|
||||
|
@ -305,8 +301,8 @@ void FPatchTexture::DetectBadPatches ()
|
|||
return; // More than one post in a column!
|
||||
}
|
||||
}
|
||||
_LeftOffset[1] = _LeftOffset[0] = 0;
|
||||
_TopOffset[1] = _TopOffset[0] = 0;
|
||||
LeftOffset = 0;
|
||||
TopOffset = 0;
|
||||
badflag = true;
|
||||
bMasked = false; // Hacked textures don't have transparent parts.
|
||||
}
|
||||
|
|
|
@ -84,8 +84,6 @@ class FPCXTexture : public FWorldTexture
|
|||
public:
|
||||
FPCXTexture (int lumpnum, PCXHeader &);
|
||||
|
||||
FTextureFormat GetFormat () override;
|
||||
|
||||
int CopyPixels(FBitmap *bmp) override;
|
||||
bool UseBasePalette() override;
|
||||
|
||||
|
@ -157,17 +155,6 @@ FPCXTexture::FPCXTexture(int lumpnum, PCXHeader & hdr)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTextureFormat FPCXTexture::GetFormat()
|
||||
{
|
||||
return TEX_RGB;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FPCXTexture::ReadPCX1bit (uint8_t *dst, FileReader & lump, PCXHeader *hdr)
|
||||
{
|
||||
int y, i, bytes;
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
FPNGTexture (FileReader &lump, int lumpnum, const FString &filename, int width, int height, uint8_t bitdepth, uint8_t colortype, uint8_t interlace);
|
||||
~FPNGTexture();
|
||||
|
||||
FTextureFormat GetFormat () override;
|
||||
int CopyPixels(FBitmap *bmp) override;
|
||||
bool UseBasePalette() override;
|
||||
TArray<uint8_t> Get8BitPixels(bool alphatex) override;
|
||||
|
@ -349,27 +348,6 @@ FPNGTexture::~FPNGTexture ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTextureFormat FPNGTexture::GetFormat()
|
||||
{
|
||||
#if 0
|
||||
switch (ColorType)
|
||||
{
|
||||
case 3: return TEX_Pal;
|
||||
case 0: return TEX_Gray;
|
||||
default: return TEX_RGB;
|
||||
}
|
||||
#else
|
||||
// For now, create a true color texture to preserve all colors.
|
||||
return TEX_RGB;
|
||||
#endif
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FPNGTexture::ReadAlphaRemap(FileReader *lump, uint8_t *alpharemap)
|
||||
{
|
||||
auto p = lump->Tell();
|
||||
|
|
|
@ -80,7 +80,6 @@ class FTGATexture : public FWorldTexture
|
|||
public:
|
||||
FTGATexture (int lumpnum, TGAHeader *);
|
||||
|
||||
FTextureFormat GetFormat () override;
|
||||
int CopyPixels(FBitmap *bmp) override;
|
||||
bool UseBasePalette() override;
|
||||
|
||||
|
@ -145,17 +144,6 @@ FTGATexture::FTGATexture (int lumpnum, TGAHeader * hdr)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTextureFormat FTGATexture::GetFormat()
|
||||
{
|
||||
return TEX_RGB;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FTGATexture::ReadCompressed(FileReader &lump, uint8_t * buffer, int bytesperpixel)
|
||||
{
|
||||
uint8_t data[4];
|
||||
|
|
84
src/textures/image.cpp
Normal file
84
src/textures/image.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
** texture.cpp
|
||||
** The base texture class
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 2004-2007 Randy Heit
|
||||
** Copyright 2006-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 "v_video.h"
|
||||
#include "bitmap.h"
|
||||
#include "image.h"
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// the default just returns an empty texture.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
TArray<uint8_t> FImageSource::Get8BitPixels(bool alphatex)
|
||||
{
|
||||
TArray<uint8_t> Pixels(Width * Height, true);
|
||||
memset(Pixels.Data(), 0, Width * Height);
|
||||
return Pixels;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FImageSource::CopyPixels
|
||||
//
|
||||
// this is the generic case that can handle
|
||||
// any properly implemented texture for software rendering.
|
||||
// Its drawback is that it is limited to the base palette which is
|
||||
// why all classes that handle different palettes should subclass this
|
||||
// method
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
int FImageSource::CopyPixels(FBitmap *bmp)
|
||||
{
|
||||
PalEntry *palette = screen->GetPalette();
|
||||
for(int i=1;i<256;i++) palette[i].a = 255; // set proper alpha values
|
||||
auto ppix = Get8BitPixels(false); // should use composition cache
|
||||
bmp->CopyPixelData(0, 0, ppix.Data(), Width, Height, Height, 1, 0, palette, nullptr);
|
||||
for(int i=1;i<256;i++) palette[i].a = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FImageSource::CopyTranslatedPixels(FBitmap *bmp, PalEntry *remap)
|
||||
{
|
||||
auto ppix = Get8BitPixels(false); // should use composition cache
|
||||
bmp->CopyPixelData(0, 0, ppix.Data(), Width, Height, Height, 1, 0, remap, nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
97
src/textures/image.h
Normal file
97
src/textures/image.h
Normal file
|
@ -0,0 +1,97 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "tarray.h"
|
||||
#include "textures/bitmap.h"
|
||||
|
||||
|
||||
// This represents a naked image. It has no high level logic attached to it.
|
||||
// All it can do is provide raw image data to its users.
|
||||
class FImageSource
|
||||
{
|
||||
friend class FBrightmapImage;
|
||||
protected:
|
||||
int SourceLump;
|
||||
int Width = 0, Height = 0;
|
||||
int LeftOffset = 0, TopOffset = 0; // Offsets stored in the image.
|
||||
bool bUseGamePalette = false; // true if this is an image without its own color set.
|
||||
|
||||
// internal builder functions for true color textures.
|
||||
|
||||
public:
|
||||
|
||||
bool bMasked = true; // Image (might) have holes (Assume true unless proven otherwise!)
|
||||
int8_t bTranslucent = -1; // Image has pixels with a non-0/1 value. (-1 means the user needs to do a real check)
|
||||
|
||||
// Returns the whole texture, paletted and true color versions respectively.
|
||||
virtual TArray<uint8_t> Get8BitPixels(bool alphatex);
|
||||
virtual int CopyPixels(FBitmap *bmp);
|
||||
int CopyTranslatedPixels(FBitmap *bmp, PalEntry *remap);
|
||||
|
||||
// Conversion option
|
||||
enum EType
|
||||
{
|
||||
normal = 0,
|
||||
luminance = 1,
|
||||
noremap0 = 2
|
||||
};
|
||||
|
||||
FImageSource(int sourcelump = -1) : SourceLump(sourcelump) {}
|
||||
virtual ~FImageSource() {}
|
||||
|
||||
// Creates an image from the given lump.
|
||||
static FImageSource *CreateImageSource(int lumpnum);
|
||||
|
||||
int GetWidth() const
|
||||
{
|
||||
return Width;
|
||||
}
|
||||
|
||||
int GetHeight() const
|
||||
{
|
||||
return Height;
|
||||
}
|
||||
|
||||
std::pair<int, int> GetSize() const
|
||||
{
|
||||
return std::make_pair(Width, Height);
|
||||
}
|
||||
|
||||
std::pair<int, int> GetOffsets() const
|
||||
{
|
||||
return std::make_pair(LeftOffset, TopOffset);
|
||||
}
|
||||
|
||||
int LumpNum() const
|
||||
{
|
||||
return SourceLump;
|
||||
}
|
||||
|
||||
bool UseGamePalette() const
|
||||
{
|
||||
return bUseGamePalette;
|
||||
}
|
||||
|
||||
bool UseBasePalette() = delete;
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// a TGA texture
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
class FImageTexture : public FWorldTexture
|
||||
{
|
||||
FImageSource *mImage;
|
||||
public:
|
||||
FImageTexture (FImageSource *image);
|
||||
virtual TArray<uint8_t> Get8BitPixels(bool alphatex);
|
||||
|
||||
bool UseBasePalette() override;
|
||||
|
||||
protected:
|
||||
int CopyPixels(FBitmap *bmp) override;
|
||||
|
||||
};
|
||||
|
97
src/textures/imagetexture.cpp
Normal file
97
src/textures/imagetexture.cpp
Normal file
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
** imagetexture.cpp
|
||||
** Texture class based on FImageSource
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** 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 "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "w_wad.h"
|
||||
#include "templates.h"
|
||||
#include "bitmap.h"
|
||||
#include "v_video.h"
|
||||
#include "image.h"
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FImageTexture::FImageTexture(FImageSource *img)
|
||||
: FWorldTexture(nullptr, img->LumpNum())
|
||||
{
|
||||
mImage = img;
|
||||
Wads.GetLumpName (Name, img->LumpNum());
|
||||
Width = img->GetWidth();
|
||||
Height = img->GetHeight();
|
||||
|
||||
auto offsets = img->GetOffsets();
|
||||
_LeftOffset[1] = _LeftOffset[0] = offsets.first;;
|
||||
_TopOffset[1] = _TopOffset[0] = offsets.second;
|
||||
|
||||
bMasked = img->bMasked;
|
||||
bTranslucent = img->bTranslucent;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
int FImageTexture::CopyPixels(FBitmap *bmp)
|
||||
{
|
||||
return mImage->CopyPixels(bmp);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
TArray<uint8_t> FImageTexture::Get8BitPixels(bool alpha)
|
||||
{
|
||||
return mImage->Get8BitPixels(alpha);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
bool FImageTexture::UseBasePalette()
|
||||
{
|
||||
return mImage->UseGamePalette();
|
||||
}
|
|
@ -240,11 +240,6 @@ FTexture::~FTexture ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FTextureFormat FTexture::GetFormat()
|
||||
{
|
||||
return TEX_Pal;
|
||||
}
|
||||
|
||||
void FTexture::SetFrontSkyLayer ()
|
||||
{
|
||||
bNoRemap0 = true;
|
||||
|
|
|
@ -396,9 +396,6 @@ protected:
|
|||
virtual bool UseBasePalette();
|
||||
virtual FTexture *GetRedirect();
|
||||
|
||||
// Returns the native pixel format for this image
|
||||
virtual FTextureFormat GetFormat();
|
||||
|
||||
void SetSpeed(float fac) { shaderspeed = fac; }
|
||||
|
||||
int GetWidth () { return Width; }
|
||||
|
|
Loading…
Reference in a new issue