- moved the current portal pointer to HWDrawInfo so that the portal managed does not need to save and restore a global variable for each portal.

This commit is contained in:
Christoph Oelckers 2018-06-23 13:51:19 +02:00
parent 282fdac660
commit 1cf3af9c41
7 changed files with 4 additions and 11 deletions

View file

@ -86,7 +86,6 @@ extern bool NoInterpolateView;
FGLRenderer::FGLRenderer(OpenGLFrameBuffer *fb)
{
framebuffer = fb;
mCurrentPortal = nullptr;
mMirrorCount = 0;
mPlaneMirrorCount = 0;
mVBO = nullptr;

View file

@ -66,8 +66,6 @@ class FGLRenderer
public:
OpenGLFrameBuffer *framebuffer;
//GLPortal *mClipPortal;
GLPortal *mCurrentPortal;
int mMirrorCount;
int mPlaneMirrorCount;
FShaderManager *mShaderManager;

View file

@ -213,14 +213,11 @@ bool GLPortal::Start(bool usestencil, bool doquery, HWDrawInfo *outer_di, HWDraw
}
}
*pDi = FDrawInfo::StartDrawInfo(outer_di->Viewpoint, &outer_di->VPUniforms);
(*pDi)->mCurrentPortal = this;
// save viewpoint
savedvisibility = outer_di->Viewpoint.camera ? outer_di->Viewpoint.camera->renderflags & RF_MAYBEINVISIBLE : ActorRenderFlags::FromInt(0);
PrevPortal = GLRenderer->mCurrentPortal;
GLRenderer->mCurrentPortal = this;
return true;
}
@ -263,7 +260,6 @@ void GLPortal::End(HWDrawInfo *di, bool usestencil)
bool needdepth = NeedDepthBuffer();
Clocker c(PortalAll);
GLRenderer->mCurrentPortal = PrevPortal;
di = static_cast<FDrawInfo*>(di)->EndDrawInfo();
di->ApplyVPUniforms();

View file

@ -53,7 +53,6 @@ private:
void DrawPortalStencil();
ActorRenderFlags savedvisibility;
GLPortal *PrevPortal;
TArray<unsigned int> mPrimIndices;
protected:

View file

@ -130,7 +130,7 @@ void FDrawInfo::CreateScene()
PreparePlayerSprites(vp.sector, in_area);
// Process all the sprites on the current portal's back side which touch the portal.
if (GLRenderer->mCurrentPortal != NULL) GLRenderer->mCurrentPortal->RenderAttached(this);
if (mCurrentPortal != nullptr) mCurrentPortal->RenderAttached(this);
Bsp.Unclock();
// And now the crappy hacks that have to be done to avoid rendering anomalies.
@ -414,7 +414,6 @@ void FDrawInfo::ProcessScene(bool toscreen)
int mapsection = R_PointInSubsector(Viewpoint.Pos)->mapsection;
CurrentMapSections.Set(mapsection);
GLRenderer->mCurrentPortal = nullptr;
DrawScene(toscreen ? DM_MAINVIEW : DM_OFFSCREEN);
}

View file

@ -95,6 +95,7 @@ void HWDrawInfo::ClearBuffers()
memset(&no_renderflags[0], 0, level.nodes.Size() * sizeof(no_renderflags[0]));
mClipPortal = nullptr;
mCurrentPortal = nullptr;
}
//==========================================================================

View file

@ -99,6 +99,7 @@ struct HWDrawInfo
int FullbrightFlags;
std::atomic<int> spriteindex;
IPortal *mClipPortal;
IPortal *mCurrentPortal;
//FRotator mAngles;
IShadowMap *mShadowMap;
Clipper *mClipper;