-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
Proposal: optimized functions to multiply 3 matrices at once without using _mulN #124
Comments
I would suggest pvm, for |
I like the |
@Uwila , @acoto87 thanks for reviewing this proposal!
the multiplication order will same: ### Projection * View * Model for both single call will make things more readable and faster because, I want to optimize triple matrix multiplication in one function to get maximum performance and less instructions and less binary size.
I guess you are talking about For instance there are a few functions to multiply mat4 in cglm:
/* affine-mat.h */
R R R X
R R R Y
R R R Z
0 0 0 W
/* affine-mat.h */
R R R 0
R R R 0
R R R 0
0 0 0 1 |
I meant in the context of |
I kind of agree with @Uwila but with the names About the order of the parameters, it's a matter of semantics when you talk about it; That last version could also create confusion, because you can treat that operation as:
depending on how you store matrices, but since this library store matrices column-wise, the latter is what will be used, and the explicit |
For https://github.com/toji/gl-matrix/blob/fdab302a5a3ae9b7a975fcba7aa5d3112a681f94/src/mat4.js#L1320 |
Hi, Thanks for the feedbacks, I'll try to work on this after #413 when I available |
It is common to multiply Model, View and Project matrices together, there may be additional matrices to multiply...
We have two option to multiply 3 matrices:
glm_mat4_mulN()
which is nice helper but it uses loop.glm_mat4_mul()
call which is general.Proposal:
New functions to multiply 3 or 4 matrices.
glm_mat4_mul3x(m1, m2, m3, dest)
,glm_mat4_mul4x(m1, m2, m3, m4, dest)
- general matrix multiplication to multiply 3 or 4 matricesglm_mvp(m, v, p)
orglm_pvm(p, v, m)
orglm_mul_mvp(m, v, p)
orglm_mul_pvm(p, v, m)
forModel * View * Proj
. Model matrix' rotation vectors' last component must be zero. (mvp vs pvm?)glm_trs
-Translate * Rotate * Scale
same for mat2 and mat3. Better names and ideas are always welcome. These functions will be optimized especially with SIMD, loop will not be used.
This will also make engines, renderers, games... faster and with less cglm call[s] and more readable, more neat... 🤗
The text was updated successfully, but these errors were encountered: