From 3093aaadc9143e41c0abab8c4dd6f378c3dbca60 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 15 Jan 2017 01:54:25 +0100 Subject: [PATCH] Remove SetupFrame and CopyStackedViewParameters from FRenderer interface --- src/polyrenderer/poly_renderer.cpp | 5 ++++- src/r_renderer.h | 2 -- src/r_utility.cpp | 3 --- src/swrenderer/r_swrenderer.cpp | 11 ----------- src/swrenderer/r_swrenderer.h | 2 -- src/swrenderer/scene/r_light.cpp | 6 +++++- src/swrenderer/scene/r_light.h | 2 +- src/swrenderer/scene/r_scene.cpp | 4 ++++ 8 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/polyrenderer/poly_renderer.cpp b/src/polyrenderer/poly_renderer.cpp index 22d996e9f..67f997c61 100644 --- a/src/polyrenderer/poly_renderer.cpp +++ b/src/polyrenderer/poly_renderer.cpp @@ -32,6 +32,7 @@ #include "po_man.h" #include "swrenderer/scene/r_scene.h" #include "swrenderer/scene/r_viewport.h" +#include "swrenderer/scene/r_light.h" EXTERN_CVAR(Int, screenblocks) void InitGLRMapinfoData(); @@ -81,7 +82,9 @@ void PolyRenderer::RenderActorView(AActor *actor, bool dontmaplines) P_FindParticleSubsectors(); PO_LinkToSubsectors(); R_SetupFrame(actor); - + swrenderer::R_SetupColormap(actor); + swrenderer::R_SetupFreelook(); + ActorRenderFlags savedflags = camera->renderflags; // Never draw the player unless in chasecam mode if (!r_showviewer) diff --git a/src/r_renderer.h b/src/r_renderer.h index 0b1405895..92ac3ef0c 100644 --- a/src/r_renderer.h +++ b/src/r_renderer.h @@ -57,8 +57,6 @@ struct FRenderer virtual void ClearBuffer(int color) = 0; virtual void Init() = 0; virtual void SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio) {} - virtual void SetupFrame(player_t *player) {} - virtual void CopyStackedViewParameters() {} virtual void RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov) = 0; virtual sector_t *FakeFlat(sector_t *sec, sector_t *tempsec, int *floorlightlevel, int *ceilinglightlevel) = 0; virtual void SetFogParams(int _fogdensity, PalEntry _outsidefogcolor, int _outsidefogdensity, int _skyfog) {} diff --git a/src/r_utility.cpp b/src/r_utility.cpp index c28422dff..03ba0756f 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -910,9 +910,6 @@ void R_SetupFrame (AActor *actor) } } - Renderer->CopyStackedViewParameters(); - Renderer->SetupFrame(player); - validcount++; if (RenderTarget == screen && r_clearbuffer != 0) diff --git a/src/swrenderer/r_swrenderer.cpp b/src/swrenderer/r_swrenderer.cpp index 75348772f..fff9a36f7 100644 --- a/src/swrenderer/r_swrenderer.cpp +++ b/src/swrenderer/r_swrenderer.cpp @@ -302,17 +302,6 @@ void FSoftwareRenderer::SetWindow (int windowSize, int fullWidth, int fullHeight R_SWRSetWindow(windowSize, fullWidth, fullHeight, stHeight, trueratio); } -void FSoftwareRenderer::SetupFrame(player_t *player) -{ - R_SetupColormap(player); - R_SetupFreelook(); -} - -void FSoftwareRenderer::CopyStackedViewParameters() -{ - RenderPortal::Instance()->CopyStackedViewParameters(); -} - void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov) { BYTE *Pixels = r_swtruecolor ? (BYTE*)tex->GetPixelsBgra() : (BYTE*)tex->GetPixels(); diff --git a/src/swrenderer/r_swrenderer.h b/src/swrenderer/r_swrenderer.h index 87496882f..51d2b1d16 100644 --- a/src/swrenderer/r_swrenderer.h +++ b/src/swrenderer/r_swrenderer.h @@ -35,8 +35,6 @@ struct FSoftwareRenderer : public FRenderer void ClearBuffer(int color) override; void Init() override; void SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, float trueratio) override; - void SetupFrame(player_t *player) override; - void CopyStackedViewParameters() override; void RenderTextureView (FCanvasTexture *tex, AActor *viewpoint, int fov) override; sector_t *FakeFlat(sector_t *sec, sector_t *tempsec, int *floorlightlevel, int *ceilinglightlevel) override; diff --git a/src/swrenderer/scene/r_light.cpp b/src/swrenderer/scene/r_light.cpp index 4059a73bf..a1bcc75de 100644 --- a/src/swrenderer/scene/r_light.cpp +++ b/src/swrenderer/scene/r_light.cpp @@ -109,8 +109,12 @@ namespace swrenderer return CurrentVisibility; } - void R_SetupColormap(player_t *player) + void R_SetupColormap(AActor *actor) { + player_t *player = actor->player; + if (camera && camera->player != 0) + player = camera->player; + realfixedcolormap = NULL; fixedcolormap = NULL; fixedlightlev = -1; diff --git a/src/swrenderer/scene/r_light.h b/src/swrenderer/scene/r_light.h index 50b4fae84..26469b37c 100644 --- a/src/swrenderer/scene/r_light.h +++ b/src/swrenderer/scene/r_light.h @@ -66,5 +66,5 @@ namespace swrenderer void R_SetVisibility(double visibility); double R_GetVisibility(); - void R_SetupColormap(player_t *); + void R_SetupColormap(AActor *actor); } diff --git a/src/swrenderer/scene/r_scene.cpp b/src/swrenderer/scene/r_scene.cpp index 15dfa265a..54271d867 100644 --- a/src/swrenderer/scene/r_scene.cpp +++ b/src/swrenderer/scene/r_scene.cpp @@ -71,6 +71,10 @@ namespace swrenderer R_SetupBuffer(); R_SetupFrame(actor); + R_SetupColormap(actor); + R_SetupFreelook(); + + RenderPortal::Instance()->CopyStackedViewParameters(); // Clear buffers. R_ClearClipSegs(0, viewwidth);