mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-31 13:00:59 +00:00
Move r_scene into a class
This commit is contained in:
parent
1c4e0c6385
commit
5ea28897af
5 changed files with 36 additions and 23 deletions
|
@ -638,7 +638,7 @@ namespace swrenderer
|
||||||
linedef = curline->linedef;
|
linedef = curline->linedef;
|
||||||
|
|
||||||
// mark the segment as visible for auto map
|
// mark the segment as visible for auto map
|
||||||
if (!r_dontmaplines) linedef->flags |= ML_MAPPED;
|
if (!RenderScene::Instance()->DontMapLines()) linedef->flags |= ML_MAPPED;
|
||||||
|
|
||||||
midtexture = toptexture = bottomtexture = 0;
|
midtexture = toptexture = bottomtexture = 0;
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ void FSoftwareRenderer::Init()
|
||||||
gl_ParseDefs();
|
gl_ParseDefs();
|
||||||
|
|
||||||
r_swtruecolor = screen->IsBgra();
|
r_swtruecolor = screen->IsBgra();
|
||||||
R_InitRenderer();
|
RenderScene::Instance()->Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -224,7 +224,7 @@ void FSoftwareRenderer::RenderView(player_t *player)
|
||||||
}
|
}
|
||||||
|
|
||||||
R_BeginDrawerCommands();
|
R_BeginDrawerCommands();
|
||||||
R_RenderActorView (player->mo);
|
RenderScene::Instance()->RenderActorView(player->mo);
|
||||||
// [RH] Let cameras draw onto textures that were visible this frame.
|
// [RH] Let cameras draw onto textures that were visible this frame.
|
||||||
FCanvasTextureInfo::UpdateAll ();
|
FCanvasTextureInfo::UpdateAll ();
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ void FSoftwareRenderer::WriteSavePic (player_t *player, FileWriter *file, int wi
|
||||||
if (r_polyrenderer)
|
if (r_polyrenderer)
|
||||||
PolyRenderer::Instance()->RenderViewToCanvas(player->mo, pic, 0, 0, width, height, true);
|
PolyRenderer::Instance()->RenderViewToCanvas(player->mo, pic, 0, 0, width, height, true);
|
||||||
else
|
else
|
||||||
R_RenderViewToCanvas (player->mo, pic, 0, 0, width, height);
|
RenderScene::Instance()->RenderViewToCanvas (player->mo, pic, 0, 0, width, height);
|
||||||
screen->GetFlashedPalette (palette);
|
screen->GetFlashedPalette (palette);
|
||||||
M_CreatePNG (file, pic->GetBuffer(), palette, SS_PAL, width, height, pic->GetPitch());
|
M_CreatePNG (file, pic->GetBuffer(), palette, SS_PAL, width, height, pic->GetPitch());
|
||||||
pic->Unlock ();
|
pic->Unlock ();
|
||||||
|
@ -323,7 +323,7 @@ bool FSoftwareRenderer::RequireGLNodes()
|
||||||
|
|
||||||
void FSoftwareRenderer::OnModeSet ()
|
void FSoftwareRenderer::OnModeSet ()
|
||||||
{
|
{
|
||||||
R_MultiresInit ();
|
RenderScene::Instance()->ScreenResized();
|
||||||
|
|
||||||
RenderTarget = screen;
|
RenderTarget = screen;
|
||||||
screen->Lock (true);
|
screen->Lock (true);
|
||||||
|
@ -413,7 +413,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
|
||||||
if (r_polyrenderer)
|
if (r_polyrenderer)
|
||||||
PolyRenderer::Instance()->RenderViewToCanvas(viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);
|
PolyRenderer::Instance()->RenderViewToCanvas(viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);
|
||||||
else
|
else
|
||||||
R_RenderViewToCanvas (viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);
|
RenderScene::Instance()->RenderViewToCanvas(viewpoint, Canvas, 0, 0, tex->GetWidth(), tex->GetHeight(), tex->bFirstUpdate);
|
||||||
R_SetFOV (savedfov);
|
R_SetFOV (savedfov);
|
||||||
|
|
||||||
if (Canvas->IsBgra())
|
if (Canvas->IsBgra())
|
||||||
|
|
|
@ -51,9 +51,14 @@ EXTERN_CVAR(Bool, r_shadercolormaps)
|
||||||
namespace swrenderer
|
namespace swrenderer
|
||||||
{
|
{
|
||||||
cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
||||||
bool r_dontmaplines;
|
|
||||||
|
|
||||||
void R_RenderActorView(AActor *actor, bool dontmaplines)
|
RenderScene *RenderScene::Instance()
|
||||||
|
{
|
||||||
|
static RenderScene instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RenderScene::RenderActorView(AActor *actor, bool dontmaplines)
|
||||||
{
|
{
|
||||||
WallCycles.Reset();
|
WallCycles.Reset();
|
||||||
PlaneCycles.Reset();
|
PlaneCycles.Reset();
|
||||||
|
@ -85,7 +90,7 @@ namespace swrenderer
|
||||||
|
|
||||||
RenderPortal::Instance()->SetMainPortal();
|
RenderPortal::Instance()->SetMainPortal();
|
||||||
|
|
||||||
r_dontmaplines = dontmaplines;
|
this->dontmaplines = dontmaplines;
|
||||||
|
|
||||||
// [RH] Hack to make windows into underwater areas possible
|
// [RH] Hack to make windows into underwater areas possible
|
||||||
RenderOpaquePass::Instance()->ResetFakingUnderwater();
|
RenderOpaquePass::Instance()->ResetFakingUnderwater();
|
||||||
|
@ -138,7 +143,7 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines)
|
void RenderScene::RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines)
|
||||||
{
|
{
|
||||||
const bool savedviewactive = viewactive;
|
const bool savedviewactive = viewactive;
|
||||||
const bool savedoutputformat = r_swtruecolor;
|
const bool savedoutputformat = r_swtruecolor;
|
||||||
|
@ -160,7 +165,7 @@ namespace swrenderer
|
||||||
viewwindowy = y;
|
viewwindowy = y;
|
||||||
viewactive = true;
|
viewactive = true;
|
||||||
|
|
||||||
R_RenderActorView(actor, dontmaplines);
|
RenderActorView(actor, dontmaplines);
|
||||||
|
|
||||||
R_EndDrawerCommands();
|
R_EndDrawerCommands();
|
||||||
|
|
||||||
|
@ -180,14 +185,14 @@ namespace swrenderer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_MultiresInit()
|
void RenderScene::ScreenResized()
|
||||||
{
|
{
|
||||||
VisiblePlaneList::Instance()->Init();
|
VisiblePlaneList::Instance()->Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_InitRenderer()
|
void RenderScene::Init()
|
||||||
{
|
{
|
||||||
atterm(R_ShutdownRenderer);
|
atterm([]() { RenderScene::Instance()->Deinit(); });
|
||||||
// viewwidth / viewheight are set by the defaults
|
// viewwidth / viewheight are set by the defaults
|
||||||
fillshort(zeroarray, MAXWIDTH, 0);
|
fillshort(zeroarray, MAXWIDTH, 0);
|
||||||
|
|
||||||
|
@ -195,7 +200,7 @@ namespace swrenderer
|
||||||
R_InitColumnDrawers();
|
R_InitColumnDrawers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_ShutdownRenderer()
|
void RenderScene::Deinit()
|
||||||
{
|
{
|
||||||
RenderTranslucentPass::Deinit();
|
RenderTranslucentPass::Deinit();
|
||||||
VisiblePlaneList::Instance()->Deinit();
|
VisiblePlaneList::Instance()->Deinit();
|
||||||
|
|
|
@ -23,12 +23,21 @@ namespace swrenderer
|
||||||
{
|
{
|
||||||
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
extern cycle_t WallCycles, PlaneCycles, MaskedCycles, WallScanCycles;
|
||||||
|
|
||||||
extern bool r_dontmaplines;
|
class RenderScene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static RenderScene *Instance();
|
||||||
|
|
||||||
void R_RenderActorView(AActor *actor, bool dontmaplines = false);
|
void Init();
|
||||||
void R_RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines = false);
|
void ScreenResized();
|
||||||
|
void Deinit();
|
||||||
|
|
||||||
void R_InitRenderer();
|
void RenderActorView(AActor *actor, bool dontmaplines = false);
|
||||||
void R_MultiresInit();
|
void RenderViewToCanvas(AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines = false);
|
||||||
void R_ShutdownRenderer();
|
|
||||||
|
bool DontMapLines() const { return dontmaplines; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool dontmaplines = false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,5 +37,4 @@ namespace swrenderer
|
||||||
void R_InitTextureMapping();
|
void R_InitTextureMapping();
|
||||||
void R_SetupBuffer();
|
void R_SetupBuffer();
|
||||||
void R_SetupFreelook();
|
void R_SetupFreelook();
|
||||||
void R_InitRenderer();
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue