Skip to content

Proposal: optimized functions to multiply 3 matrices at once without using _mulN  #124

@recp

Description

@recp

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:

  1. Using glm_mat4_mulN() which is nice helper but it uses loop.
  2. Using two 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 matrices
  • glm_mvp(m, v, p) or glm_pvm(p, v, m) or glm_mul_mvp(m, v, p) or glm_mul_pvm(p, v, m) for Model * 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... 🤗

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions