- made FTexture::GetPixels and FTexture::GetColumn non-pure-virtual.

With the software renderer not being used for 2D anymore it would be quite annoying if every texture class had to implement these.
If done properly, the SW renderer should actually be forced to dynamic_cast any texture to a FWorldTexture before using this stuff, but that'd be some pointless overhead better saved.
This commit is contained in:
Christoph Oelckers 2018-04-08 21:19:57 +02:00
parent 3dc670a0cc
commit 551691f42a
3 changed files with 20 additions and 19 deletions

View file

@ -45,9 +45,7 @@ float BaseBlendA;
// using FDummyTexture as base because that implements the required software renderer functions.
class FSWPaletteTexture : public FDummyTexture
class FSWPaletteTexture : public FTexture
{
public:
FSWPaletteTexture()
@ -68,7 +66,7 @@ public:
}
};
class FSWSceneTexture : public FDummyTexture
class FSWSceneTexture : public FTexture
{
public:
FHardwareTexture *hwtex;

View file

@ -1453,6 +1453,22 @@ bool FTexture::GetTranslucency()
return !!bTranslucent;
}
//===========================================================================
//
// empty stubs to be overloaded by child classes.
//
//===========================================================================
const uint8_t *FTexture::GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out)
{
return nullptr;
}
const uint8_t *FTexture::GetPixels(FRenderStyle style)
{
return nullptr;
}
//===========================================================================
//
// Dummy texture for the 0-entry.
@ -1476,17 +1492,6 @@ void FDummyTexture::SetSize (int width, int height)
CalcBitSize ();
}
// These only get called from the texture precacher which discards the result.
const uint8_t *FDummyTexture::GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out)
{
return nullptr;
}
const uint8_t *FDummyTexture::GetPixels(FRenderStyle style)
{
return nullptr;
}
//==========================================================================
//
// Debug stuff

View file

@ -286,13 +286,13 @@ public:
};
// Returns a single column of the texture
virtual const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out) = 0;
virtual const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out);
// Returns a single column of the texture, in BGRA8 format
virtual const uint32_t *GetColumnBgra(unsigned int column, const Span **spans_out);
// Returns the whole texture, stored in column-major order
virtual const uint8_t *GetPixels(FRenderStyle style) = 0;
virtual const uint8_t *GetPixels(FRenderStyle style);
// Returns the whole texture, stored in column-major order, in BGRA8 format
virtual const uint32_t *GetPixelsBgra();
@ -712,8 +712,6 @@ class FDummyTexture : public FTexture
{
public:
FDummyTexture ();
const uint8_t *GetColumn(FRenderStyle style, unsigned int column, const Span **spans_out) override;
const uint8_t *GetPixels(FRenderStyle style) override;
void SetSize (int width, int height);
};