Deleted GLSceneDrawer

Since it didn't contain any data anymore it was relatively pointless. Code has been moved to FDrawInfo and GLRenderer, depending on its scope.
This commit is contained in:
Christoph Oelckers 2018-06-20 13:14:50 +02:00
parent f229b05675
commit 7f5272c23f
13 changed files with 34 additions and 66 deletions

View file

@ -42,6 +42,7 @@
#include "gl_load/gl_interface.h"
#include "gl/system/gl_framebuffer.h"
#include "hwrenderer/utility/hw_cvars.h"
#include "gl/scene/gl_portal.h"
#include "gl/system/gl_debug.h"
#include "gl/renderer/gl_renderer.h"
#include "gl/renderer/gl_lightdata.h"
@ -49,7 +50,6 @@
#include "gl/renderer/gl_renderbuffers.h"
#include "gl/data/gl_vertexbuffer.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_scenedrawer.h"
#include "hwrenderer/postprocessing/hw_ambientshader.h"
#include "hwrenderer/postprocessing/hw_bloomshader.h"
#include "hwrenderer/postprocessing/hw_blurshader.h"

View file

@ -48,8 +48,8 @@ class FGL2DDrawer;
class FHardwareTexture;
class FShadowMapShader;
class FCustomPostProcessShaders;
class GLSceneDrawer;
class SWSceneDrawer;
struct FRenderViewpoint;
#define NOQUEUE nullptr // just some token to be used as a placeholder
enum

View file

@ -37,8 +37,8 @@
#include "gl/data/gl_vertexbuffer.h"
#include "gl/scene/gl_drawinfo.h"
#include "hwrenderer/scene/hw_clipper.h"
#include "gl/scene/gl_portal.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/renderer/gl_renderstate.h"
#include "gl/stereo3d/scoped_color_mask.h"
#include "gl/renderer/gl_quaddrawer.h"
@ -190,10 +190,9 @@ FDrawInfo::~FDrawInfo()
// OpenGL has no use for multiple clippers so use the same one for all DrawInfos.
static Clipper staticClipper;
FDrawInfo *FDrawInfo::StartDrawInfo(GLSceneDrawer *drawer, FRenderViewpoint &parentvp)
FDrawInfo *FDrawInfo::StartDrawInfo(FRenderViewpoint &parentvp)
{
FDrawInfo *di=di_list.GetNew();
di->mDrawer = drawer;
di->mVBO = GLRenderer->mVBO;
di->mClipper = &staticClipper;
di->Viewpoint = parentvp;

View file

@ -9,8 +9,6 @@
#pragma warning(disable:4244)
#endif
class GLSceneDrawer;
enum DrawListType
{
GLDL_PLAINWALLS,
@ -36,8 +34,6 @@ enum Drawpasses
struct FDrawInfo : public HWDrawInfo
{
GLSceneDrawer *mDrawer;
FDrawInfo * next;
HWDrawList drawlists[GLDL_TYPES];
TArray<HUDSprite> hudsprites; // These may just be stored by value.
@ -112,8 +108,14 @@ struct FDrawInfo : public HWDrawInfo
void ProcessScene(bool toscreen = false);
void EndDrawScene(sector_t * viewsector);
void DrawEndScene2D(sector_t * viewsector);
// These should go into hwrenderer later.
void SetProjection(VSMatrix matrix);
void SetViewMatrix(const FRotator &angles, float vx, float vy, float vz, bool mirror, bool planemirror);
void SetupView(FRenderViewpoint &vp, float vx, float vy, float vz, DAngle va, bool mirror, bool planemirror);
static FDrawInfo *StartDrawInfo(GLSceneDrawer *drawer, FRenderViewpoint &parentvp);
static FDrawInfo *StartDrawInfo(FRenderViewpoint &parentvp);
FDrawInfo *EndDrawInfo();
gl_subsectorrendernode * GetOtherFloorPlanes(unsigned int sector)

View file

@ -45,7 +45,6 @@
#include "gl/data/gl_vertexbuffer.h"
#include "gl/dynlights/gl_lightbuffer.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/renderer/gl_quaddrawer.h"
//==========================================================================

View file

@ -42,7 +42,6 @@
#include "gl/data/gl_vertexbuffer.h"
#include "hwrenderer/scene/hw_clipper.h"
#include "gl/scene/gl_portal.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/stereo3d/scoped_color_mask.h"
//-----------------------------------------------------------------------------
@ -59,7 +58,6 @@ EXTERN_CVAR(Bool, gl_portals)
EXTERN_CVAR(Bool, gl_noquery)
EXTERN_CVAR(Int, r_mirror_recursions)
GLSceneDrawer *GLPortal::drawer;
TArray<GLPortal *> GLPortal::portals;
TArray<float> GLPortal::planestack;
int GLPortal::recursion;
@ -228,7 +226,7 @@ bool GLPortal::Start(bool usestencil, bool doquery, FDrawInfo *outer_di, FDrawIn
return false;
}
}
*pDi = FDrawInfo::StartDrawInfo(drawer, outer_di->Viewpoint);
*pDi = FDrawInfo::StartDrawInfo(outer_di->Viewpoint);
}
else
{
@ -257,7 +255,7 @@ bool GLPortal::Start(bool usestencil, bool doquery, FDrawInfo *outer_di, FDrawIn
{
if (NeedDepthBuffer())
{
*pDi = FDrawInfo::StartDrawInfo(drawer, outer_di->Viewpoint);
*pDi = FDrawInfo::StartDrawInfo(outer_di->Viewpoint);
}
else
{
@ -327,7 +325,7 @@ void GLPortal::End(FDrawInfo *di, bool usestencil)
// Restore the old view
if (vp.camera != nullptr) vp.camera->renderflags = (vp.camera->renderflags & ~RF_MAYBEINVISIBLE) | savedvisibility;
drawer->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
{
ScopedColorMask colorMask(0, 0, 0, 0); // glColorMask(0, 0, 0, 0); // no graphics
@ -382,7 +380,7 @@ void GLPortal::End(FDrawInfo *di, bool usestencil)
// Restore the old view
if (vp.camera != nullptr) vp.camera->renderflags = (vp.camera->renderflags & ~RF_MAYBEINVISIBLE) | savedvisibility;
drawer->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
// This draws a valid z-buffer into the stencil's contents to ensure it
// doesn't get overwritten by the level's geometry.
@ -589,13 +587,13 @@ void GLSkyboxPortal::DrawContents(FDrawInfo *di)
vp.ViewActor = origin;
inskybox = true;
drawer->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetViewArea();
ClearClipper(di);
di->UpdateCurrentMapSection();
drawer->DrawScene(di, DM_SKYPORTAL);
di->DrawScene(DM_SKYPORTAL);
portal->mFlags &= ~PORTSF_INSKYBOX;
inskybox = false;
gl_RenderState.SetDepthClamp(oldclamp);
@ -696,7 +694,7 @@ void GLSectorStackPortal::DrawContents(FDrawInfo *di)
// avoid recursions!
if (origin->plane != -1) screen->instack[origin->plane]++;
drawer->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
di->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
SetupCoverage(di);
ClearClipper(di);
@ -709,7 +707,7 @@ void GLSectorStackPortal::DrawContents(FDrawInfo *di)
di->mClipper->SetBlocked(true);
}
drawer->DrawScene(di, DM_PORTAL);
di->DrawScene(DM_PORTAL);
if (origin->plane != -1) screen->instack[origin->plane]--;
}
@ -752,13 +750,13 @@ void GLPlaneMirrorPortal::DrawContents(FDrawInfo *di)
PlaneMirrorMode = origin->fC() < 0 ? -1 : 1;
PlaneMirrorFlag++;
drawer->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
ClearClipper(di);
di->UpdateCurrentMapSection();
gl_RenderState.SetClipHeight(planez, PlaneMirrorMode < 0 ? -1.f : 1.f);
drawer->DrawScene(di, DM_PORTAL);
di->DrawScene(DM_PORTAL);
gl_RenderState.SetClipHeight(0.f, 0.f);
PlaneMirrorFlag--;
PlaneMirrorMode = old_pm;
@ -923,7 +921,7 @@ void GLMirrorPortal::DrawContents(FDrawInfo *di)
vp.ViewActor = nullptr;
MirrorFlag++;
drawer->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
di->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
di->mClipper->Clear();
@ -934,7 +932,7 @@ void GLMirrorPortal::DrawContents(FDrawInfo *di)
gl_RenderState.SetClipLine(linedef);
gl_RenderState.EnableClipLine(true);
drawer->DrawScene(di, DM_PORTAL);
di->DrawScene(DM_PORTAL);
gl_RenderState.EnableClipLine(false);
MirrorFlag--;
@ -1000,12 +998,12 @@ void GLLineToLinePortal::DrawContents(FDrawInfo *di)
}
vp.ViewActor = nullptr;
drawer->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
di->SetupView(vp, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, vp.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
ClearClipper(di);
gl_RenderState.SetClipLine(glport->lines[0]->mDestination);
gl_RenderState.EnableClipLine(true);
drawer->DrawScene(di, DM_PORTAL);
di->DrawScene(DM_PORTAL);
gl_RenderState.EnableClipLine(false);
}

View file

@ -48,7 +48,6 @@ extern UniqueList<GLSkyInfo> UniqueSkies;
extern UniqueList<GLHorizonInfo> UniqueHorizons;
extern UniqueList<secplane_t> UniquePlaneMirrors;
struct GLEEHorizonPortal;
class GLSceneDrawer;
class GLPortal : public IPortal
{
@ -62,7 +61,6 @@ protected:
static int renderdepth;
public:
static GLSceneDrawer *drawer;
static int PlaneMirrorMode;
static int inupperstack;
static bool inskybox;

View file

@ -52,7 +52,6 @@
#include "hwrenderer/scene/hw_clipper.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_portal.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/stereo3d/gl_stereo3d.h"
#include "hwrenderer/utility/scoped_view_shifter.h"
@ -79,7 +78,7 @@ EXTERN_CVAR (Bool, r_drawvoxels)
//
//-----------------------------------------------------------------------------
void SetProjection(VSMatrix matrix)
void FDrawInfo::SetProjection(VSMatrix matrix)
{
gl_RenderState.mProjectionMatrix.loadIdentity();
gl_RenderState.mProjectionMatrix.multMatrix(matrix);
@ -91,7 +90,7 @@ void SetProjection(VSMatrix matrix)
//
//-----------------------------------------------------------------------------
void SetViewMatrix(const FRotator &angles, float vx, float vy, float vz, bool mirror, bool planemirror)
void FDrawInfo::SetViewMatrix(const FRotator &angles, float vx, float vy, float vz, bool mirror, bool planemirror)
{
float mult = mirror? -1:1;
float planemult = planemirror? -level.info->pixelstretch : level.info->pixelstretch;
@ -111,7 +110,7 @@ void SetViewMatrix(const FRotator &angles, float vx, float vy, float vz, bool mi
// Setup the view rotation matrix for the given viewpoint
//
//-----------------------------------------------------------------------------
void GLSceneDrawer::SetupView(FRenderViewpoint &vp, float vx, float vy, float vz, DAngle va, bool mirror, bool planemirror)
void FDrawInfo::SetupView(FRenderViewpoint &vp, float vx, float vy, float vz, DAngle va, bool mirror, bool planemirror)
{
vp.SetViewAngle(r_viewwindow);
SetViewMatrix(vp.HWAngles, vx, vy, vz, mirror, planemirror);
@ -511,19 +510,19 @@ sector_t * FGLRenderer::RenderViewpoint (FRenderViewpoint &mainvp, AActor * came
screen->SetViewportRects(bounds);
Set3DViewport(mainview);
FDrawInfo *di = FDrawInfo::StartDrawInfo(nullptr, mainvp);
FDrawInfo *di = FDrawInfo::StartDrawInfo(mainvp);
auto vp = di->Viewpoint;
di->SetViewArea();
auto cm = di->SetFullbrightFlags(mainview ? vp.camera->player : nullptr);
di->Viewpoint.FieldOfView = fov; // Set the real FOV for the current scene (it's not necessarily the same as the global setting in r_viewpoint)
// Stereo mode specific perspective projection
SetProjection( eye->GetProjection(fov, ratio, fovratio) );
di->SetProjection( eye->GetProjection(fov, ratio, fovratio) );
vp.SetViewAngle(r_viewwindow);
// Stereo mode specific viewpoint adjustment - temporarily shifts global ViewPos
eye->GetViewShift(vp.HWAngles.Yaw.Degrees, viewShift);
ScopedViewShifter viewShifter(vp.Pos, viewShift);
SetViewMatrix(vp.HWAngles, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, false, false);
di->SetViewMatrix(vp.HWAngles, vp.Pos.X, vp.Pos.Y, vp.Pos.Z, false, false);
gl_RenderState.ApplyMatrices();
di->ProcessScene(toscreen);

View file

@ -1,25 +0,0 @@
#pragma once
#include "r_defs.h"
#include "m_fixed.h"
#include "hwrenderer/scene/hw_clipper.h"
#include "gl_portal.h"
#include "gl/renderer/gl_lightdata.h"
#include "gl/renderer/gl_renderer.h"
#include "r_utility.h"
#include "c_cvars.h"
struct HUDSprite;
class GLSceneDrawer
{
public:
GLSceneDrawer()
{
GLPortal::drawer = this;
}
void SetupView(FRenderViewpoint &vp, float vx, float vy, float vz, DAngle va, bool mirror, bool planemirror);
sector_t *RenderView(player_t *player);
};

View file

@ -32,9 +32,10 @@
#include "gl_load/gl_interface.h"
#include "gl/data/gl_vertexbuffer.h"
#include "gl/renderer/gl_lightdata.h"
#include "gl/renderer/gl_renderer.h"
#include "gl/renderer/gl_renderstate.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/scene/gl_portal.h"
#include "gl/shaders/gl_shader.h"
@ -230,7 +231,7 @@ void GLSkyPortal::DrawContents(FDrawInfo *di)
bool oldClamp = gl_RenderState.SetDepthClamp(true);
gl_MatrixStack.Push(gl_RenderState.mViewMatrix);
drawer->SetupView(vp, 0, 0, 0, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
di->SetupView(vp, 0, 0, 0, vp.Angles.Yaw, !!(MirrorFlag & 1), !!(PlaneMirrorFlag & 1));
gl_RenderState.SetVertexBuffer(GLRenderer->mSkyVBO);
if (origin->texture[0] && origin->texture[0]->tex->bSkybox)

View file

@ -47,7 +47,6 @@
#include "gl/renderer/gl_renderstate.h"
#include "gl/renderer/gl_renderer.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/models/gl_models.h"
#include "gl/renderer/gl_quaddrawer.h"
#include "gl/dynlights/gl_lightbuffer.h"

View file

@ -37,7 +37,6 @@
#include "gl/dynlights/gl_lightbuffer.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_portal.h"
#include "gl/scene/gl_scenedrawer.h"
EXTERN_CVAR(Bool, gl_seamless)

View file

@ -37,7 +37,6 @@
#include "gl/renderer/gl_renderstate.h"
#include "gl/data/gl_vertexbuffer.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/scene/gl_scenedrawer.h"
#include "gl/models/gl_models.h"
#include "gl/stereo3d/gl_stereo3d.h"
#include "gl/dynlights/gl_lightbuffer.h"