Conversation
by flooring it would break reading in deswizzled files from maps that were offset. bdifirit1 is offset by (0 px, 8 px) so we'd do the division and divide and floor causing it all to be off by 8 px.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where flooring the source position during tile
lookup caused misalignment when reading deswizzled files that include
pixel offsets.
For example, bdifirit1 is offset by (0 px, 8 px).
Because the code previously divided and then floored the source
position:
const glm::vec2 aligned_source = glm::floor(source_position / tile_size);...the resulting tile index was shifted by 8 px, breaking map rendering
for any textures with non-zero offsets.
✔️ Fix
The flooring step has been removed to preserve accurate tile
coordinates:
const glm::vec2 base_source = source_position / tile_size;This ensures maps with offsets are read correctly.
🔗 Related Issue
Fixes: #227