Straight view volume box fix - #5121
Conversation
|
Rather than accepting it, why did you choose 15 specifically, what you're doing there is changing the depth offset to stop occlusion in the bucket, honestly, I would prefer it if you made a reasonable review on what in the bucket occludes this. Note : I've removed this entirely in the new renderer |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the straight/front view volume box rendering so the highlight/volume box outline appears consistent across resolutions, addressing the visual artifacts reported in #5097 and #5120.
Changes:
- Tweaks the Z-offset used when drawing both the normal and “fancy” frontview map volume boxes.
- Aligns the two frontview volume-box rendering paths to use the same updated offset.
Suppressed comments (1)
src/engine_render.c:8567
- The rounding adjustment in
y_start/y_endandx_start/x_enduses((a % b) >= b)which can never be true for non-negative values, so the ternary is dead code. This is misleading and makes it harder to reason about the pixel-to-slab mapping (especially when debugging resolution-specific artifacts).
coord_z -= (15 * (long)stl_width) >> 2;
for (int roomspace_y = 0; roomspace_y < room_slab_height; roomspace_y += 1)
{
int y_start = (box_height * roomspace_y / room_slab_height) + ((((box_height * roomspace_y) % room_slab_height) >= room_slab_height) ? 1 : 0);
int y_end = (box_height * (roomspace_y + 1) / room_slab_height) + ((((box_height * (roomspace_y + 1)) % room_slab_height) >= room_slab_height) ? 1 : 0);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| break; | ||
| } | ||
| coord_z -= (11 * (long)stl_width) >> 2; | ||
| coord_z -= (15 * (long)stl_width) >> 2; |
I've no idea; I just tried it arbitrarily and it seemed to work, so I went with it. My previous fix only fixed the top line. |
What do you mean? |



Fixes #5097
Fixes #5120
Tested at 320x200, 640x480, 1280x800, and 1920x1080 resolutions.