Deleted unused variable in R_RegenAllLightmaps()

Static arrays there have their dimensions swapped, they make more sense now.
Added important detail in gl1_lightmapcopies doc.
Also added doc for gl_polyblend, just because of its "popularity".
This commit is contained in:
Jaime Moreira 2024-07-28 12:14:17 -04:00
parent b72c465214
commit 26f578212a
2 changed files with 24 additions and 18 deletions

View file

@ -458,6 +458,10 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
the overlapping surfaces to mitigate the flickering. This may make the overlapping surfaces to mitigate the flickering. This may make
things better or worse, depending on the map. things better or worse, depending on the map.
* **gl_polyblend**: Toggles the palette blending effect, a.k.a. the
"flash" you see when getting injured or picking up an item. In GL1 is
also used for looking underwater. Default is `1` (enabled).
* **gl_texturemode**: How textures are filtered. * **gl_texturemode**: How textures are filtered.
- `GL_NEAREST`: No filtering (using value of *nearest* source pixel), - `GL_NEAREST`: No filtering (using value of *nearest* source pixel),
mipmaps not used mipmaps not used
@ -492,11 +496,11 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
* **gl1_stencilshadow**: If `gl_shadows` is set to `1`, this makes them * **gl1_stencilshadow**: If `gl_shadows` is set to `1`, this makes them
look a bit better (no flickering) by using the stencil buffer. look a bit better (no flickering) by using the stencil buffer.
* **gl1_lightmapcopies**: When enabled (`1`), keep multiple copies of the * **gl1_lightmapcopies**: When enabled (`1`), keep 3 copies of the same
same lightmap rotating, shifting to a different one when drawing a new lightmap rotating, shifting to another one when drawing a new frame.
frame. Meant for mobile/embedded devices, where changing textures just Meant for mobile/embedded devices, where changing textures just shown
displayed (dynamic lighting) causes slowdown. By default in GL1 is (dynamic lighting) causes slowdown. By default in GL1 is disabled,
disabled, while in GLES1 is enabled. `vid_restart` needed. while in GLES1 is enabled. Needs `gl1_multitexture 1` & `vid_restart`.
* **gl1_discardfb**: Only available in ES1. If set to `1` (default), * **gl1_discardfb**: Only available in ES1. If set to `1` (default),
send a hint to discard framebuffers after finishing a frame. Useful send a hint to discard framebuffers after finishing a frame. Useful

View file

@ -585,10 +585,10 @@ R_JoinAreas(lmrect_t *adding, lmrect_t *obj)
static void static void
R_RegenAllLightmaps() R_RegenAllLightmaps()
{ {
static lmrect_t lmchange[MAX_LIGHTMAP_COPIES][MAX_LIGHTMAPS]; static lmrect_t lmchange[MAX_LIGHTMAPS][MAX_LIGHTMAP_COPIES];
static qboolean altered[MAX_LIGHTMAP_COPIES][MAX_LIGHTMAPS]; static qboolean altered[MAX_LIGHTMAPS][MAX_LIGHTMAP_COPIES];
int i, map, smax, tmax, cc, lmtex; int i, map, smax, tmax, lmtex;
lmrect_t current, best; lmrect_t current, best;
msurface_t *surf; msurface_t *surf;
byte *base; byte *base;
@ -602,12 +602,14 @@ R_RegenAllLightmaps()
return; return;
} }
cc = lmtex = 0;
if (gl_config.lightmapcopies) if (gl_config.lightmapcopies)
{ {
cur_lm_copy = (cur_lm_copy + 1) % MAX_LIGHTMAP_COPIES; // alternate between calls cur_lm_copy = (cur_lm_copy + 1) % MAX_LIGHTMAP_COPIES; // select the next lightmap copy
cc = cur_lm_copy; lmtex = gl_state.max_lightmaps * cur_lm_copy; // ...and its corresponding texture
lmtex = gl_state.max_lightmaps * cc; }
else
{
lmtex = 0;
} }
for (i = 1; i < gl_state.max_lightmaps; i++) for (i = 1; i < gl_state.max_lightmaps; i++)
@ -680,24 +682,24 @@ dynamic_surf:
if (gl_config.lightmapcopies) if (gl_config.lightmapcopies)
{ {
// add all the changes that have happened in the last few frames, // Add all the changes that have happened in the last few frames,
// at least just for consistency between them... // at least just for consistency between them.
qboolean apply_changes = affected_lightmap; qboolean apply_changes = affected_lightmap;
current = best; // save state for next frames... + current = best; // save state for next frames... +
for (int k = 0; k < MAX_LIGHTMAP_COPIES; k++) for (int k = 0; k < MAX_LIGHTMAP_COPIES; k++)
{ {
if (altered[k][i]) if (altered[i][k])
{ {
apply_changes = true; apply_changes = true;
R_JoinAreas(&lmchange[k][i], &best); R_JoinAreas(&lmchange[i][k], &best);
} }
} }
altered[cc][i] = affected_lightmap; altered[i][cur_lm_copy] = affected_lightmap;
if (affected_lightmap) if (affected_lightmap)
{ {
lmchange[cc][i] = current; // + ...here lmchange[i][cur_lm_copy] = current; // + ...here
} }
if (!apply_changes) if (!apply_changes)