- moved several members from FTexture to FGameTexture.

This commit is contained in:
Christoph Oelckers 2020-04-17 18:52:48 +02:00
commit 7641da8b7b
7 changed files with 59 additions and 46 deletions

View file

@ -227,6 +227,8 @@ void FSoftwareRenderer::SetClearColor(int color)
mScene.SetClearColor(color);
}
FSWCanvasTexture* GetSWCamTex(FCanvasTexture* camtex);
void FSoftwareRenderer::RenderTextureView (FCanvasTexture *camtex, AActor *viewpoint, double fov)
{
auto renderTarget = mScene.MainThread()->Viewport->RenderTarget;
@ -237,7 +239,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *camtex, AActor *viewp
cameraViewpoint = r_viewpoint;
cameraViewwindow = r_viewwindow;
auto tex = static_cast<FSWCanvasTexture*>(camtex->GetSoftwareTexture());
auto tex = GetSWCamTex(camtex);
DCanvas *Canvas = renderTarget->IsBgra() ? tex->GetCanvasBgra() : tex->GetCanvas();

View file

@ -176,7 +176,7 @@ class FSWCanvasTexture : public FSoftwareTexture
public:
FSWCanvasTexture(FGameTexture *source) : FSoftwareTexture(source) {}
FSWCanvasTexture(FGameTexture* source);
~FSWCanvasTexture();
// Returns the whole texture, stored in column-major order

View file

@ -39,6 +39,21 @@
#include "m_alloc.h"
#include "imagehelpers.h"
static TMap<FCanvasTexture*, FSWCanvasTexture*> canvasMap;
FSWCanvasTexture* GetSWCamTex(FCanvasTexture* camtex)
{
auto p = canvasMap.CheckKey(camtex);
return p ? *p : nullptr;
}
FSWCanvasTexture::FSWCanvasTexture(FGameTexture* source) : FSoftwareTexture(source)
{
// The SW renderer needs to link the canvas textures, but let's do that outside the texture manager.
auto camtex = static_cast<FCanvasTexture*>(source->GetTexture());
canvasMap.Insert(camtex, this);
}
FSWCanvasTexture::~FSWCanvasTexture()
{