Added true color texture support for walls and floors

This commit is contained in:
Magnus Norddahl 2016-06-10 13:50:34 +02:00
commit 05b6fe6174
9 changed files with 506 additions and 178 deletions

View file

@ -45,6 +45,7 @@
#include "v_video.h"
#include "m_fixed.h"
#include "textures/textures.h"
#include "v_palette.h"
typedef bool (*CheckFunc)(FileReader & file);
typedef FTexture * (*CreateFunc)(FileReader & file, int lumpnum);
@ -175,6 +176,33 @@ FTexture::~FTexture ()
KillNative();
}
const uint32_t *FTexture::GetColumnBgra(unsigned int column, const Span **spans_out)
{
const uint32_t *pixels = GetPixelsBgra();
column %= Width;
if (column < 0)
column += Width;
if (spans_out != nullptr)
GetColumn(column, spans_out);
return pixels + column * Height;
}
const uint32_t *FTexture::GetPixelsBgra()
{
if (BgraPixels.empty())
{
const BYTE *indices = GetPixels();
BgraPixels.resize(Width * Height);
for (int i = 0; i < Width * Height; i++)
{
BgraPixels[i] = GPalette.BaseColors[indices[i]].d;
}
}
return BgraPixels.data();
}
bool FTexture::CheckModified ()
{
return false;