Add GRRLIB_matrix and transformation functions#24
Add GRRLIB_matrix and transformation functions#24htv04 wants to merge 1 commit intoGRRLIB:masterfrom
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
| // Default matrix settings, reflected in GRRLIB_Origin() | ||
| 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.
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.
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.
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.
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.