-
Notifications
You must be signed in to change notification settings - Fork 139
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
Examples or docs #15
Comments
Well, linmath.h was a header I added to whenever I needed, I copied it around a lot and unfortunately I have a number of variants on my system, which I really have to merge into a single version eventually. When it comes to documentation, well, this was the least priority for the thing. When releasing this I hoped the function prototypes themself would be self explanatory. The essential idea is that for non-scalar types the first parameter points to where the result goes and the other parameters are the operands. Scalar results are delivered through the function return value. |
OK, that makes sense, thanks for the answer! Perhaps you can tell me if this is a good way of using the functions or if there is a better method? mat4x4 M;
mat4x4_identity(M);
mat4x4 M2;
mat4x4_identity(M2);
mat4x4_rotate(M2, M, 0.0f, 0.0f, 1.0f, angle); |
@eriksvedang: this is perfectly valid, since you are passing arrays to the functions. an array is in fact just a pointer to the first element of that array. int a[3] = { 1, 3, 9 }; // a[2] == *(a+2) as you can see, a is just a pointer to the first element of an array of 3 ints. |
Mhm, I was just worried that I'm creating an unnecessary amount of matrices (M and M2), perhaps it could be done with just a single one? |
Just think of M as a non identity Matrix. Your own example is just a bit misleading. :) mat4x4_rotate() expects an input matrix (M) which may contain other transform operations. On the other hand you keep your matrices separated which can be used individually later on. // good
mat4x4 model, view, projection;
...
// bad
mat4x4 mvp;
... |
Hi, thanks for the library! I have searched for some example code using the library (or docs). Does anyone know of anything?
Thanks,
Erik
The text was updated successfully, but these errors were encountered: