- camtex transition

This commit is contained in:
Christoph Oelckers 2020-05-31 21:43:32 +02:00
parent c26b6cdf59
commit ab2686db34
5 changed files with 10 additions and 11 deletions

View file

@ -5392,7 +5392,7 @@ void renderSetTarget(int16_t tilenume, int32_t xsiz, int32_t ysiz)
return;
OpenGLRenderer::GLRenderer->StartOffscreen();
OpenGLRenderer::GLRenderer->BindToFrameBuffer(tileGetTexture(tilenume));
OpenGLRenderer::GLRenderer->BindToFrameBuffer(tileGetTexture(tilenume)->GetTexture());
//DRAWROOMS TO TILE BACKUP&SET CODE
bakxsiz = xdim; bakysiz = ydim;

View file

@ -217,7 +217,6 @@ void OpenGLFrameBuffer::CopyScreenToBuffer(int width, int height, uint8_t* scr)
void OpenGLFrameBuffer::RenderTextureView(FCanvasTexture* tex, std::function<void(IntRect &)> renderFunc)
{
#if 0
GLRenderer->StartOffscreen();
GLRenderer->BindToFrameBuffer(tex);
@ -231,7 +230,6 @@ void OpenGLFrameBuffer::RenderTextureView(FCanvasTexture* tex, std::function<voi
tex->SetUpdated(true);
static_cast<OpenGLFrameBuffer*>(screen)->camtexcount++;
#endif
}
//===========================================================================

View file

@ -55,7 +55,6 @@
#include "model.h"
#include "gl_postprocessstate.h"
#include "gl_buffers.h"
#include "gl_hwtexture.h"
#include "texturemanager.h"
EXTERN_CVAR(Int, screenblocks)
@ -159,19 +158,19 @@ void FGLRenderer::EndOffscreen()
//
//===========================================================================
void FGLRenderer::BindToFrameBuffer(FGameTexture *mat)
void FGLRenderer::BindToFrameBuffer(FTexture *tex)
{
auto pBaseLayer = mat->GetTexture()->SystemTextures.GetHardwareTexture(0, false);
auto pBaseLayer = tex->SystemTextures.GetHardwareTexture(0, false);
auto BaseLayer = pBaseLayer ? (OpenGLRenderer::FHardwareTexture*)pBaseLayer : nullptr;
if (BaseLayer == nullptr)
{
// must create the hardware texture first
BaseLayer = new FHardwareTexture(4);
BaseLayer->CreateTexture(nullptr, mat->GetTexelWidth() * 4, mat->GetTexelHeight() * 4, 15, false, "Camtex");
mat->GetTexture()->SystemTextures.AddHardwareTexture(0, false, BaseLayer);
BaseLayer->CreateTexture(nullptr, tex->GetWidth(), tex->GetHeight(), 15, false, "Camtex");
tex->SystemTextures.AddHardwareTexture(0, false, BaseLayer);
}
BaseLayer->BindToFrameBuffer(mat->GetTexelWidth()*4, mat->GetTexelHeight()*4);
BaseLayer->BindToFrameBuffer(tex->GetWidth(), tex->GetHeight());
}
//===========================================================================

View file

@ -84,7 +84,7 @@ public:
bool StartOffscreen();
void EndOffscreen();
void BindToFrameBuffer(FGameTexture* tex);
void BindToFrameBuffer(FTexture* tex);
private:

View file

@ -324,7 +324,9 @@ void BuildTiles::InvalidateTile(int num)
void BuildTiles::MakeCanvas(int tilenum, int width, int height)
{
auto canvas = ValidateCustomTile(tilenum, ReplacementType::Canvas);
canvas->SetSize(width, height);
canvas->SetSize(width*4, height*4);
canvas->SetDisplaySize(width, height);
canvas->GetTexture()->SetSize(width * 4, height * 4);
static_cast<FCanvasTexture*>(canvas->GetTexture())->aspectRatio = (float)width / height;
}