mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- fixed: Horizon portals must be drawn in the context of their containing drawinfo.
This data, however, was not passed along to the portal processor and resulted in null pointers when trying to access it.
This commit is contained in:
parent
33753955ac
commit
322488d1d1
3 changed files with 14 additions and 12 deletions
|
@ -159,7 +159,7 @@ void GLPortal::DrawPortalStencil()
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool GLPortal::Start(bool usestencil, bool doquery, FDrawInfo **pDi)
|
||||
bool GLPortal::Start(bool usestencil, bool doquery, FDrawInfo *outer_di, FDrawInfo **pDi)
|
||||
{
|
||||
*pDi = nullptr;
|
||||
rendered_portals++;
|
||||
|
@ -246,6 +246,7 @@ bool GLPortal::Start(bool usestencil, bool doquery, FDrawInfo **pDi)
|
|||
gl_RenderState.SetEffect(EFF_NONE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDepthMask(false); // don't write to Z-buffer!
|
||||
*pDi = outer_di;
|
||||
}
|
||||
}
|
||||
recursion++;
|
||||
|
@ -262,6 +263,7 @@ bool GLPortal::Start(bool usestencil, bool doquery, FDrawInfo **pDi)
|
|||
{
|
||||
glDepthMask(false);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
*pDi = outer_di;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,7 +460,7 @@ static FString indent;
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GLPortal::EndFrame()
|
||||
void GLPortal::EndFrame(FDrawInfo *outer_di)
|
||||
{
|
||||
GLPortal * p;
|
||||
|
||||
|
@ -481,7 +483,7 @@ void GLPortal::EndFrame()
|
|||
}
|
||||
if (p->lines.Size() > 0)
|
||||
{
|
||||
p->RenderPortal(true, usequery);
|
||||
p->RenderPortal(true, usequery, outer_di);
|
||||
}
|
||||
delete p;
|
||||
}
|
||||
|
@ -503,7 +505,7 @@ void GLPortal::EndFrame()
|
|||
// the GPU and there's rarely more than one sky visible at a time.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
bool GLPortal::RenderFirstSkyPortal(int recursion)
|
||||
bool GLPortal::RenderFirstSkyPortal(int recursion, FDrawInfo *outer_di)
|
||||
{
|
||||
GLPortal * p;
|
||||
GLPortal * best = NULL;
|
||||
|
@ -531,7 +533,7 @@ bool GLPortal::RenderFirstSkyPortal(int recursion)
|
|||
if (best)
|
||||
{
|
||||
portals.Delete(bestindex);
|
||||
best->RenderPortal(false, false);
|
||||
best->RenderPortal(false, false, outer_di);
|
||||
delete best;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ protected:
|
|||
GLPortal(bool local = false) { if (!local) portals.Push(this); }
|
||||
virtual ~GLPortal() { }
|
||||
|
||||
bool Start(bool usestencil, bool doquery, FDrawInfo **pDi);
|
||||
bool Start(bool usestencil, bool doquery, FDrawInfo *outer_di, FDrawInfo **pDi);
|
||||
void End(bool usestencil);
|
||||
virtual void DrawContents(FDrawInfo *di)=0;
|
||||
virtual void * GetSource() const =0; // GetSource MUST be implemented!
|
||||
|
@ -101,13 +101,13 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
void RenderPortal(bool usestencil, bool doquery)
|
||||
void RenderPortal(bool usestencil, bool doquery, FDrawInfo *outer_di)
|
||||
{
|
||||
// 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
|
||||
// need to restore the affected area becasue there is none!
|
||||
FDrawInfo *di;
|
||||
if (Start(usestencil, doquery, &di))
|
||||
if (Start(usestencil, doquery, outer_di, &di))
|
||||
{
|
||||
DrawContents(di);
|
||||
End(usestencil);
|
||||
|
@ -130,8 +130,8 @@ public:
|
|||
|
||||
static void BeginScene();
|
||||
static void StartFrame();
|
||||
static bool RenderFirstSkyPortal(int recursion);
|
||||
static void EndFrame();
|
||||
static bool RenderFirstSkyPortal(int recursion, FDrawInfo *outer_di);
|
||||
static void EndFrame(FDrawInfo *outer_di);
|
||||
static GLPortal * FindPortal(const void * src);
|
||||
|
||||
static void Initialize();
|
||||
|
|
|
@ -273,7 +273,7 @@ void GLSceneDrawer::RenderScene(FDrawInfo *di, int recursion)
|
|||
RenderAll.Clock();
|
||||
|
||||
glDepthMask(true);
|
||||
if (!gl_no_skyclear) GLPortal::RenderFirstSkyPortal(recursion);
|
||||
if (!gl_no_skyclear) GLPortal::RenderFirstSkyPortal(recursion, di);
|
||||
|
||||
gl_RenderState.SetCameraPos(r_viewpoint.Pos.X, r_viewpoint.Pos.Y, r_viewpoint.Pos.Z);
|
||||
|
||||
|
@ -458,7 +458,7 @@ void GLSceneDrawer::DrawScene(FDrawInfo *di, int drawmode)
|
|||
// Handle all portals after rendering the opaque objects but before
|
||||
// doing all translucent stuff
|
||||
recursion++;
|
||||
GLPortal::EndFrame();
|
||||
GLPortal::EndFrame(di);
|
||||
recursion--;
|
||||
RenderTranslucent(di);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue