Skip to content
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

Suggestion: rename last two parameters of mat4_perspective in mathc.h to speaking names #40

Open
ghost opened this issue Jan 29, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 29, 2020

I had to google around and check out libglm usage to see what parameters a perspective transformation commonly takes (and yes I'm familiar with clipping planes and all, I just never used lowlevel OpenGL directly before) to figure out what on earth n or f are. Turns out it's "near clipping" and "far clipping":

mfloat_t *mat4_perspective(mfloat_t *result, mfloat_t fov_y, mfloat_t aspect, mfloat_t n, mfloat_t f)

Therefore, I recommend renaming them to znear and zfar in the header since that will make it way easier both to guess and to google what they are used for. It may seem like a minor nitpick but this can really help a lot when there's otherwise no documentation available.

Edit: proposal updated due to @RandyGaul 's remark

@RandyGaul
Copy link

near and far are names taken by Windows.h, so any other names would be slightly simpler to use.

@ghost
Copy link
Author

ghost commented Jan 29, 2020

What do you mean with "taken by Windows.h"? If you rename them in the header only they aren't in anyone's scope, so that shouldn't be an issue on a technical level. (You can still keep the old parameter names in the mathc.c actual implementation file.) Or are you saying people would be confused by these names?

Edit: oh fascinating, seems like they're macros which is a problem. Good catch! What about znear and zfar then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant