mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
Change RenderTarget global to be an internal swrenderer variable
This commit is contained in:
parent
aaee6e333f
commit
f9175561bb
10 changed files with 42 additions and 26 deletions
|
@ -694,8 +694,6 @@ void D_Display ()
|
|||
}
|
||||
}
|
||||
|
||||
RenderTarget = screen;
|
||||
|
||||
// change the view size if needed
|
||||
if (setsizeneeded && StatusBar != NULL)
|
||||
{
|
||||
|
|
|
@ -53,6 +53,8 @@ void PolyRenderer::RenderView(player_t *player)
|
|||
{
|
||||
using namespace swrenderer;
|
||||
|
||||
swrenderer::RenderTarget = screen;
|
||||
|
||||
bool saved_swtruecolor = r_swtruecolor;
|
||||
r_swtruecolor = screen->IsBgra();
|
||||
|
||||
|
@ -82,7 +84,7 @@ void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int
|
|||
const bool savedoutputformat = swrenderer::r_swtruecolor;
|
||||
|
||||
viewwidth = width;
|
||||
RenderTarget = canvas;
|
||||
swrenderer::RenderTarget = canvas;
|
||||
swrenderer::bRenderingToCanvas = true;
|
||||
R_SetWindow(12, width, height, height, true);
|
||||
swrenderer::R_SWRSetWindow(12, width, height, height, WidescreenRatio);
|
||||
|
@ -97,7 +99,7 @@ void PolyRenderer::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int
|
|||
|
||||
canvas->Unlock();
|
||||
|
||||
RenderTarget = screen;
|
||||
swrenderer::RenderTarget = screen;
|
||||
swrenderer::bRenderingToCanvas = false;
|
||||
R_ExecuteSetViewSize();
|
||||
float trueratio;
|
||||
|
@ -153,8 +155,8 @@ void PolyRenderer::RenderRemainingPlayerSprites()
|
|||
void PolyRenderer::ClearBuffers()
|
||||
{
|
||||
PolyVertexBuffer::Clear();
|
||||
PolyStencilBuffer::Instance()->Clear(RenderTarget->GetWidth(), RenderTarget->GetHeight(), 0);
|
||||
PolySubsectorGBuffer::Instance()->Resize(RenderTarget->GetPitch(), RenderTarget->GetHeight());
|
||||
PolyStencilBuffer::Instance()->Clear(swrenderer::RenderTarget->GetWidth(), swrenderer::RenderTarget->GetHeight(), 0);
|
||||
PolySubsectorGBuffer::Instance()->Resize(swrenderer::RenderTarget->GetPitch(), swrenderer::RenderTarget->GetHeight());
|
||||
NextStencilValue = 0;
|
||||
SeenLinePortals.clear();
|
||||
SeenMirrors.clear();
|
||||
|
@ -162,6 +164,8 @@ void PolyRenderer::ClearBuffers()
|
|||
|
||||
void PolyRenderer::SetSceneViewport()
|
||||
{
|
||||
using namespace swrenderer;
|
||||
|
||||
if (RenderTarget == screen) // Rendering to screen
|
||||
{
|
||||
int height;
|
||||
|
|
|
@ -165,12 +165,12 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
|||
double texturemid = (BaseYCenter - sy) * tex->Scale.Y + tex->TopOffset;
|
||||
|
||||
// Adjust PSprite for fullscreen views
|
||||
if (camera->player && (RenderTarget != screen || viewheight == RenderTarget->GetHeight() || (RenderTarget->GetWidth() > (BaseXCenter * 2) && !st_scale)))
|
||||
if (camera->player && (swrenderer::RenderTarget != screen || viewheight == swrenderer::RenderTarget->GetHeight() || (swrenderer::RenderTarget->GetWidth() > (BaseXCenter * 2) && !st_scale)))
|
||||
{
|
||||
AWeapon *weapon = dyn_cast<AWeapon>(sprite->GetCaller());
|
||||
if (weapon != nullptr && weapon->YAdjust != 0)
|
||||
{
|
||||
if (RenderTarget != screen || viewheight == RenderTarget->GetHeight())
|
||||
if (swrenderer::RenderTarget != screen || viewheight == swrenderer::RenderTarget->GetHeight())
|
||||
{
|
||||
texturemid -= weapon->YAdjust;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ void RenderPolyPlayerSprites::RenderSprite(DPSprite *sprite, AActor *owner, floa
|
|||
|
||||
// Check for hardware-assisted 2D. If it's available, and this sprite is not
|
||||
// fuzzy, don't draw it until after the switch to 2D mode.
|
||||
if (!noaccel && RenderTarget == screen && (DFrameBuffer *)screen->Accel2D)
|
||||
if (!noaccel && swrenderer::RenderTarget == screen && (DFrameBuffer *)screen->Accel2D)
|
||||
{
|
||||
FRenderStyle style = visstyle.RenderStyle;
|
||||
style.CheckFuzz();
|
||||
|
|
|
@ -100,8 +100,6 @@ CUSTOM_CVAR(Float, r_quakeintensity, 1.0f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
else if (self > 1.f) self = 1.f;
|
||||
}
|
||||
|
||||
DCanvas *RenderTarget; // [RH] canvas to render to
|
||||
|
||||
int viewwindowx;
|
||||
int viewwindowy;
|
||||
|
||||
|
@ -908,7 +906,7 @@ void R_SetupFrame (AActor *actor)
|
|||
|
||||
validcount++;
|
||||
|
||||
if (RenderTarget == screen && r_clearbuffer != 0)
|
||||
if (r_clearbuffer != 0)
|
||||
{
|
||||
int color;
|
||||
int hom = r_clearbuffer;
|
||||
|
|
|
@ -12,8 +12,6 @@ class FSerializer;
|
|||
// There a 0-31, i.e. 32 LUT in the COLORMAP lump.
|
||||
#define NUMCOLORMAPS 32
|
||||
|
||||
extern DCanvas *RenderTarget;
|
||||
|
||||
extern DVector3 ViewPos;
|
||||
extern DVector3 ViewActorPos;
|
||||
extern DAngle ViewAngle;
|
||||
|
|
|
@ -244,18 +244,7 @@ void FSoftwareRenderer::OnModeSet ()
|
|||
|
||||
void FSoftwareRenderer::ClearBuffer(int color)
|
||||
{
|
||||
if (!r_swtruecolor)
|
||||
{
|
||||
memset(RenderTarget->GetBuffer(), color, RenderTarget->GetPitch() * RenderTarget->GetHeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t bgracolor = GPalette.BaseColors[color].d;
|
||||
int size = RenderTarget->GetPitch() * RenderTarget->GetHeight();
|
||||
uint32_t *dest = (uint32_t *)RenderTarget->GetBuffer();
|
||||
for (int i = 0; i < size; i++)
|
||||
dest[i] = bgracolor;
|
||||
}
|
||||
RenderScene::Instance()->SetClearColor(color);
|
||||
}
|
||||
|
||||
void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov)
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "swrenderer/r_memory.h"
|
||||
|
||||
EXTERN_CVAR(Bool, r_shadercolormaps)
|
||||
EXTERN_CVAR(Int, r_clearbuffer)
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
|
@ -60,8 +61,15 @@ namespace swrenderer
|
|||
return &instance;
|
||||
}
|
||||
|
||||
void RenderScene::SetClearColor(int color)
|
||||
{
|
||||
clearcolor = color;
|
||||
}
|
||||
|
||||
void RenderScene::RenderView(player_t *player)
|
||||
{
|
||||
RenderTarget = screen;
|
||||
|
||||
int width = SCREENWIDTH;
|
||||
int height = SCREENHEIGHT;
|
||||
int stHeight = ST_Y;
|
||||
|
@ -75,6 +83,22 @@ namespace swrenderer
|
|||
R_InitColumnDrawers();
|
||||
}
|
||||
|
||||
if (r_clearbuffer != 0)
|
||||
{
|
||||
if (!r_swtruecolor)
|
||||
{
|
||||
memset(RenderTarget->GetBuffer(), clearcolor, RenderTarget->GetPitch() * RenderTarget->GetHeight());
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t bgracolor = GPalette.BaseColors[clearcolor].d;
|
||||
int size = RenderTarget->GetPitch() * RenderTarget->GetHeight();
|
||||
uint32_t *dest = (uint32_t *)RenderTarget->GetBuffer();
|
||||
for (int i = 0; i < size; i++)
|
||||
dest[i] = bgracolor;
|
||||
}
|
||||
}
|
||||
|
||||
R_BeginDrawerCommands();
|
||||
|
||||
RenderActorView(player->mo);
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace swrenderer
|
|||
void ScreenResized();
|
||||
void Deinit();
|
||||
|
||||
void SetClearColor(int color);
|
||||
|
||||
void RenderActorView(AActor *actor, bool dontmaplines = false);
|
||||
void RenderView(player_t *player);
|
||||
void RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines = false);
|
||||
|
@ -40,5 +42,6 @@ namespace swrenderer
|
|||
|
||||
private:
|
||||
bool dontmaplines = false;
|
||||
int clearcolor = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace swrenderer
|
|||
double FocalLengthX;
|
||||
double FocalLengthY;
|
||||
|
||||
DCanvas *RenderTarget;
|
||||
bool bRenderingToCanvas;
|
||||
double globaluclip, globaldclip;
|
||||
double CenterX, CenterY;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
extern DCanvas *RenderTarget;
|
||||
extern bool bRenderingToCanvas;
|
||||
extern fixed_t viewingrangerecip;
|
||||
extern double FocalLengthX;
|
||||
|
|
Loading…
Reference in a new issue