-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
floor rendering fix #48
base: master
Are you sure you want to change the base?
Conversation
|
||
while (count--) { | ||
/* extract the x/y coordinates */ | ||
coord = ((frac >> (32-7)) | ((frac >> (32-23)) << 7)) & 16383; | ||
coord = ((yfrac >> 24) & 0b00000001111111) | (( xfrac >> 17) & 0b11111110000000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Binary constants are not standard C, but it makes the code easier to understand. I can change this if needed.
In hindsight, I should have made the comparison images on a level with straight lines in the floor texture. Thanks for vouching for the PR. Planning on doing anything else in ROTT? |
I don't have much in mind right now, but maybe I'll contribute QOL improvements in the future 🙂 |
The original code has insufficient precision in the xstep and ystep used for floor/ceiling. This lack of precision results in very visible error accumulating as DrawRow renders left to right. Look at the distortion on the right side in the original.
![floorDistorted](https://user-images.githubusercontent.com/18518874/114317129-406fb280-9acc-11eb-9a7c-a20178429fd6.png)
![floorFixed](https://user-images.githubusercontent.com/18518874/114317138-4c5b7480-9acc-11eb-81da-332ead7883bf.png)
Original
Improved
Credit to a 2019 Kaiser tweet for pointing out the problem.
It would be nice if #42 went in ahead of this. I did a hackier work around the same mingw-w64 problem for w_wad.c.