Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Use BTreeMap for deterministic MeshKey iteration to prevent z-fighting #80

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

setzer22
Copy link
Collaborator

The render queues are currently stored in a HashMap that is discarded and re-created each frame.

This is problematic, because each time the hashmap is created, it randomizes iteration order. And then, when two overlapping sprites are rendered with the same z-index, you get z-fighting.

I think the easiest way to solve this is to simply swap the HashMaps with BTreeMap, but feel free to implement something else if you have a better idea 👍

@setzer22 setzer22 force-pushed the make_mesh_queue_use_btreemap branch from 6e117b0 to 4dda34e Compare December 16, 2023 18:08
@darthdeus darthdeus merged commit f2243fc into darthdeus:master Dec 16, 2023
6 of 7 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants