From ab2686db3430e5af15184afc913104bef30c7042 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 31 May 2020 21:43:32 +0200 Subject: [PATCH] - camtex transition --- source/build/src/engine.cpp | 2 +- source/common/rendering/gl/gl_framebuffer.cpp | 2 -- source/common/rendering/gl/gl_renderer.cpp | 11 +++++------ source/common/rendering/gl/gl_renderer.h | 2 +- source/core/textures/buildtiles.cpp | 4 +++- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index af5b439ab..14a937967 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -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; diff --git a/source/common/rendering/gl/gl_framebuffer.cpp b/source/common/rendering/gl/gl_framebuffer.cpp index b1a13e1b5..d8a92b1f9 100644 --- a/source/common/rendering/gl/gl_framebuffer.cpp +++ b/source/common/rendering/gl/gl_framebuffer.cpp @@ -217,7 +217,6 @@ void OpenGLFrameBuffer::CopyScreenToBuffer(int width, int height, uint8_t* scr) void OpenGLFrameBuffer::RenderTextureView(FCanvasTexture* tex, std::function renderFunc) { -#if 0 GLRenderer->StartOffscreen(); GLRenderer->BindToFrameBuffer(tex); @@ -231,7 +230,6 @@ void OpenGLFrameBuffer::RenderTextureView(FCanvasTexture* tex, std::functionSetUpdated(true); static_cast(screen)->camtexcount++; -#endif } //=========================================================================== diff --git a/source/common/rendering/gl/gl_renderer.cpp b/source/common/rendering/gl/gl_renderer.cpp index 8bb521e09..e876b1720 100644 --- a/source/common/rendering/gl/gl_renderer.cpp +++ b/source/common/rendering/gl/gl_renderer.cpp @@ -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()); } //=========================================================================== diff --git a/source/common/rendering/gl/gl_renderer.h b/source/common/rendering/gl/gl_renderer.h index ff185f56d..8b5fe7e03 100644 --- a/source/common/rendering/gl/gl_renderer.h +++ b/source/common/rendering/gl/gl_renderer.h @@ -84,7 +84,7 @@ public: bool StartOffscreen(); void EndOffscreen(); - void BindToFrameBuffer(FGameTexture* tex); + void BindToFrameBuffer(FTexture* tex); private: diff --git a/source/core/textures/buildtiles.cpp b/source/core/textures/buildtiles.cpp index f46669420..e5132a6a0 100644 --- a/source/core/textures/buildtiles.cpp +++ b/source/core/textures/buildtiles.cpp @@ -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(canvas->GetTexture())->aspectRatio = (float)width / height; }