Lighting-related cleanup; make r_dynamicLight non-latch#1341
Lighting-related cleanup; make r_dynamicLight non-latch#1341slipher merged 9 commits intoDaemonEngine:masterfrom
Conversation
slipher
commented
Oct 5, 2024
- Remove unused and unneeded lighting code
- Gate some tiled renderer-specific code behind the tiled cvar
- Make r_dynamicLight non-latch, to quickly toggle dynamic lights
|
(moved from review since this would require targeting for-0.55) This: Daemon/src/engine/renderer/tr_backend.cpp Line 2696 in 14e7fb0 |
0fee59e to
7d1d420
Compare
|
I'm not planning to nuke vis tests. What's being deleted here is
|
|
I see, thanks for the explanation. |
visBounds is used only to choose zFar. A comment says that expanding the vis bounds was needed for occlusion queries (which were NUKED in 2014). I looked at the nuking commit ffd1714 and it seems that the occlusion code involved GL draw calls to "draw" the boundaries of the light and check whether anything would show up. So it's plausible that the expanded zFar would be needed for that stuff. But it shouldn't be needed now.
|
Regrettably, I have added more stuff to the PR:
|
| @@ -1622,34 +1568,6 @@ void R_ComputeFinalAttenuation( shaderStage_t *pStage, trRefLight_t *light ) | |||
| ================= | |||
| R_CullLightTriangle | |||
There was a problem hiding this comment.
It wasn't me. The banner comment for R_CullLightWorldBounds already says "R_CullLightTriangle"
|
The default diff algorithm generates garbage for the static light nuking commit in tr_bsp.cpp. Reviewers may wish to view commits locally with a better algorithm, for example: |
A "static light" was a type of realtime light. It was instantiated by a BSP entity with classname "light", which must have the "noradiosity" keyword set in order to be rendered. Judging by https://users.unvanquished.net/~slipher/map-entity-directory.txt there are no Tremulous or Unvanquished maps using this. 90% of the code for this feature was optimizations specific to the deprecated forward renderer. (Optimizations in the sense that the code is intended to be faster than the dynamic light code path.) If we ever wanted to test real-time lights from map entities later, it could be done by just adding a dynamic light based on the BSP entity. The entity parser would be the only part that's needed. Closes DaemonEngine#1051.
We do use GL_ARB_occlusion_query functionality, but the cvar is not actually consulted before doing it.
If a dynamic light is disabled, just don't add it to the scene. No need to check again later if it is disabled
Giving the cvar for whether to add dynamic lights at runtime a different name from r_realtimeLighting's old name will help it to avoid getting mistakenly set by old autogen.cfg values. The name name follows the convention that r_drawXXX cvars that can be used to disable something that is usually rendered. (showXXX cvars on the other hand are cheat cvars for drawing a representation of something that is usually unseen.) Remove Cvar::Latch so it can be toggled instantly.
| r_realtimeLightingRenderer.Get() != Util::ordinal( realtimeLightingRenderer_t::TILED ) ) | ||
| { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Totally nitpicking but I prefer that syntax:
if ( !glConfig2.realtimeLighting )
{
return;
}
if ( r_realtimeLightingRenderer.Get() != Util::ordinal( realtimeLightingRenderer_t::TILED ) )
{
return;
}This is the pattern we usually implement (and I usually write new code or modify code this way), for example:
Daemon/src/engine/renderer/tr_scene.cpp
Lines 288 to 301 in 926d8f6
There was a problem hiding this comment.
I see it as one condition. "Is the tiled renderer active"