-
Notifications
You must be signed in to change notification settings - Fork 69
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
Fixed definition inconsistencies and rotation matrix generation. Technically a breaking change! #779
Conversation
🤔 I wonder how much this messes up the flight example (biggest user of |
Looks like the flight example just creates the rotation matrices for one-time use, which can be replaced by |
That's a good point, that would still result in rotating the other way though. Anyway, I tried it and the trees end up rotating the other way to the ground... which this fixes: diff --git a/32blit/graphics/mode7.cpp b/32blit/graphics/mode7.cpp
index ea9fe25e..7bf84dc3 100644
--- a/32blit/graphics/mode7.cpp
+++ b/32blit/graphics/mode7.cpp
@@ -75,13 +75,13 @@ namespace blit {
forward *= Mat3::rotation(angle);
Vec2 left = forward;
- left *= Mat3::rotation((fov / 2.0f));
+ left *= Mat3::rotation(-(fov / 2.0f));
Vec2 right = forward;
- right *= Mat3::rotation(-(fov / 2.0f));
+ right *= Mat3::rotation((fov / 2.0f));
float distance = ((far - near) / float(s.y - viewport.y)) + near;
-
+
Vec2 swc = pos + (left * distance);
Vec2 ewc = pos + (right * distance);
(Yeah, still not using Then it's just a matter of the left/right inputs being swapped... (expected) Seems geometry uses both |
Aah, I changed the flight example code but couldn't work out why it still wasn't working properly. Didn't realise the mode7 code also used the rotation matrices. Using the |
Not disagreeing about There's probably quite a bit that could be improved about the |
If I'm not mistaken, the two |
Hopefully that fixes everything :) |
Co-authored-by: Daft Freak <charlie@daft.games>
Hmm, seems a bit inconsistent for |
While I agree that it's probably a good thing to fix what's logically broken, I'm also aware this is a change in behaviour and probably worth flagging loudly when it gets merged, so anyone else using Github search (such that it is) only throws up a couple of uses, mind... |
Quick grep on the local repos the cupboard bot has: (only covers 32blit tagged repos)
... and 2/3 of those repos fail to build with the current SDK anyway. But yeah, this is technically a breaking change. |
The trees seemed to be fine once I negated the angle in every |
I did test it and the trees are definitely not attached to the ground. (Actually, I think it's the ground that's backwards... which makes sense as the the start/end coords of the scanline would be swapped). |
Think that fixes everything, and also avoids the nasty negatives in the calls to |
Did that fix it? |
Changed matrix field declarations to reflect the logical matrix layout. Fixed rotation matrix generation so that it rotates the right way (anticlockwise)!