mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 03:40:50 +00:00
- fix compilation.
This commit is contained in:
parent
72c323cf32
commit
6bd4f77c5b
6 changed files with 5 additions and 65 deletions
|
@ -270,7 +270,7 @@ void palettePostLoadLookups(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef SWAP_255
|
||||
#if 1 //def SWAP_255
|
||||
// Swap colors 0 and 255 in all tables so that all paletted images have their transparent color at index 0.
|
||||
// This means:
|
||||
// - Swap palette and remap entries in all stored remap tables
|
||||
|
|
|
@ -45,10 +45,8 @@ private:
|
|||
|
||||
TranslatedTexture * GetTexID(int translation, bool expanded)
|
||||
{
|
||||
#if 0
|
||||
auto remap = GPalette.TranslationToTable(translation);
|
||||
translation = remap == nullptr ? 0 : remap->Index;
|
||||
#endif
|
||||
|
||||
if (translation == 0)
|
||||
{
|
||||
|
|
|
@ -865,58 +865,3 @@ FWrapperTexture::FWrapperTexture(int w, int h, int bits)
|
|||
SystemTextures.AddHardwareTexture(0, false, hwtex);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Initializes the buffer for the texture data
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
FTextureBuffer FTexture::CreateTexBuffer(const PalEntry* remap, int flags)
|
||||
{
|
||||
FTextureBuffer result;
|
||||
|
||||
unsigned char* buffer = nullptr;
|
||||
int W, H;
|
||||
int isTransparent = -1;
|
||||
bool checkonly = !!(flags & CTF_CheckOnly);
|
||||
|
||||
W = GetTexelWidth();
|
||||
H = GetTexelHeight();
|
||||
|
||||
if (!checkonly)
|
||||
{
|
||||
buffer = new unsigned char[W * (H + 1) * 4];
|
||||
memset(buffer, 0, W * (H + 1) * 4);
|
||||
|
||||
FBitmap bmp(buffer, W * 4, W, H);
|
||||
|
||||
int trans = -1;
|
||||
auto Pixels = GetBgraBitmap(remap, &trans);
|
||||
bmp.Blit(0, 0, Pixels);
|
||||
|
||||
if (remap == nullptr)
|
||||
{
|
||||
CheckTrans(buffer, W * H, trans);
|
||||
isTransparent = bTranslucent;
|
||||
}
|
||||
else
|
||||
{
|
||||
isTransparent = 0;
|
||||
// A translated image is not conclusive for setting the texture's transparency info.
|
||||
}
|
||||
}
|
||||
|
||||
result.mBuffer = buffer;
|
||||
result.mWidth = W;
|
||||
result.mHeight = H;
|
||||
|
||||
// Only do postprocessing for image-backed textures. (i.e. not for the burn texture which can also pass through here.)
|
||||
if (flags & CTF_ProcessData)
|
||||
{
|
||||
if (!checkonly) ProcessData(result.mBuffer, result.mWidth, result.mHeight, false);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -436,7 +436,6 @@ protected:
|
|||
|
||||
public:
|
||||
FTextureBuffer CreateTexBuffer(int translation, int flags = 0);
|
||||
FTextureBuffer CreateTexBuffer(const PalEntry* translation, int flags = 0);
|
||||
|
||||
virtual bool DetermineTranslucency();
|
||||
bool GetTranslucency()
|
||||
|
|
|
@ -113,7 +113,7 @@ static FTexture* GetTileTexture(const char* name, const TArray<uint8_t>& backing
|
|||
auto tex = new FArtTile(backingstore, offset, width, height);
|
||||
auto p = &backingstore[offset];
|
||||
auto siz = width * height;
|
||||
#ifdef SWAP_255
|
||||
#if 1 //def SWAP_255
|
||||
for (int i = 0; i < siz; i++, p++)
|
||||
{
|
||||
// move transparent color to index 0 to get in line with the rest of the texture management.
|
||||
|
@ -509,7 +509,7 @@ int32_t tileGetCRC32(int tileNum)
|
|||
auto size = tile->GetWidth() * tile->GetHeight();
|
||||
if (size == 0) return 0;
|
||||
|
||||
#ifdef SWAP_255
|
||||
#if 1 //def SWAP_255
|
||||
// Temporarily revert the data to its original form with 255 being transparent. Otherwise the CRC won't match.
|
||||
auto p = pixels;
|
||||
for (int i = 0; i < size; i++, p++)
|
||||
|
@ -522,7 +522,7 @@ int32_t tileGetCRC32(int tileNum)
|
|||
|
||||
auto crc = crc32(0, (const Bytef*)pixels, size);
|
||||
|
||||
#if 0
|
||||
#if 1 //def SWAP_255
|
||||
// ... and back again.
|
||||
p = pixels;
|
||||
for (int i = 0; i < size; i++, p++)
|
||||
|
|
|
@ -90,9 +90,7 @@ FHardwareTexture* GLInstance::CreateIndexedTexture(FTexture* tex)
|
|||
|
||||
FHardwareTexture* GLInstance::CreateTrueColorTexture(FTexture* tex, int palid, bool checkfulltransparency, bool rgb8bit)
|
||||
{
|
||||
auto palette = palid < 0? nullptr : palmanager.GetPaletteData(palid);
|
||||
if (palid >= 0 && palette == nullptr) return nullptr;
|
||||
auto texbuffer = tex->CreateTexBuffer(palette, checkfulltransparency? 0: CTF_ProcessData);
|
||||
auto texbuffer = tex->CreateTexBuffer(palid, checkfulltransparency? 0: CTF_ProcessData);
|
||||
// Check if the texture is fully transparent. When creating a brightmap such textures can be discarded.
|
||||
if (checkfulltransparency)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue