Visible surfaces are gathered in processing (gathering) render phase and lightmaps drawn before rendering
This commit is contained in:
parent
139ce34535
commit
d96d1aeffc
4 changed files with 61 additions and 59 deletions
|
|
@ -52,6 +52,7 @@ CVAR(Bool, gl_multithread, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
|
||||
EXTERN_CVAR(Float, r_actorspriteshadowdist)
|
||||
EXTERN_CVAR(Bool, gl_meshcache)
|
||||
EXTERN_CVAR(Int, lm_background_updates);
|
||||
|
||||
thread_local bool isWorkerThread;
|
||||
ctpl::thread_pool renderPool(1);
|
||||
|
|
@ -856,8 +857,37 @@ void HWDrawInfo::RenderBSPNode (void *node, FRenderState& state)
|
|||
DoSubsector ((subsector_t *)((uint8_t *)node - 1), state);
|
||||
}
|
||||
|
||||
void UpdateLightmaps(DFrameBuffer* screen, FRenderState& RenderState)
|
||||
{
|
||||
// Lightmapping stuff
|
||||
auto& list = RenderState.GetVisibleSurfaceList();
|
||||
auto size = RenderState.GetVisibleSurfaceListCount();
|
||||
|
||||
list.Resize(min(list.Size(), unsigned(size)));
|
||||
|
||||
if (size < lm_background_updates)
|
||||
{
|
||||
int index = 0;
|
||||
for (auto& e : level.levelMesh->Surfaces)
|
||||
{
|
||||
if (e.needsUpdate)
|
||||
{
|
||||
list.Push(index);
|
||||
|
||||
if (list.Size() >= lm_background_updates)
|
||||
break;
|
||||
}
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
screen->UpdateLightmaps(list);
|
||||
}
|
||||
|
||||
void HWDrawInfo::RenderBSP(void *node, bool drawpsprites, FRenderState& state)
|
||||
{
|
||||
state.ClearVisibleSurfaceList();
|
||||
|
||||
Bsp.Clock();
|
||||
|
||||
// Give the DrawInfo the viewpoint in fixed point because that's what the nodes are.
|
||||
|
|
@ -892,4 +922,6 @@ void HWDrawInfo::RenderBSP(void *node, bool drawpsprites, FRenderState& state)
|
|||
|
||||
if (drawpsprites)
|
||||
PreparePlayerSprites(Viewpoint.sector, in_area, state);
|
||||
|
||||
UpdateLightmaps(screen, state);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue