mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
Add gl_meshcache cvar for toggling it on and off
This commit is contained in:
parent
9365af7bfe
commit
1a64adf2be
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_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);
|
sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool back);
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -452,7 +454,8 @@ void HWDrawInfo::CreateScene(bool drawpsprites)
|
||||||
screen->mLights->Map();
|
screen->mLights->Map();
|
||||||
screen->mBones->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.
|
// 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
|
// These cannot be multithreaded when the time comes because all these depend
|
||||||
|
@ -509,10 +512,13 @@ void HWDrawInfo::RenderScene(FRenderState &state)
|
||||||
drawlists[GLDL_PLAINWALLS].DrawWalls(this, state, false);
|
drawlists[GLDL_PLAINWALLS].DrawWalls(this, state, false);
|
||||||
drawlists[GLDL_PLAINFLATS].DrawFlats(this, state, false);
|
drawlists[GLDL_PLAINFLATS].DrawFlats(this, state, false);
|
||||||
|
|
||||||
for (HWCachedSector& cachedsector : meshcache.Sectors)
|
if (gl_meshcache)
|
||||||
{
|
{
|
||||||
if (cachedsector.Opaque)
|
for (HWCachedSector& cachedsector : meshcache.Sectors)
|
||||||
cachedsector.Opaque->Draw(state);
|
{
|
||||||
|
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
|
// Part 2: masked geometry. This is set up so that only pixels with alpha>gl_mask_threshold will show
|
||||||
|
@ -520,10 +526,13 @@ void HWDrawInfo::RenderScene(FRenderState &state)
|
||||||
drawlists[GLDL_MASKEDWALLS].DrawWalls(this, state, false);
|
drawlists[GLDL_MASKEDWALLS].DrawWalls(this, state, false);
|
||||||
drawlists[GLDL_MASKEDFLATS].DrawFlats(this, state, false);
|
drawlists[GLDL_MASKEDFLATS].DrawFlats(this, state, false);
|
||||||
|
|
||||||
for (HWCachedSector& cachedsector : meshcache.Sectors)
|
if (gl_meshcache)
|
||||||
{
|
{
|
||||||
if (cachedsector.Translucent)
|
for (HWCachedSector& cachedsector : meshcache.Sectors)
|
||||||
cachedsector.Translucent->Draw(state);
|
{
|
||||||
|
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.
|
// Part 3: masked geometry with polygon offset. This list is empty most of the time so only waste time on it when in use.
|
||||||
|
@ -534,13 +543,16 @@ void HWDrawInfo::RenderScene(FRenderState &state)
|
||||||
state.ClearDepthBias();
|
state.ClearDepthBias();
|
||||||
}
|
}
|
||||||
|
|
||||||
state.SetDepthBias(-1, -128);
|
if (gl_meshcache)
|
||||||
for (HWCachedSector& cachedsector : meshcache.Sectors)
|
|
||||||
{
|
{
|
||||||
if (cachedsector.TranslucentDepthBiased)
|
state.SetDepthBias(-1, -128);
|
||||||
cachedsector.TranslucentDepthBiased->Draw(state);
|
for (HWCachedSector& cachedsector : meshcache.Sectors)
|
||||||
|
{
|
||||||
|
if (cachedsector.TranslucentDepthBiased)
|
||||||
|
cachedsector.TranslucentDepthBiased->Draw(state);
|
||||||
|
}
|
||||||
|
state.ClearDepthBias();
|
||||||
}
|
}
|
||||||
state.ClearDepthBias();
|
|
||||||
|
|
||||||
drawlists[GLDL_MODELS].Draw(this, state, false);
|
drawlists[GLDL_MODELS].Draw(this, state, false);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, gl_texture)
|
EXTERN_CVAR(Bool, gl_texture)
|
||||||
EXTERN_CVAR(Float, gl_mask_threshold)
|
EXTERN_CVAR(Float, gl_mask_threshold)
|
||||||
|
EXTERN_CVAR(Bool, gl_meshcache)
|
||||||
|
|
||||||
HWMeshCache meshcache;
|
HWMeshCache meshcache;
|
||||||
|
|
||||||
|
@ -21,6 +22,9 @@ void HWMeshCache::Clear()
|
||||||
|
|
||||||
void HWMeshCache::Update(FRenderViewpoint& vp)
|
void HWMeshCache::Update(FRenderViewpoint& vp)
|
||||||
{
|
{
|
||||||
|
if (!gl_meshcache)
|
||||||
|
return;
|
||||||
|
|
||||||
auto level = vp.ViewLevel;
|
auto level = vp.ViewLevel;
|
||||||
unsigned int count = level->sectors.Size();
|
unsigned int count = level->sectors.Size();
|
||||||
Sectors.Resize(count);
|
Sectors.Resize(count);
|
||||||
|
|
Loading…
Reference in a new issue