Test drawing all cached sectors every frame

This commit is contained in:
Magnus Norddahl 2022-12-28 18:49:03 +01:00
commit b189a63e6b

View file

@ -44,6 +44,7 @@
#include "hw_bonebuffer.h"
#include "hw_vrmodes.h"
#include "hw_clipper.h"
#include "hw_meshcache.h"
#include "v_draw.h"
#include "a_corona.h"
#include "texturemanager.h"
@ -450,7 +451,7 @@ void HWDrawInfo::CreateScene(bool drawpsprites)
screen->mLights->Map();
screen->mBones->Map();
RenderBSP(Level->HeadNode(), drawpsprites);
//RenderBSP(Level->HeadNode(), drawpsprites);
// And now the crappy hacks that have to be done to avoid rendering anomalies.
// These cannot be multithreaded when the time comes because all these depend
@ -507,12 +508,23 @@ void HWDrawInfo::RenderScene(FRenderState &state)
drawlists[GLDL_PLAINWALLS].DrawWalls(this, state, false);
drawlists[GLDL_PLAINFLATS].DrawFlats(this, state, false);
for (HWCachedSector& cachedsector : meshcache.Sectors)
{
if (cachedsector.Opaque)
cachedsector.Opaque->Draw(state);
}
// Part 2: masked geometry. This is set up so that only pixels with alpha>gl_mask_threshold will show
state.AlphaFunc(Alpha_GEqual, gl_mask_threshold);
drawlists[GLDL_MASKEDWALLS].DrawWalls(this, state, false);
drawlists[GLDL_MASKEDFLATS].DrawFlats(this, state, false);
for (HWCachedSector& cachedsector : meshcache.Sectors)
{
if (cachedsector.Translucent)
cachedsector.Translucent->Draw(state);
}
// Part 3: masked geometry with polygon offset. This list is empty most of the time so only waste time on it when in use.
if (drawlists[GLDL_MASKEDWALLSOFS].Size() > 0)
{
@ -521,6 +533,14 @@ void HWDrawInfo::RenderScene(FRenderState &state)
state.ClearDepthBias();
}
state.SetDepthBias(-1, -128);
for (HWCachedSector& cachedsector : meshcache.Sectors)
{
if (cachedsector.TranslucentDepthBiased)
cachedsector.TranslucentDepthBiased->Draw(state);
}
state.ClearDepthBias();
drawlists[GLDL_MODELS].Draw(this, state, false);
state.SetRenderStyle(STYLE_Translucent);