- portal refactoring complete.

This commit is contained in:
Christoph Oelckers 2018-10-25 22:30:03 +02:00
parent bc97e585ba
commit c98474d1c7
7 changed files with 10 additions and 8 deletions

View file

@ -58,7 +58,6 @@ public:
FVertexBuffer(bool wantbuffer = true);
virtual ~FVertexBuffer();
virtual void BindVBO() = 0;
void EnableBufferArrays(int enable, int disable);
};
struct FSimpleVertex

View file

@ -36,7 +36,6 @@ struct FDrawInfo : public HWDrawInfo
void AddWall(GLWall *wall) override;
void AddMirrorSurface(GLWall *w) override;
void AddPortal(GLWall *w, int portaltype) override;
void AddFlat(GLFlat *flat, bool fog) override;
void AddSprite(GLSprite *sprite, bool translucent) override;

View file

@ -329,7 +329,6 @@ public:
virtual void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub) = 0;
virtual void AddWall(GLWall *w) = 0;
virtual void AddPortal(GLWall *w, int portaltype) = 0;
virtual void AddMirrorSurface(GLWall *w) = 0;
virtual void AddFlat(GLFlat *flat, bool fog) = 0;
virtual void AddSprite(GLSprite *sprite, bool translucent) = 0;

View file

@ -811,7 +811,7 @@ HWHorizonPortal::HWHorizonPortal(FPortalSceneState *s, GLHorizonInfo * pt, FRend
// Draw to some far away boundary
// This is not drawn as larger strips because it causes visual glitches.
auto verts = di->AllocVertices(256 + 10);
auto verts = di->AllocVertices(1024 + 10);
auto ptr = verts.first;
for (int xx = -32768; xx < 32768; xx += 4096)
{
@ -855,7 +855,7 @@ HWHorizonPortal::HWHorizonPortal(FPortalSceneState *s, GLHorizonInfo * pt, FRend
ptr++;
voffset = verts.second;
vcount = 256;
vcount = 1024;
}
@ -905,7 +905,7 @@ void HWHorizonPortal::DrawContents(HWDrawInfo *di, FRenderState &state)
for (unsigned i = 0; i < vcount; i += 4)
{
di->Draw(DT_TriangleStrip, state, voffset + i, 4, i==0);
di->Draw(DT_TriangleStrip, state, voffset + i, 4, true);// i == 0);
}
di->Draw(DT_TriangleStrip, state, voffset + vcount, 10, false);

View file

@ -81,11 +81,13 @@ EXTERN_CVAR(Float, skyoffset)
FSkyDomeCreator::FSkyDomeCreator()
{
screen->mSkyData = this;
CreateDome();
}
FSkyDomeCreator::~FSkyDomeCreator()
{
if (screen && screen->mSkyData) screen->mSkyData = nullptr;
}
//-----------------------------------------------------------------------------

View file

@ -39,6 +39,7 @@
#include "hwrenderer/scene/hw_drawstructs.h"
#include "hwrenderer/scene/hw_portal.h"
#include "hw_renderstate.h"
#include "hw_skydome.h"
//==========================================================================
//
@ -470,7 +471,7 @@ void GLWall::PutPortal(HWDrawInfo *di, int ptype)
break;
case PORTALTYPE_SECTORSTACK:
portal = di->FindPortal(portal);
portal = di->FindPortal(this->portal);
if (!portal)
{
portal = new HWScenePortal(pstate, new HWSectorStackPortal(this->portal));
@ -529,7 +530,7 @@ void GLWall::PutPortal(HWDrawInfo *di, int ptype)
portal = di->FindPortal(sky);
if (!portal)
{
portal = new HWSkyPortal(GLRenderer->mSkyVBO, &pstate, sky);
portal = new HWSkyPortal(screen->mSkyData, pstate, sky);
di->Portals.Push(portal);
}
portal->AddLine(this);

View file

@ -49,6 +49,7 @@ struct sector_t;
class IShaderProgram;
class FTexture;
struct FPortalSceneState;
class FSkyDomeCreator;
enum EHWCaps
{
@ -368,6 +369,7 @@ public:
int stencilValue = 0; // Global stencil test value
bool enable_quadbuffered = false;
FPortalSceneState *mPortalState; // global portal state.
FSkyDomeCreator *mSkyData; // we need access to this in the device independent part, but cannot depend on how the renderer manages it internally.
IntRect mScreenViewport;
IntRect mSceneViewport;