mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
- moved GLScenePortal to the hardware independent code.
This commit is contained in:
parent
c76c4b77ec
commit
e6b5eba469
7 changed files with 47 additions and 44 deletions
|
@ -39,14 +39,6 @@ class GLViewpointBuffer;
|
|||
struct FRenderViewpoint;
|
||||
#define NOQUEUE nullptr // just some token to be used as a placeholder
|
||||
|
||||
enum
|
||||
{
|
||||
DM_MAINVIEW,
|
||||
DM_OFFSCREEN,
|
||||
DM_PORTAL,
|
||||
DM_SKYPORTAL
|
||||
};
|
||||
|
||||
class FGLRenderer
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -242,10 +242,10 @@ void FDrawInfo::AddSubsectorToPortal(FSectorPortalGroup *ptg, subsector_t *sub)
|
|||
auto portal = FindPortal(ptg);
|
||||
if (!portal)
|
||||
{
|
||||
portal = new GLScenePortal(&GLRenderer->mPortalState, new HWSectorStackPortal(ptg));
|
||||
portal = new HWScenePortal(&GLRenderer->mPortalState, new HWSectorStackPortal(ptg));
|
||||
Portals.Push(portal);
|
||||
}
|
||||
auto ptl = static_cast<HWSectorStackPortal*>(static_cast<GLScenePortal*>(portal)->mScene);
|
||||
auto ptl = static_cast<HWSectorStackPortal*>(static_cast<HWScenePortal*>(portal)->mScene);
|
||||
ptl->AddSubsector(sub);
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ struct FDrawInfo : public HWDrawInfo
|
|||
void CreateScene();
|
||||
void RenderScene(int recursion);
|
||||
void RenderTranslucent();
|
||||
void DrawScene(int drawmode);
|
||||
void DrawScene(int drawmode) override;
|
||||
void ProcessScene(bool toscreen = false);
|
||||
void EndDrawScene(sector_t * viewsector);
|
||||
void DrawEndScene2D(sector_t * viewsector);
|
||||
|
|
|
@ -46,34 +46,6 @@
|
|||
|
||||
struct GLEEHorizonPortal;
|
||||
|
||||
class GLScenePortal : public HWPortal
|
||||
{
|
||||
public:
|
||||
HWScenePortalBase *mScene;
|
||||
GLScenePortal(FPortalSceneState *state, HWScenePortalBase *handler) : HWPortal(state, false)
|
||||
{
|
||||
mScene = handler;
|
||||
handler->SetOwner(this);
|
||||
}
|
||||
~GLScenePortal() { delete mScene; }
|
||||
virtual void * GetSource() const { return mScene->GetSource(); }
|
||||
virtual const char *GetName() { return mScene->GetName(); }
|
||||
virtual bool IsSky() { return mScene->IsSky(); }
|
||||
virtual bool NeedCap() { return true; }
|
||||
virtual bool NeedDepthBuffer() { return true; }
|
||||
virtual void DrawContents(HWDrawInfo *di)
|
||||
{
|
||||
if (mScene->Setup(di, di->mClipper))
|
||||
{
|
||||
static_cast<FDrawInfo*>(di)->DrawScene(DM_PORTAL);
|
||||
mScene->Shutdown(di);
|
||||
}
|
||||
else di->ClearScreen();
|
||||
}
|
||||
virtual void RenderAttached(HWDrawInfo *di) { return mScene->RenderAttached(di); }
|
||||
};
|
||||
|
||||
|
||||
struct GLSkyPortal : public HWPortal
|
||||
{
|
||||
GLSkyInfo * origin;
|
||||
|
|
|
@ -127,7 +127,7 @@ void FDrawInfo::AddPortal(GLWall *wall, int ptype)
|
|||
if (wall->secportal->mType != PORTS_SKYVIEWPOINT) portal = new GLEEHorizonPortal(&pstate, wall->secportal);
|
||||
else
|
||||
{
|
||||
portal = new GLScenePortal(&pstate, new HWSkyboxPortal(wall->secportal));
|
||||
portal = new HWScenePortal(&pstate, new HWSkyboxPortal(wall->secportal));
|
||||
Portals.Push(portal);
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ void FDrawInfo::AddPortal(GLWall *wall, int ptype)
|
|||
portal = FindPortal(wall->portal);
|
||||
if (!portal)
|
||||
{
|
||||
portal = new GLScenePortal(&pstate, new HWSectorStackPortal(wall->portal));
|
||||
portal = new HWScenePortal(&pstate, new HWSectorStackPortal(wall->portal));
|
||||
Portals.Push(portal);
|
||||
}
|
||||
portal->AddLine(wall);
|
||||
|
@ -152,7 +152,7 @@ void FDrawInfo::AddPortal(GLWall *wall, int ptype)
|
|||
portal = FindPortal(wall->planemirror);
|
||||
if (!portal)
|
||||
{
|
||||
portal = new GLScenePortal(&pstate, new HWPlaneMirrorPortal(wall->planemirror));
|
||||
portal = new HWScenePortal(&pstate, new HWPlaneMirrorPortal(wall->planemirror));
|
||||
Portals.Push(portal);
|
||||
}
|
||||
portal->AddLine(wall);
|
||||
|
@ -163,7 +163,7 @@ void FDrawInfo::AddPortal(GLWall *wall, int ptype)
|
|||
portal = FindPortal(wall->seg->linedef);
|
||||
if (!portal)
|
||||
{
|
||||
portal = new GLScenePortal(&pstate, new HWMirrorPortal(wall->seg->linedef));
|
||||
portal = new HWScenePortal(&pstate, new HWMirrorPortal(wall->seg->linedef));
|
||||
Portals.Push(portal);
|
||||
}
|
||||
portal->AddLine(wall);
|
||||
|
@ -183,7 +183,7 @@ void FDrawInfo::AddPortal(GLWall *wall, int ptype)
|
|||
{
|
||||
ProcessActorsInPortal(otherside->getPortal()->mGroup, in_area);
|
||||
}
|
||||
portal = new GLScenePortal(&pstate, new HWLineToLinePortal(wall->lineportal));
|
||||
portal = new HWScenePortal(&pstate, new HWLineToLinePortal(wall->lineportal));
|
||||
Portals.Push(portal);
|
||||
}
|
||||
portal->AddLine(wall);
|
||||
|
|
|
@ -8,6 +8,15 @@
|
|||
#include "v_video.h"
|
||||
#include "hw_weapon.h"
|
||||
|
||||
enum EDrawMode
|
||||
{
|
||||
DM_MAINVIEW,
|
||||
DM_OFFSCREEN,
|
||||
DM_PORTAL,
|
||||
DM_SKYPORTAL
|
||||
};
|
||||
|
||||
|
||||
enum EDrawType
|
||||
{
|
||||
DT_Points = 0,
|
||||
|
@ -339,6 +348,7 @@ public:
|
|||
virtual void DrawModel(GLSprite *spr, FRenderState &state) = 0;
|
||||
virtual void DrawHUDModel(HUDSprite *spr, FRenderState &state) = 0;
|
||||
virtual void RenderPortal(HWPortal *p, bool usestencil) = 0;
|
||||
virtual void DrawScene(int drawmode) = 0;
|
||||
|
||||
|
||||
// Immediate render state change commands. These only change infrequently and should not clutter the render state.
|
||||
|
|
|
@ -305,3 +305,32 @@ public:
|
|||
|
||||
};
|
||||
|
||||
|
||||
class HWScenePortal : public HWPortal
|
||||
{
|
||||
public:
|
||||
HWScenePortalBase *mScene;
|
||||
HWScenePortal(FPortalSceneState *state, HWScenePortalBase *handler) : HWPortal(state, false)
|
||||
{
|
||||
mScene = handler;
|
||||
handler->SetOwner(this);
|
||||
}
|
||||
~HWScenePortal() { delete mScene; }
|
||||
virtual void * GetSource() const { return mScene->GetSource(); }
|
||||
virtual const char *GetName() { return mScene->GetName(); }
|
||||
virtual bool IsSky() { return mScene->IsSky(); }
|
||||
virtual bool NeedCap() { return true; }
|
||||
virtual bool NeedDepthBuffer() { return true; }
|
||||
virtual void DrawContents(HWDrawInfo *di)
|
||||
{
|
||||
if (mScene->Setup(di, di->mClipper))
|
||||
{
|
||||
di->DrawScene(DM_PORTAL);
|
||||
mScene->Shutdown(di);
|
||||
}
|
||||
else di->ClearScreen();
|
||||
}
|
||||
virtual void RenderAttached(HWDrawInfo *di) { return mScene->RenderAttached(di); }
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue