mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-18 01:21:32 +00:00
- removed more occurences of gl_drawinfo.
This commit is contained in:
parent
31263eeac2
commit
e6a447eb6f
7 changed files with 73 additions and 71 deletions
|
@ -191,12 +191,13 @@ FDrawInfo::~FDrawInfo()
|
||||||
// Sets up a new drawinfo struct
|
// Sets up a new drawinfo struct
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
void FDrawInfo::StartDrawInfo(GLSceneDrawer *drawer)
|
FDrawInfo *FDrawInfo::StartDrawInfo(GLSceneDrawer *drawer)
|
||||||
{
|
{
|
||||||
FDrawInfo *di=di_list.GetNew();
|
FDrawInfo *di=di_list.GetNew();
|
||||||
di->mDrawer = drawer;
|
di->mDrawer = drawer;
|
||||||
di->FixedColormap = drawer->FixedColormap;
|
di->FixedColormap = drawer->FixedColormap;
|
||||||
di->StartScene();
|
di->StartScene();
|
||||||
|
return di;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDrawInfo::StartScene()
|
void FDrawInfo::StartScene()
|
||||||
|
|
|
@ -135,7 +135,7 @@ struct FDrawInfo : public HWDrawInfo
|
||||||
void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub) override;
|
void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub) override;
|
||||||
int ClipPoint(const DVector3 &pos) override;
|
int ClipPoint(const DVector3 &pos) override;
|
||||||
|
|
||||||
static void StartDrawInfo(GLSceneDrawer *drawer);
|
static FDrawInfo *StartDrawInfo(GLSceneDrawer *drawer);
|
||||||
static void EndDrawInfo();
|
static void EndDrawInfo();
|
||||||
|
|
||||||
gl_subsectorrendernode * GetOtherFloorPlanes(unsigned int sector)
|
gl_subsectorrendernode * GetOtherFloorPlanes(unsigned int sector)
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include "gl/renderer/gl_renderstate.h"
|
#include "gl/renderer/gl_renderstate.h"
|
||||||
#include "gl/data/gl_vertexbuffer.h"
|
#include "gl/data/gl_vertexbuffer.h"
|
||||||
#include "hwrenderer/scene/hw_clipper.h"
|
#include "hwrenderer/scene/hw_clipper.h"
|
||||||
#include "gl/scene/gl_drawinfo.h"
|
|
||||||
#include "gl/scene/gl_portal.h"
|
#include "gl/scene/gl_portal.h"
|
||||||
#include "gl/scene/gl_scenedrawer.h"
|
#include "gl/scene/gl_scenedrawer.h"
|
||||||
#include "gl/stereo3d/scoped_color_mask.h"
|
#include "gl/stereo3d/scoped_color_mask.h"
|
||||||
|
@ -160,8 +159,9 @@ void GLPortal::DrawPortalStencil()
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool GLPortal::Start(bool usestencil, bool doquery)
|
bool GLPortal::Start(bool usestencil, bool doquery, FDrawInfo **pDi)
|
||||||
{
|
{
|
||||||
|
*pDi = nullptr;
|
||||||
rendered_portals++;
|
rendered_portals++;
|
||||||
Clocker c(PortalAll);
|
Clocker c(PortalAll);
|
||||||
if (usestencil)
|
if (usestencil)
|
||||||
|
@ -228,7 +228,7 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FDrawInfo::StartDrawInfo(drawer);
|
*pDi = FDrawInfo::StartDrawInfo(drawer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -256,7 +256,7 @@ bool GLPortal::Start(bool usestencil, bool doquery)
|
||||||
{
|
{
|
||||||
if (NeedDepthBuffer())
|
if (NeedDepthBuffer())
|
||||||
{
|
{
|
||||||
FDrawInfo::StartDrawInfo(drawer);
|
*pDi = FDrawInfo::StartDrawInfo(drawer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -596,7 +596,7 @@ void GLPortal::RestoreMapSection()
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GLSkyboxPortal::DrawContents()
|
void GLSkyboxPortal::DrawContents(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
int old_pm = PlaneMirrorMode;
|
int old_pm = PlaneMirrorMode;
|
||||||
int saved_extralight = r_viewpoint.extralight;
|
int saved_extralight = r_viewpoint.extralight;
|
||||||
|
@ -637,7 +637,7 @@ void GLSkyboxPortal::DrawContents()
|
||||||
SaveMapSection();
|
SaveMapSection();
|
||||||
drawer->CurrentMapSections.Set(mapsection);
|
drawer->CurrentMapSections.Set(mapsection);
|
||||||
|
|
||||||
drawer->DrawScene(DM_SKYPORTAL);
|
drawer->DrawScene(di, DM_SKYPORTAL);
|
||||||
portal->mFlags &= ~PORTSF_INSKYBOX;
|
portal->mFlags &= ~PORTSF_INSKYBOX;
|
||||||
inskybox = false;
|
inskybox = false;
|
||||||
gl_RenderState.SetDepthClamp(oldclamp);
|
gl_RenderState.SetDepthClamp(oldclamp);
|
||||||
|
@ -698,7 +698,7 @@ static uint8_t SetCoverage(FDrawInfo *di, void *node)
|
||||||
{
|
{
|
||||||
node_t *bsp = (node_t *)node;
|
node_t *bsp = (node_t *)node;
|
||||||
uint8_t coverage = SetCoverage(di, bsp->children[0]) | SetCoverage(di, bsp->children[1]);
|
uint8_t coverage = SetCoverage(di, bsp->children[0]) | SetCoverage(di, bsp->children[1]);
|
||||||
gl_drawinfo->no_renderflags[bsp->Index()] = coverage;
|
di->no_renderflags[bsp->Index()] = coverage;
|
||||||
return coverage;
|
return coverage;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -718,7 +718,7 @@ void GLSectorStackPortal::SetupCoverage(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
subsector_t *dsub = &::level.subsectors[sub->portalcoverage[plane].subsectors[j]];
|
subsector_t *dsub = &::level.subsectors[sub->portalcoverage[plane].subsectors[j]];
|
||||||
drawer->CurrentMapSections.Set(dsub->mapsection);
|
drawer->CurrentMapSections.Set(dsub->mapsection);
|
||||||
gl_drawinfo->ss_renderflags[dsub->Index()] |= SSRF_SEEN;
|
di->ss_renderflags[dsub->Index()] |= SSRF_SEEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetCoverage(di, ::level.HeadNode());
|
SetCoverage(di, ::level.HeadNode());
|
||||||
|
@ -729,7 +729,7 @@ void GLSectorStackPortal::SetupCoverage(FDrawInfo *di)
|
||||||
// GLSectorStackPortal::DrawContents
|
// GLSectorStackPortal::DrawContents
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GLSectorStackPortal::DrawContents()
|
void GLSectorStackPortal::DrawContents(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
FSectorPortalGroup *portal = origin;
|
FSectorPortalGroup *portal = origin;
|
||||||
|
|
||||||
|
@ -742,19 +742,19 @@ void GLSectorStackPortal::DrawContents()
|
||||||
|
|
||||||
drawer->SetupView(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, r_viewpoint.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
|
drawer->SetupView(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, r_viewpoint.Angles.Yaw, !!(MirrorFlag&1), !!(PlaneMirrorFlag&1));
|
||||||
SaveMapSection();
|
SaveMapSection();
|
||||||
SetupCoverage(gl_drawinfo);
|
SetupCoverage(di);
|
||||||
ClearClipper();
|
ClearClipper();
|
||||||
|
|
||||||
// If the viewpoint is not within the portal, we need to invalidate the entire clip area.
|
// If the viewpoint is not within the portal, we need to invalidate the entire clip area.
|
||||||
// The portal will re-validate the necessary parts when its subsectors get traversed.
|
// The portal will re-validate the necessary parts when its subsectors get traversed.
|
||||||
subsector_t *sub = R_PointInSubsector(r_viewpoint.Pos);
|
subsector_t *sub = R_PointInSubsector(r_viewpoint.Pos);
|
||||||
if (!(gl_drawinfo->ss_renderflags[sub->Index()] & SSRF_SEEN))
|
if (!(di->ss_renderflags[sub->Index()] & SSRF_SEEN))
|
||||||
{
|
{
|
||||||
drawer->clipper.SafeAddClipRange(0, ANGLE_MAX);
|
drawer->clipper.SafeAddClipRange(0, ANGLE_MAX);
|
||||||
drawer->clipper.SetBlocked(true);
|
drawer->clipper.SetBlocked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawer->DrawScene(DM_PORTAL);
|
drawer->DrawScene(di, DM_PORTAL);
|
||||||
RestoreMapSection();
|
RestoreMapSection();
|
||||||
|
|
||||||
if (origin->plane != -1) screen->instack[origin->plane]--;
|
if (origin->plane != -1) screen->instack[origin->plane]--;
|
||||||
|
@ -776,7 +776,7 @@ void GLSectorStackPortal::DrawContents()
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GLPlaneMirrorPortal::DrawContents()
|
void GLPlaneMirrorPortal::DrawContents(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
if (renderdepth > r_mirror_recursions)
|
if (renderdepth > r_mirror_recursions)
|
||||||
{
|
{
|
||||||
|
@ -801,7 +801,7 @@ void GLPlaneMirrorPortal::DrawContents()
|
||||||
ClearClipper();
|
ClearClipper();
|
||||||
|
|
||||||
gl_RenderState.SetClipHeight(planez, PlaneMirrorMode < 0 ? -1.f : 1.f);
|
gl_RenderState.SetClipHeight(planez, PlaneMirrorMode < 0 ? -1.f : 1.f);
|
||||||
drawer->DrawScene(DM_PORTAL);
|
drawer->DrawScene(di, DM_PORTAL);
|
||||||
gl_RenderState.SetClipHeight(0.f, 0.f);
|
gl_RenderState.SetClipHeight(0.f, 0.f);
|
||||||
PlaneMirrorFlag--;
|
PlaneMirrorFlag--;
|
||||||
PlaneMirrorMode = old_pm;
|
PlaneMirrorMode = old_pm;
|
||||||
|
@ -897,7 +897,7 @@ int GLLinePortal::ClipPoint(const DVector2 &pos)
|
||||||
// R_EnterMirror
|
// R_EnterMirror
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GLMirrorPortal::DrawContents()
|
void GLMirrorPortal::DrawContents(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
if (renderdepth>r_mirror_recursions)
|
if (renderdepth>r_mirror_recursions)
|
||||||
{
|
{
|
||||||
|
@ -976,7 +976,7 @@ void GLMirrorPortal::DrawContents()
|
||||||
|
|
||||||
gl_RenderState.SetClipLine(linedef);
|
gl_RenderState.SetClipLine(linedef);
|
||||||
gl_RenderState.EnableClipLine(true);
|
gl_RenderState.EnableClipLine(true);
|
||||||
drawer->DrawScene(DM_PORTAL);
|
drawer->DrawScene(di, DM_PORTAL);
|
||||||
gl_RenderState.EnableClipLine(false);
|
gl_RenderState.EnableClipLine(false);
|
||||||
|
|
||||||
MirrorFlag--;
|
MirrorFlag--;
|
||||||
|
@ -997,7 +997,7 @@ void GLMirrorPortal::DrawContents()
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GLLineToLinePortal::DrawContents()
|
void GLLineToLinePortal::DrawContents(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
// TODO: Handle recursion more intelligently
|
// TODO: Handle recursion more intelligently
|
||||||
if (renderdepth>r_mirror_recursions)
|
if (renderdepth>r_mirror_recursions)
|
||||||
|
@ -1049,14 +1049,14 @@ void GLLineToLinePortal::DrawContents()
|
||||||
ClearClipper();
|
ClearClipper();
|
||||||
gl_RenderState.SetClipLine(glport->lines[0]->mDestination);
|
gl_RenderState.SetClipLine(glport->lines[0]->mDestination);
|
||||||
gl_RenderState.EnableClipLine(true);
|
gl_RenderState.EnableClipLine(true);
|
||||||
drawer->DrawScene(DM_PORTAL);
|
drawer->DrawScene(di, DM_PORTAL);
|
||||||
gl_RenderState.EnableClipLine(false);
|
gl_RenderState.EnableClipLine(false);
|
||||||
RestoreMapSection();
|
RestoreMapSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLLineToLinePortal::RenderAttached()
|
void GLLineToLinePortal::RenderAttached(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
gl_drawinfo->ProcessActorsInPortal(glport, gl_drawinfo->mDrawer->in_area);
|
di->ProcessActorsInPortal(glport, di->mDrawer->in_area);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -1145,7 +1145,7 @@ GLHorizonPortal::GLHorizonPortal(GLHorizonInfo * pt, bool local)
|
||||||
// GLHorizonPortal::DrawContents
|
// GLHorizonPortal::DrawContents
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GLHorizonPortal::DrawContents()
|
void GLHorizonPortal::DrawContents(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
Clocker c(PortalAll);
|
Clocker c(PortalAll);
|
||||||
|
|
||||||
|
@ -1216,7 +1216,7 @@ void GLHorizonPortal::DrawContents()
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GLEEHorizonPortal::DrawContents()
|
void GLEEHorizonPortal::DrawContents(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
sector_t *sector = portal->mOrigin;
|
sector_t *sector = portal->mOrigin;
|
||||||
if (sector->GetTexture(sector_t::floor) == skyflatnum ||
|
if (sector->GetTexture(sector_t::floor) == skyflatnum ||
|
||||||
|
@ -1225,7 +1225,7 @@ void GLEEHorizonPortal::DrawContents()
|
||||||
GLSkyInfo skyinfo;
|
GLSkyInfo skyinfo;
|
||||||
skyinfo.init(sector->sky, 0);
|
skyinfo.init(sector->sky, 0);
|
||||||
GLSkyPortal sky(&skyinfo, true);
|
GLSkyPortal sky(&skyinfo, true);
|
||||||
sky.DrawContents();
|
sky.DrawContents(di);
|
||||||
}
|
}
|
||||||
if (sector->GetTexture(sector_t::ceiling) != skyflatnum)
|
if (sector->GetTexture(sector_t::ceiling) != skyflatnum)
|
||||||
{
|
{
|
||||||
|
@ -1239,7 +1239,7 @@ void GLEEHorizonPortal::DrawContents()
|
||||||
horz.plane.Texheight = r_viewpoint.Pos.Z + fabs(horz.plane.Texheight);
|
horz.plane.Texheight = r_viewpoint.Pos.Z + fabs(horz.plane.Texheight);
|
||||||
}
|
}
|
||||||
GLHorizonPortal ceil(&horz, true);
|
GLHorizonPortal ceil(&horz, true);
|
||||||
ceil.DrawContents();
|
ceil.DrawContents(di);
|
||||||
}
|
}
|
||||||
if (sector->GetTexture(sector_t::floor) != skyflatnum)
|
if (sector->GetTexture(sector_t::floor) != skyflatnum)
|
||||||
{
|
{
|
||||||
|
@ -1253,7 +1253,7 @@ void GLEEHorizonPortal::DrawContents()
|
||||||
horz.plane.Texheight = r_viewpoint.Pos.Z - fabs(horz.plane.Texheight);
|
horz.plane.Texheight = r_viewpoint.Pos.Z - fabs(horz.plane.Texheight);
|
||||||
}
|
}
|
||||||
GLHorizonPortal floor(&horz, true);
|
GLHorizonPortal floor(&horz, true);
|
||||||
floor.DrawContents();
|
floor.DrawContents(di);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,9 +89,9 @@ protected:
|
||||||
GLPortal(bool local = false) { if (!local) portals.Push(this); }
|
GLPortal(bool local = false) { if (!local) portals.Push(this); }
|
||||||
virtual ~GLPortal() { }
|
virtual ~GLPortal() { }
|
||||||
|
|
||||||
bool Start(bool usestencil, bool doquery);
|
bool Start(bool usestencil, bool doquery, FDrawInfo **pDi);
|
||||||
void End(bool usestencil);
|
void End(bool usestencil);
|
||||||
virtual void DrawContents()=0;
|
virtual void DrawContents(FDrawInfo *di)=0;
|
||||||
virtual void * GetSource() const =0; // GetSource MUST be implemented!
|
virtual void * GetSource() const =0; // GetSource MUST be implemented!
|
||||||
void ClearClipper();
|
void ClearClipper();
|
||||||
virtual bool IsSky() { return false; }
|
virtual bool IsSky() { return false; }
|
||||||
|
@ -111,9 +111,10 @@ public:
|
||||||
// Start may perform an occlusion query. If that returns 0 there
|
// Start may perform an occlusion query. If that returns 0 there
|
||||||
// is no need to draw the stencil's contents and there's also no
|
// is no need to draw the stencil's contents and there's also no
|
||||||
// need to restore the affected area becasue there is none!
|
// need to restore the affected area becasue there is none!
|
||||||
if (Start(usestencil, doquery))
|
FDrawInfo *di;
|
||||||
|
if (Start(usestencil, doquery, &di))
|
||||||
{
|
{
|
||||||
DrawContents();
|
DrawContents(di);
|
||||||
End(usestencil);
|
End(usestencil);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,7 +135,7 @@ public:
|
||||||
virtual int ClipSubsector(subsector_t *sub) { return PClip_Inside; }
|
virtual int ClipSubsector(subsector_t *sub) { return PClip_Inside; }
|
||||||
virtual int ClipPoint(const DVector2 &pos) { return PClip_Inside; }
|
virtual int ClipPoint(const DVector2 &pos) { return PClip_Inside; }
|
||||||
virtual line_t *ClipLine() { return NULL; }
|
virtual line_t *ClipLine() { return NULL; }
|
||||||
virtual void RenderAttached() {}
|
virtual void RenderAttached(FDrawInfo *di) {}
|
||||||
|
|
||||||
static void BeginScene();
|
static void BeginScene();
|
||||||
static void StartFrame();
|
static void StartFrame();
|
||||||
|
@ -205,7 +206,7 @@ struct GLMirrorPortal : public GLLinePortal
|
||||||
line_t * linedef;
|
line_t * linedef;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawContents();
|
virtual void DrawContents(FDrawInfo *di);
|
||||||
virtual void * GetSource() const { return linedef; }
|
virtual void * GetSource() const { return linedef; }
|
||||||
virtual const char *GetName();
|
virtual const char *GetName();
|
||||||
|
|
||||||
|
@ -223,11 +224,11 @@ struct GLLineToLinePortal : public GLLinePortal
|
||||||
{
|
{
|
||||||
FLinePortalSpan *glport;
|
FLinePortalSpan *glport;
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawContents();
|
virtual void DrawContents(FDrawInfo *di);
|
||||||
virtual void * GetSource() const { return glport; }
|
virtual void * GetSource() const { return glport; }
|
||||||
virtual const char *GetName();
|
virtual const char *GetName();
|
||||||
virtual line_t *ClipLine() { return line(); }
|
virtual line_t *ClipLine() { return line(); }
|
||||||
virtual void RenderAttached();
|
virtual void RenderAttached(FDrawInfo *di);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -244,7 +245,7 @@ struct GLSkyboxPortal : public GLPortal
|
||||||
FSectorPortal * portal;
|
FSectorPortal * portal;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawContents();
|
virtual void DrawContents(FDrawInfo *di);
|
||||||
virtual void * GetSource() const { return portal; }
|
virtual void * GetSource() const { return portal; }
|
||||||
virtual bool IsSky() { return true; }
|
virtual bool IsSky() { return true; }
|
||||||
virtual const char *GetName();
|
virtual const char *GetName();
|
||||||
|
@ -266,7 +267,7 @@ struct GLSkyPortal : public GLPortal
|
||||||
friend struct GLEEHorizonPortal;
|
friend struct GLEEHorizonPortal;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawContents();
|
virtual void DrawContents(FDrawInfo *di);
|
||||||
virtual void * GetSource() const { return origin; }
|
virtual void * GetSource() const { return origin; }
|
||||||
virtual bool IsSky() { return true; }
|
virtual bool IsSky() { return true; }
|
||||||
virtual bool NeedDepthBuffer() { return false; }
|
virtual bool NeedDepthBuffer() { return false; }
|
||||||
|
@ -290,7 +291,7 @@ struct GLSectorStackPortal : public GLPortal
|
||||||
TArray<subsector_t *> subsectors;
|
TArray<subsector_t *> subsectors;
|
||||||
protected:
|
protected:
|
||||||
virtual ~GLSectorStackPortal();
|
virtual ~GLSectorStackPortal();
|
||||||
virtual void DrawContents();
|
virtual void DrawContents(FDrawInfo *di);
|
||||||
virtual void * GetSource() const { return origin; }
|
virtual void * GetSource() const { return origin; }
|
||||||
virtual bool IsSky() { return true; } // although this isn't a real sky it can be handled as one.
|
virtual bool IsSky() { return true; } // although this isn't a real sky it can be handled as one.
|
||||||
virtual const char *GetName();
|
virtual const char *GetName();
|
||||||
|
@ -313,7 +314,7 @@ public:
|
||||||
struct GLPlaneMirrorPortal : public GLPortal
|
struct GLPlaneMirrorPortal : public GLPortal
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawContents();
|
virtual void DrawContents(FDrawInfo *di);
|
||||||
virtual void * GetSource() const { return origin; }
|
virtual void * GetSource() const { return origin; }
|
||||||
virtual const char *GetName();
|
virtual const char *GetName();
|
||||||
virtual void PushState();
|
virtual void PushState();
|
||||||
|
@ -338,7 +339,7 @@ struct GLHorizonPortal : public GLPortal
|
||||||
friend struct GLEEHorizonPortal;
|
friend struct GLEEHorizonPortal;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawContents();
|
virtual void DrawContents(FDrawInfo *di);
|
||||||
virtual void * GetSource() const { return origin; }
|
virtual void * GetSource() const { return origin; }
|
||||||
virtual bool NeedDepthBuffer() { return false; }
|
virtual bool NeedDepthBuffer() { return false; }
|
||||||
virtual bool NeedCap() { return false; }
|
virtual bool NeedCap() { return false; }
|
||||||
|
@ -354,7 +355,7 @@ struct GLEEHorizonPortal : public GLPortal
|
||||||
FSectorPortal * portal;
|
FSectorPortal * portal;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawContents();
|
virtual void DrawContents(FDrawInfo *di);
|
||||||
virtual void * GetSource() const { return portal; }
|
virtual void * GetSource() const { return portal; }
|
||||||
virtual bool NeedDepthBuffer() { return false; }
|
virtual bool NeedDepthBuffer() { return false; }
|
||||||
virtual bool NeedCap() { return false; }
|
virtual bool NeedCap() { return false; }
|
||||||
|
|
|
@ -234,7 +234,7 @@ void GLSceneDrawer::SetupView(float vx, float vy, float vz, DAngle va, bool mirr
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GLSceneDrawer::CreateScene()
|
void GLSceneDrawer::CreateScene(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
angle_t a1 = FrustumAngle();
|
angle_t a1 = FrustumAngle();
|
||||||
InitClipper(r_viewpoint.Angles.Yaw.BAMs() + a1, r_viewpoint.Angles.Yaw.BAMs() - a1);
|
InitClipper(r_viewpoint.Angles.Yaw.BAMs() + a1, r_viewpoint.Angles.Yaw.BAMs() - a1);
|
||||||
|
@ -254,26 +254,26 @@ void GLSceneDrawer::CreateScene()
|
||||||
SetView();
|
SetView();
|
||||||
validcount++; // used for processing sidedefs only once by the renderer.
|
validcount++; // used for processing sidedefs only once by the renderer.
|
||||||
|
|
||||||
gl_drawinfo->clipPortal = !!GLRenderer->mClipPortal;
|
di->clipPortal = !!GLRenderer->mClipPortal;
|
||||||
gl_drawinfo->mAngles = GLRenderer->mAngles;
|
di->mAngles = GLRenderer->mAngles;
|
||||||
gl_drawinfo->mViewVector = GLRenderer->mViewVector;
|
di->mViewVector = GLRenderer->mViewVector;
|
||||||
gl_drawinfo->mViewActor = GLRenderer->mViewActor;
|
di->mViewActor = GLRenderer->mViewActor;
|
||||||
gl_drawinfo->mShadowMap = &GLRenderer->mShadowMap;
|
di->mShadowMap = &GLRenderer->mShadowMap;
|
||||||
|
|
||||||
RenderBSPNode (level.HeadNode());
|
RenderBSPNode (level.HeadNode());
|
||||||
gl_drawinfo->PreparePlayerSprites(r_viewpoint.sector, in_area);
|
di->PreparePlayerSprites(r_viewpoint.sector, in_area);
|
||||||
|
|
||||||
// Process all the sprites on the current portal's back side which touch the portal.
|
// Process all the sprites on the current portal's back side which touch the portal.
|
||||||
if (GLRenderer->mCurrentPortal != NULL) GLRenderer->mCurrentPortal->RenderAttached();
|
if (GLRenderer->mCurrentPortal != NULL) GLRenderer->mCurrentPortal->RenderAttached(di);
|
||||||
Bsp.Unclock();
|
Bsp.Unclock();
|
||||||
|
|
||||||
// And now the crappy hacks that have to be done to avoid rendering anomalies.
|
// And now the crappy hacks that have to be done to avoid rendering anomalies.
|
||||||
// These cannot be multithreaded when the time comes because all these depend
|
// These cannot be multithreaded when the time comes because all these depend
|
||||||
// on the global 'validcount' variable.
|
// on the global 'validcount' variable.
|
||||||
|
|
||||||
gl_drawinfo->HandleMissingTextures(in_area); // Missing upper/lower textures
|
di->HandleMissingTextures(in_area); // Missing upper/lower textures
|
||||||
gl_drawinfo->HandleHackedSubsectors(); // open sector hacks for deep water
|
di->HandleHackedSubsectors(); // open sector hacks for deep water
|
||||||
gl_drawinfo->ProcessSectorStacks(in_area); // merge visplanes of sector stacks
|
di->ProcessSectorStacks(in_area); // merge visplanes of sector stacks
|
||||||
GLRenderer->mLights->Finish();
|
GLRenderer->mLights->Finish();
|
||||||
GLRenderer->mVBO->Unmap();
|
GLRenderer->mVBO->Unmap();
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ void GLSceneDrawer::RenderScene(FDrawInfo *di, int recursion)
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GLSceneDrawer::RenderTranslucent()
|
void GLSceneDrawer::RenderTranslucent(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
RenderAll.Clock();
|
RenderAll.Clock();
|
||||||
|
|
||||||
|
@ -424,8 +424,8 @@ void GLSceneDrawer::RenderTranslucent()
|
||||||
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
gl_RenderState.BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
gl_RenderState.EnableBrightmap(true);
|
gl_RenderState.EnableBrightmap(true);
|
||||||
gl_drawinfo->drawlists[GLDL_TRANSLUCENTBORDER].Draw(gl_drawinfo, GLPASS_TRANSLUCENT);
|
di->drawlists[GLDL_TRANSLUCENTBORDER].Draw(di, GLPASS_TRANSLUCENT);
|
||||||
gl_drawinfo->DrawSorted(GLDL_TRANSLUCENT);
|
di->DrawSorted(GLDL_TRANSLUCENT);
|
||||||
gl_RenderState.EnableBrightmap(false);
|
gl_RenderState.EnableBrightmap(false);
|
||||||
|
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@ void GLSceneDrawer::RenderTranslucent()
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GLSceneDrawer::DrawScene(int drawmode)
|
void GLSceneDrawer::DrawScene(FDrawInfo *di, int drawmode)
|
||||||
{
|
{
|
||||||
static int recursion=0;
|
static int recursion=0;
|
||||||
static int ssao_portals_available = 0;
|
static int ssao_portals_available = 0;
|
||||||
|
@ -469,16 +469,16 @@ void GLSceneDrawer::DrawScene(int drawmode)
|
||||||
if (r_viewpoint.camera != nullptr)
|
if (r_viewpoint.camera != nullptr)
|
||||||
{
|
{
|
||||||
ActorRenderFlags savedflags = r_viewpoint.camera->renderflags;
|
ActorRenderFlags savedflags = r_viewpoint.camera->renderflags;
|
||||||
CreateScene();
|
CreateScene(di);
|
||||||
r_viewpoint.camera->renderflags = savedflags;
|
r_viewpoint.camera->renderflags = savedflags;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CreateScene();
|
CreateScene(di);
|
||||||
}
|
}
|
||||||
GLRenderer->mClipPortal = NULL; // this must be reset before any portal recursion takes place.
|
GLRenderer->mClipPortal = NULL; // this must be reset before any portal recursion takes place.
|
||||||
|
|
||||||
RenderScene(gl_drawinfo, recursion);
|
RenderScene(di, recursion);
|
||||||
|
|
||||||
if (applySSAO && gl_RenderState.GetPassType() == GBUFFER_PASS)
|
if (applySSAO && gl_RenderState.GetPassType() == GBUFFER_PASS)
|
||||||
{
|
{
|
||||||
|
@ -495,7 +495,7 @@ void GLSceneDrawer::DrawScene(int drawmode)
|
||||||
recursion++;
|
recursion++;
|
||||||
GLPortal::EndFrame();
|
GLPortal::EndFrame();
|
||||||
recursion--;
|
recursion--;
|
||||||
RenderTranslucent();
|
RenderTranslucent(di);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -572,7 +572,7 @@ void GLSceneDrawer::DrawEndScene2D(FDrawInfo *di, sector_t * viewsector)
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void GLSceneDrawer::ProcessScene(bool toscreen)
|
void GLSceneDrawer::ProcessScene(FDrawInfo *di, bool toscreen)
|
||||||
{
|
{
|
||||||
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
|
iter_dlightf = iter_dlight = draw_dlight = draw_dlightf = 0;
|
||||||
GLPortal::BeginScene();
|
GLPortal::BeginScene();
|
||||||
|
@ -581,7 +581,7 @@ void GLSceneDrawer::ProcessScene(bool toscreen)
|
||||||
CurrentMapSections.Resize(level.NumMapSections);
|
CurrentMapSections.Resize(level.NumMapSections);
|
||||||
CurrentMapSections.Zero();
|
CurrentMapSections.Zero();
|
||||||
CurrentMapSections.Set(mapsection);
|
CurrentMapSections.Set(mapsection);
|
||||||
DrawScene(toscreen ? DM_MAINVIEW : DM_OFFSCREEN);
|
DrawScene(di, toscreen ? DM_MAINVIEW : DM_OFFSCREEN);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,13 +694,13 @@ sector_t * GLSceneDrawer::RenderViewpoint (AActor * camera, IntRect * bounds, fl
|
||||||
SetViewMatrix(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, false, false);
|
SetViewMatrix(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z, false, false);
|
||||||
gl_RenderState.ApplyMatrices();
|
gl_RenderState.ApplyMatrices();
|
||||||
|
|
||||||
FDrawInfo::StartDrawInfo(this);
|
FDrawInfo *di = FDrawInfo::StartDrawInfo(this);
|
||||||
ProcessScene(toscreen);
|
ProcessScene(di, toscreen);
|
||||||
if (mainview && toscreen) EndDrawScene(gl_drawinfo, lviewsector); // do not call this for camera textures.
|
if (mainview && toscreen) EndDrawScene(di, lviewsector); // do not call this for camera textures.
|
||||||
|
|
||||||
if (mainview && FGLRenderBuffers::IsEnabled())
|
if (mainview && FGLRenderBuffers::IsEnabled())
|
||||||
{
|
{
|
||||||
GLRenderer->PostProcessScene(FixedColormap, [&]() { if (gl_bloom && FixedColormap == CM_DEFAULT) DrawEndScene2D(gl_drawinfo, lviewsector); });
|
GLRenderer->PostProcessScene(FixedColormap, [&]() { if (gl_bloom && FixedColormap == CM_DEFAULT) DrawEndScene2D(di, lviewsector); });
|
||||||
|
|
||||||
// This should be done after postprocessing, not before.
|
// This should be done after postprocessing, not before.
|
||||||
GLRenderer->mBuffers->BindCurrentFB();
|
GLRenderer->mBuffers->BindCurrentFB();
|
||||||
|
|
|
@ -34,9 +34,9 @@ class GLSceneDrawer
|
||||||
void RenderBSPNode(void *node);
|
void RenderBSPNode(void *node);
|
||||||
|
|
||||||
void RenderScene(FDrawInfo *di, int recursion);
|
void RenderScene(FDrawInfo *di, int recursion);
|
||||||
void RenderTranslucent();
|
void RenderTranslucent(FDrawInfo *di);
|
||||||
|
|
||||||
void CreateScene();
|
void CreateScene(FDrawInfo *di);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLSceneDrawer()
|
GLSceneDrawer()
|
||||||
|
@ -58,8 +58,8 @@ public:
|
||||||
void Set3DViewport(bool mainview);
|
void Set3DViewport(bool mainview);
|
||||||
void Reset3DViewport();
|
void Reset3DViewport();
|
||||||
void SetFixedColormap(player_t *player);
|
void SetFixedColormap(player_t *player);
|
||||||
void DrawScene(int drawmode);
|
void DrawScene(FDrawInfo *di, int drawmode);
|
||||||
void ProcessScene(bool toscreen = false);
|
void ProcessScene(FDrawInfo *di, bool toscreen = false);
|
||||||
void EndDrawScene(FDrawInfo *di, sector_t * viewsector);
|
void EndDrawScene(FDrawInfo *di, sector_t * viewsector);
|
||||||
void DrawEndScene2D(FDrawInfo *di, sector_t * viewsector);
|
void DrawEndScene2D(FDrawInfo *di, sector_t * viewsector);
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,7 @@ static void RenderBox(FTextureID texno, FMaterial * gltex, float x_offset, bool
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GLSkyPortal::DrawContents()
|
void GLSkyPortal::DrawContents(FDrawInfo *di)
|
||||||
{
|
{
|
||||||
bool drawBoth = false;
|
bool drawBoth = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue