Add gl_meshcache cvar for toggling it on and off
This commit is contained in:
parent
a5a0279fd2
commit
2d335d0f97
2 changed files with 28 additions and 12 deletions
|
|
@ -63,6 +63,8 @@ CVAR(Float, gl_mask_sprite_threshold, 0.5f, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
|
||||
CVAR(Bool, gl_coronas, true, CVAR_ARCHIVE);
|
||||
|
||||
CVAR(Bool, gl_meshcache, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool back);
|
||||
|
||||
//==========================================================================
|
||||
|
|
@ -451,7 +453,8 @@ void HWDrawInfo::CreateScene(bool drawpsprites)
|
|||
screen->mLights->Map();
|
||||
screen->mBones->Map();
|
||||
|
||||
//RenderBSP(Level->HeadNode(), drawpsprites);
|
||||
if (!gl_meshcache)
|
||||
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
|
||||
|
|
@ -508,10 +511,13 @@ 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 (gl_meshcache)
|
||||
{
|
||||
if (cachedsector.Opaque)
|
||||
cachedsector.Opaque->Draw(state);
|
||||
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
|
||||
|
|
@ -519,10 +525,13 @@ void HWDrawInfo::RenderScene(FRenderState &state)
|
|||
drawlists[GLDL_MASKEDWALLS].DrawWalls(this, state, false);
|
||||
drawlists[GLDL_MASKEDFLATS].DrawFlats(this, state, false);
|
||||
|
||||
for (HWCachedSector& cachedsector : meshcache.Sectors)
|
||||
if (gl_meshcache)
|
||||
{
|
||||
if (cachedsector.Translucent)
|
||||
cachedsector.Translucent->Draw(state);
|
||||
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.
|
||||
|
|
@ -533,13 +542,16 @@ void HWDrawInfo::RenderScene(FRenderState &state)
|
|||
state.ClearDepthBias();
|
||||
}
|
||||
|
||||
state.SetDepthBias(-1, -128);
|
||||
for (HWCachedSector& cachedsector : meshcache.Sectors)
|
||||
if (gl_meshcache)
|
||||
{
|
||||
if (cachedsector.TranslucentDepthBiased)
|
||||
cachedsector.TranslucentDepthBiased->Draw(state);
|
||||
state.SetDepthBias(-1, -128);
|
||||
for (HWCachedSector& cachedsector : meshcache.Sectors)
|
||||
{
|
||||
if (cachedsector.TranslucentDepthBiased)
|
||||
cachedsector.TranslucentDepthBiased->Draw(state);
|
||||
}
|
||||
state.ClearDepthBias();
|
||||
}
|
||||
state.ClearDepthBias();
|
||||
|
||||
drawlists[GLDL_MODELS].Draw(this, state, false);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
EXTERN_CVAR(Bool, gl_texture)
|
||||
EXTERN_CVAR(Float, gl_mask_threshold)
|
||||
EXTERN_CVAR(Bool, gl_meshcache)
|
||||
|
||||
HWMeshCache meshcache;
|
||||
|
||||
|
|
@ -21,6 +22,9 @@ void HWMeshCache::Clear()
|
|||
|
||||
void HWMeshCache::Update(FRenderViewpoint& vp)
|
||||
{
|
||||
if (!gl_meshcache)
|
||||
return;
|
||||
|
||||
auto level = vp.ViewLevel;
|
||||
unsigned int count = level->sectors.Size();
|
||||
Sectors.Resize(count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue