Holey textures (textures with transparent pixels) cannot
be used on upper/lower textures or on 1-sided linedefs. If
the game tries to render this, the texture name will
appear on the HUD if devmode render is turned on.
How lightlists work:
- Each FOF casts a shadow beneath it.
- Draw the column above each FOF with colormap set from
the previous FOF.
- Then set colormap from the current FOF, so the next FOF
is bathed in the current FOF's shadow.
What broke:
- Colormap was not set when drawing the column above the
first FOF.
This commit:
- Before iterating lightlists, set colormap to base sector
lighting.
- De-duplicate some code by using lambdas.
- Holey textures are ones where the column height may not
match the texture height.
- R_DrawColumn cannot cope with this directly and it may
lead to a read out bounds.
- Transparency would not render for true wall textures
anyway since these are not masked midtextures, so just
don't render the texture in this case.
FixesKartKrew/Kart#844 which is caused by scaling the texheight by a
spryscale that is too large, triggering arithmetic overflow before the
overflow check even occurs. This is a performance hit, but should not be
very intense with release optimizations.
Instead, we use saturating arithmetic using the same integer promotion
technique as before, but checking in both directions, and also checking
for the multiplication before the addition.
There is an optimization opportunity here and anywhere that overflow
checks are used, by using compiler intrinsics which check the overflow
flag bit on the CPU instead of using integer promotion.
Two reasons:
- Makes it more straight-forward to add brightmaps to the non-power-of-two rendering functions.
- Made it easier to split off brightmap rendering. Hopefully improves performance, but I haven't thoroughly tested this.
- Software* + OpenGL support
- *Not supported: R_DrawColumnShadowed_8
- This has something to do with walls and FOF lights.
However, I don't see an easy code solution and I don't
know how to even test this.
- Ensures that column drawer doesn't read out of bounds
the brightmap column.
- Refactored code in r_segs.cpp, so it checks
R_TextureHasBrightmap.
- Added comments for plane brightmaps and sprite
brightmaps, that these are still error-prone.