Hopson97 / MineCraft-One-Week-Challenge

I challenged myself to see if I could create a voxel game (Minecraft-like) in just one week using C++ and OpenGL, and here is the result
https://www.youtube.com/watch?v=Xq3isov6mZ8
MIT License
2.65k stars 379 forks source link

Fixed block coord bug. #132

Open lhinuz opened 5 years ago

lhinuz commented 5 years ago

Fixed block coord bug.

DreamHollow commented 1 year ago

Not sure if this commit actually does anything, just seems to add unnecessary extra math.

Hopson97 commented 1 year ago

Yeah, I might see if I can test this to see if there is a difference; not sure what this actually is fixing without additional context

janvanbouwel commented 1 year ago

The % operator is a division remainder and negative numbers stay negative. With the fix they'll be positive so it'll be an actual modulo. A stack overflow answer about it

Double modulo may not be the best idea if that code should be very optimised though.