Skip to content

fix: correct isometric tileset rendering - #9889

Open
dxcvvxd wants to merge 5 commits into
cataclysmbn:mainfrom
dxcvvxd:iso-rendering-fix
Open

fix: correct isometric tileset rendering#9889
dxcvvxd wants to merge 5 commits into
cataclysmbn:mainfrom
dxcvvxd:iso-rendering-fix

Conversation

@dxcvvxd

@dxcvvxd dxcvvxd commented Jul 17, 2026

Copy link
Copy Markdown

Purpose of change

Fixes broken isometric tileset rendering (black voids between tiles, flat z-level stacking) caused by debug-zeroing of tileset JSON values and wrong iso tile count / screen-row calculations.

Describe the solution

  1. Remove 3 debug-zeroing lines in tileset_loader::load()ts.zlevel_height, ts.prevent_occlusion_min_dist, ts.prevent_occlusion_max_dist were set to 0/-1 after being read from JSON, rendering z-level and occlusion features non-functional.
  2. Fix iso screentile_width/height — iso mode needs ceil(width*2/tw)+1 / ceil(height*4/tw)+1 instead of ortho formula. Without this, not enough tiles are queued for rendering → black voids.
  3. Add per-z-level screen_row offset for iso — apply (center.z - tile.z) * zlevel_height * 4 / tile_width to screen_row so z-levels stack vertically instead of rendering flat.
  4. Fix get_window_tile_counts() iso formula — same scaling fix as Coolthulhu fix null tool #2, controls minimap and offscreen area tile counts.

Testing

  • Loaded iso tileset with each fix individually to isolate the effect.
  • Verified non-iso tilesets are not affected (ortho code paths unchanged).
  • Build clean.

Checklist

  • This PR used AI assistance.
    • I added an Assisted-by: trailer to every AI-assisted commit.
  • This is a C++ PR that modifies JSON loading or behavior.

Build Artifacts

PR build for commit 61910fc (style(autofix.ci): automated formatting) on 2026-07-20 17:15:53

@dxcvvxd
dxcvvxd force-pushed the iso-rendering-fix branch from 02657ac to 83257e0 Compare July 17, 2026 16:19
@github-actions github-actions Bot added the src changes related to source code. label Jul 17, 2026
…screentile count and z-level ordering for iso

Assisted-by: OpenCode <https://opencode.ai>
@dxcvvxd
dxcvvxd force-pushed the iso-rendering-fix branch from 83257e0 to e1caf2a Compare July 17, 2026 16:22
@autofix-ci

autofix-ci Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Autofix has formatted code style violation in this PR.

I edit commits locally (e.g: git, github desktop) and want to keep autofix
  1. Run git pull. this will merge the automated commit into your local copy of the PR branch.
  2. Continue working.
I do not want the automated commit
  1. Format your code locally, then commit it.
  2. Run git push --force to force push your branch. This will overwrite the automated commit on remote with your local one.
  3. Continue working.

If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT.

@dxcvvxd
dxcvvxd force-pushed the iso-rendering-fix branch 5 times, most recently from 0998df0 to 099c2f8 Compare July 17, 2026 16:59
@dxcvvxd
dxcvvxd force-pushed the iso-rendering-fix branch from aebe3f6 to f4c364f Compare July 17, 2026 17:19
@scarf005 scarf005 changed the title fix: correct isometric tileset rendering — unzero zlevel_height, fix screentile count and z-level ordering for iso fix: correct isometric tileset rendering Jul 17, 2026
match display buffer pixel format to atlas/global sdl_color_pixel_format
set display buffer blend mode to NONE (no alpha during compositing)
@dxcvvxd
dxcvvxd force-pushed the iso-rendering-fix branch from a654b2d to 358237e Compare July 19, 2026 19:41
@dxcvvxd
dxcvvxd force-pushed the iso-rendering-fix branch from 60ef4c8 to 27658f3 Compare July 20, 2026 16:29

@scarf005 scarf005 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. remove all the fprintfs
  2. please add screenshots of isometric tileset working correctly to PR body

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

src changes related to source code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants