-
Notifications
You must be signed in to change notification settings - Fork 19
Add GRRLIB_matrix and transformation functions #24
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
base: master
Are you sure you want to change the base?
Conversation
Drafted this PR for now because I am working on adding set/get matrix functionality to GRRLIB, as well as a GRRLIB_matrix type. |
I need to rename GRRLIB_transform to GRRLIB_matrix, but I am not home right now, so I drafted this PR again in the meantime |
Okay, I don't think I have any more changes to make. If there's anything you think I should change, let me know. |
GRRLIB/GRRLIB/GRRLIB_core.c
Outdated
guMtxIdentity(GXmodelView2D); | ||
guMtxTransApply(GXmodelView2D, GXmodelView2D, 0.0F, 0.0F, -100.0F); | ||
guMtxTransApply(GXmodelView2D, GXmodelView2D, 0.0, 0.0, -100.0); |
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.
Minor nit: this function expects floats, double precision is not needed. So f
suffix was correct (lowercase though).
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.
Not to sound lazy, but doesn't the compiler handle that automatically, since the function takes float arguments? Kind of like with signed and unsigned integers, where adding a U
is unnecessary in most cases
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.
In this specific case it works, since the double
value will be cut off to represent a float
. (See question 2 in the linked quiz). Generally this leads to subtle differences, since the representation of both are quite different.
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.
Okay, I added f
suffixes, even if it's just for clarity. I also squashed and rebased my PR's commits.
These functions make it possible to manage GRRLIB's 2D matrix and transform it directly and safely from GRRLIB.