mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-29 15:32:54 +00:00
Make visplanes hash list private
This commit is contained in:
parent
a92771431b
commit
9eef7f9b32
3 changed files with 33 additions and 16 deletions
|
@ -302,6 +302,27 @@ namespace swrenderer
|
||||||
return pl;
|
return pl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VisiblePlaneList::HasPortalPlanes() const
|
||||||
|
{
|
||||||
|
return visplanes[MAXVISPLANES] != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
visplane_t *VisiblePlaneList::PopFirstPortalPlane()
|
||||||
|
{
|
||||||
|
visplane_t *pl = visplanes[VisiblePlaneList::MAXVISPLANES];
|
||||||
|
if (pl)
|
||||||
|
{
|
||||||
|
visplanes[VisiblePlaneList::MAXVISPLANES] = pl->next;
|
||||||
|
pl->next = nullptr;
|
||||||
|
}
|
||||||
|
return pl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VisiblePlaneList::ClearPortalPlanes()
|
||||||
|
{
|
||||||
|
visplanes[VisiblePlaneList::MAXVISPLANES] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
int VisiblePlaneList::Render()
|
int VisiblePlaneList::Render()
|
||||||
{
|
{
|
||||||
visplane_t *pl;
|
visplane_t *pl;
|
||||||
|
|
|
@ -32,16 +32,20 @@ namespace swrenderer
|
||||||
visplane_t *FindPlane(const secplane_t &height, FTextureID picnum, int lightlevel, double Alpha, bool additive, const FTransform &xxform, int sky, FSectorPortal *portal, FDynamicColormap *basecolormap);
|
visplane_t *FindPlane(const secplane_t &height, FTextureID picnum, int lightlevel, double Alpha, bool additive, const FTransform &xxform, int sky, FSectorPortal *portal, FDynamicColormap *basecolormap);
|
||||||
visplane_t *GetRange(visplane_t *pl, int start, int stop);
|
visplane_t *GetRange(visplane_t *pl, int start, int stop);
|
||||||
|
|
||||||
|
bool HasPortalPlanes() const;
|
||||||
|
visplane_t *PopFirstPortalPlane();
|
||||||
|
void ClearPortalPlanes();
|
||||||
|
|
||||||
int Render();
|
int Render();
|
||||||
void RenderHeight(double height);
|
void RenderHeight(double height);
|
||||||
|
|
||||||
enum { MAXVISPLANES = 128 }; // must be a power of 2
|
|
||||||
visplane_t *visplanes[MAXVISPLANES + 1];
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VisiblePlaneList();
|
VisiblePlaneList();
|
||||||
visplane_t *Add(unsigned hash);
|
visplane_t *Add(unsigned hash);
|
||||||
|
|
||||||
|
enum { MAXVISPLANES = 128 }; // must be a power of 2
|
||||||
|
visplane_t *visplanes[MAXVISPLANES + 1];
|
||||||
|
|
||||||
static unsigned CalcHash(int picnum, int lightlevel, const secplane_t &height) { return (unsigned)((picnum) * 3 + (lightlevel)+(FLOAT2FIXED((height).fD())) * 7) & (MAXVISPLANES - 1); }
|
static unsigned CalcHash(int picnum, int lightlevel, const secplane_t &height) { return (unsigned)((picnum) * 3 + (lightlevel)+(FLOAT2FIXED((height).fD())) * 7) & (MAXVISPLANES - 1); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace swrenderer
|
||||||
|
|
||||||
VisiblePlaneList *planes = VisiblePlaneList::Instance();
|
VisiblePlaneList *planes = VisiblePlaneList::Instance();
|
||||||
|
|
||||||
if (planes->visplanes[VisiblePlaneList::MAXVISPLANES] == nullptr)
|
if (!planes->HasPortalPlanes())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Clip3DFloors::Instance()->EnterSkybox();
|
Clip3DFloors::Instance()->EnterSkybox();
|
||||||
|
@ -109,17 +109,8 @@ namespace swrenderer
|
||||||
AActor *savedcamera = camera;
|
AActor *savedcamera = camera;
|
||||||
sector_t *savedsector = viewsector;
|
sector_t *savedsector = viewsector;
|
||||||
|
|
||||||
int i;
|
for (visplane_t *pl = planes->PopFirstPortalPlane(); pl != nullptr; pl = planes->PopFirstPortalPlane())
|
||||||
visplane_t *pl;
|
|
||||||
|
|
||||||
for (pl = planes->visplanes[VisiblePlaneList::MAXVISPLANES]; pl != nullptr; pl = planes->visplanes[VisiblePlaneList::MAXVISPLANES])
|
|
||||||
{
|
{
|
||||||
// Pop the visplane off the list now so that if this skybox adds more
|
|
||||||
// skyboxes to the list, they will be drawn instead of skipped (because
|
|
||||||
// new skyboxes go to the beginning of the list instead of the end).
|
|
||||||
planes->visplanes[VisiblePlaneList::MAXVISPLANES] = pl->next;
|
|
||||||
pl->next = nullptr;
|
|
||||||
|
|
||||||
if (pl->right < pl->left || !r_skyboxes || numskyboxes == MAX_SKYBOX_PLANES || pl->portal == nullptr)
|
if (pl->right < pl->left || !r_skyboxes || numskyboxes == MAX_SKYBOX_PLANES || pl->portal == nullptr)
|
||||||
{
|
{
|
||||||
pl->Render(OPAQUE, false, false);
|
pl->Render(OPAQUE, false, false);
|
||||||
|
@ -181,7 +172,7 @@ namespace swrenderer
|
||||||
|
|
||||||
auto ceilingclip = RenderOpaquePass::Instance()->ceilingclip;
|
auto ceilingclip = RenderOpaquePass::Instance()->ceilingclip;
|
||||||
auto floorclip = RenderOpaquePass::Instance()->floorclip;
|
auto floorclip = RenderOpaquePass::Instance()->floorclip;
|
||||||
for (i = pl->left; i < pl->right; i++)
|
for (int i = pl->left; i < pl->right; i++)
|
||||||
{
|
{
|
||||||
if (pl->top[i] == 0x7fff)
|
if (pl->top[i] == 0x7fff)
|
||||||
{
|
{
|
||||||
|
@ -253,6 +244,7 @@ namespace swrenderer
|
||||||
|
|
||||||
VisibleSpriteList::Instance()->PopPortal();
|
VisibleSpriteList::Instance()->PopPortal();
|
||||||
|
|
||||||
|
visplane_t *pl;
|
||||||
visplaneStack.Pop(pl);
|
visplaneStack.Pop(pl);
|
||||||
if (pl->Alpha > 0 && pl->picnum != skyflatnum)
|
if (pl->Alpha > 0 && pl->picnum != skyflatnum)
|
||||||
{
|
{
|
||||||
|
@ -277,7 +269,7 @@ namespace swrenderer
|
||||||
|
|
||||||
if (Clip3DFloors::Instance()->fakeActive) return;
|
if (Clip3DFloors::Instance()->fakeActive) return;
|
||||||
|
|
||||||
planes->visplanes[VisiblePlaneList::MAXVISPLANES] = nullptr;
|
planes->ClearPortalPlanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPortal::RenderLinePortals()
|
void RenderPortal::RenderLinePortals()
|
||||||
|
|
Loading…
Reference in a new issue