mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- moved more code out of FDrawInfo.
This commit is contained in:
parent
cb4ffbf053
commit
1ca811d4a8
5 changed files with 54 additions and 46 deletions
|
@ -97,38 +97,17 @@ static Clipper staticClipper;
|
||||||
FDrawInfo *FDrawInfo::StartDrawInfo(FRenderViewpoint &parentvp, HWViewpointUniforms *uniforms)
|
FDrawInfo *FDrawInfo::StartDrawInfo(FRenderViewpoint &parentvp, HWViewpointUniforms *uniforms)
|
||||||
{
|
{
|
||||||
FDrawInfo *di=di_list.GetNew();
|
FDrawInfo *di=di_list.GetNew();
|
||||||
di->mClipper = &staticClipper;
|
|
||||||
di->Viewpoint = parentvp;
|
|
||||||
if (uniforms)
|
|
||||||
{
|
|
||||||
di->VPUniforms = *uniforms;
|
|
||||||
// The clip planes will never be inherited from the parent drawinfo.
|
|
||||||
di->VPUniforms.mClipLine.X = -1000001.f;
|
|
||||||
di->VPUniforms.mClipHeight = 0;
|
|
||||||
}
|
|
||||||
else di->VPUniforms.SetDefaults();
|
|
||||||
di->mClipper->SetViewpoint(di->Viewpoint);
|
|
||||||
staticClipper.Clear();
|
staticClipper.Clear();
|
||||||
di->StartScene();
|
di->mClipper = &staticClipper;
|
||||||
|
|
||||||
|
di->StartScene(parentvp, uniforms);
|
||||||
|
|
||||||
|
di->outer = gl_drawinfo;
|
||||||
|
gl_drawinfo = di;
|
||||||
|
|
||||||
return di;
|
return di;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDrawInfo::StartScene()
|
|
||||||
{
|
|
||||||
ClearBuffers();
|
|
||||||
|
|
||||||
outer = gl_drawinfo;
|
|
||||||
gl_drawinfo = this;
|
|
||||||
for (int i = 0; i < GLDL_TYPES; i++) drawlists[i].Reset();
|
|
||||||
hudsprites.Clear();
|
|
||||||
vpIndex = 0;
|
|
||||||
|
|
||||||
// Fullbright information needs to be propagated from the main view.
|
|
||||||
if (outer != nullptr) FullbrightFlags = outer->FullbrightFlags;
|
|
||||||
else FullbrightFlags = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -145,19 +124,6 @@ FDrawInfo *FDrawInfo::EndDrawInfo()
|
||||||
return gl_drawinfo;
|
return gl_drawinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Same here for the dependency on the portal.
|
|
||||||
void FDrawInfo::AddSubsectorToPortal(FSectorPortalGroup *ptg, subsector_t *sub)
|
|
||||||
{
|
|
||||||
auto portal = FindPortal(ptg);
|
|
||||||
if (!portal)
|
|
||||||
{
|
|
||||||
portal = new HWScenePortal(screen->mPortalState, new HWSectorStackPortal(ptg));
|
|
||||||
Portals.Push(portal);
|
|
||||||
}
|
|
||||||
auto ptl = static_cast<HWSectorStackPortal*>(static_cast<HWScenePortal*>(portal)->mScene);
|
|
||||||
ptl->AddSubsector(sub);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FDrawInfo::SetDepthClamp(bool on)
|
bool FDrawInfo::SetDepthClamp(bool on)
|
||||||
{
|
{
|
||||||
return gl_RenderState.SetDepthClamp(on);
|
return gl_RenderState.SetDepthClamp(on);
|
||||||
|
|
|
@ -26,10 +26,6 @@ struct FDrawInfo : public HWDrawInfo
|
||||||
void SetCulling(int mode) override;
|
void SetCulling(int mode) override;
|
||||||
void EnableClipDistance(int num, bool state) override;
|
void EnableClipDistance(int num, bool state) override;
|
||||||
|
|
||||||
void StartScene();
|
|
||||||
|
|
||||||
void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub) override;
|
|
||||||
|
|
||||||
void CreateScene();
|
void CreateScene();
|
||||||
void RenderScene(int recursion);
|
void RenderScene(int recursion);
|
||||||
void RenderTranslucent();
|
void RenderTranslucent();
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "hwrenderer/utility/hw_clock.h"
|
#include "hwrenderer/utility/hw_clock.h"
|
||||||
#include "hwrenderer/utility/hw_cvars.h"
|
#include "hwrenderer/utility/hw_cvars.h"
|
||||||
#include "hwrenderer/data/hw_viewpointbuffer.h"
|
#include "hwrenderer/data/hw_viewpointbuffer.h"
|
||||||
|
#include "hw_clipper.h"
|
||||||
|
|
||||||
EXTERN_CVAR(Float, r_visibility)
|
EXTERN_CVAR(Float, r_visibility)
|
||||||
CVAR(Bool, gl_bandedswlight, false, CVAR_ARCHIVE)
|
CVAR(Bool, gl_bandedswlight, false, CVAR_ARCHIVE)
|
||||||
|
@ -60,6 +61,31 @@ inline void DeleteLinkedList(T *node)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HWDrawInfo::StartScene(FRenderViewpoint &parentvp, HWViewpointUniforms *uniforms)
|
||||||
|
{
|
||||||
|
Viewpoint = parentvp;
|
||||||
|
if (uniforms)
|
||||||
|
{
|
||||||
|
VPUniforms = *uniforms;
|
||||||
|
// The clip planes will never be inherited from the parent drawinfo.
|
||||||
|
VPUniforms.mClipLine.X = -1000001.f;
|
||||||
|
VPUniforms.mClipHeight = 0;
|
||||||
|
}
|
||||||
|
else VPUniforms.SetDefaults();
|
||||||
|
mClipper->SetViewpoint(Viewpoint);
|
||||||
|
|
||||||
|
ClearBuffers();
|
||||||
|
|
||||||
|
for (int i = 0; i < GLDL_TYPES; i++) drawlists[i].Reset();
|
||||||
|
hudsprites.Clear();
|
||||||
|
vpIndex = 0;
|
||||||
|
|
||||||
|
// Fullbright information needs to be propagated from the main view.
|
||||||
|
if (outer != nullptr) FullbrightFlags = outer->FullbrightFlags;
|
||||||
|
else FullbrightFlags = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void HWDrawInfo::ClearBuffers()
|
void HWDrawInfo::ClearBuffers()
|
||||||
{
|
{
|
||||||
for (auto node : otherfloorplanes) DeleteLinkedList(node);
|
for (auto node : otherfloorplanes) DeleteLinkedList(node);
|
||||||
|
|
|
@ -298,6 +298,7 @@ public:
|
||||||
HWPortal * FindPortal(const void * src);
|
HWPortal * FindPortal(const void * src);
|
||||||
void RenderBSPNode(void *node);
|
void RenderBSPNode(void *node);
|
||||||
|
|
||||||
|
void StartScene(FRenderViewpoint &parentvp, HWViewpointUniforms *uniforms);
|
||||||
void ClearBuffers();
|
void ClearBuffers();
|
||||||
void SetViewArea();
|
void SetViewArea();
|
||||||
int SetFullbrightFlags(player_t *player);
|
int SetFullbrightFlags(player_t *player);
|
||||||
|
@ -349,7 +350,7 @@ public:
|
||||||
void DrawPlayerSprites(bool hudModelStep, FRenderState &state);
|
void DrawPlayerSprites(bool hudModelStep, FRenderState &state);
|
||||||
|
|
||||||
void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs);
|
void ProcessLowerMinisegs(TArray<seg_t *> &lowersegs);
|
||||||
virtual void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub) = 0;
|
void AddSubsectorToPortal(FSectorPortalGroup *portal, subsector_t *sub);
|
||||||
|
|
||||||
void AddWall(GLWall *w);
|
void AddWall(GLWall *w);
|
||||||
void AddMirrorSurface(GLWall *w);
|
void AddMirrorSurface(GLWall *w);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "hwrenderer/dynlights/hw_dynlightdata.h"
|
#include "hwrenderer/dynlights/hw_dynlightdata.h"
|
||||||
#include "hwrenderer/data/flatvertices.h"
|
#include "hwrenderer/data/flatvertices.h"
|
||||||
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
#include "hwrenderer/dynlights/hw_lightbuffer.h"
|
||||||
|
#include "hwrenderer/scene/hw_portal.h"
|
||||||
|
|
||||||
sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool back);
|
sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool back);
|
||||||
|
|
||||||
|
@ -1365,3 +1366,21 @@ void HWDrawInfo::ProcessSectorStacks(area_t in_area)
|
||||||
CeilingStacks.Clear();
|
CeilingStacks.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void HWDrawInfo::AddSubsectorToPortal(FSectorPortalGroup *ptg, subsector_t *sub)
|
||||||
|
{
|
||||||
|
auto portal = FindPortal(ptg);
|
||||||
|
if (!portal)
|
||||||
|
{
|
||||||
|
portal = new HWScenePortal(screen->mPortalState, new HWSectorStackPortal(ptg));
|
||||||
|
Portals.Push(portal);
|
||||||
|
}
|
||||||
|
auto ptl = static_cast<HWSectorStackPortal*>(static_cast<HWScenePortal*>(portal)->mScene);
|
||||||
|
ptl->AddSubsector(sub);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue