Matrix4.translationRotateScale()
is in.
It’s the same as doing translation().rotate().scale()
, just in a single method where I built the method by doing the whole three transformations first and then reducing operations that were known to produce ones or zeroes.
(edit: thanks for suggesting to add this little method! It’s about 60x faster than doing the three steps manually. 90 million invocations with some translation, rotation and scaling now only take 40 milliseconds… compared to 2.4 seconds with the manual approach.)
And as Riven pointed out, the only reason why JOML is slightly faster is likely due to that field/register optimization. JOML doesn’t do anything special or clever there, because there is simply no other way that you can implement 4x4 matrix multiplication or inversion differently than what JOML or libGDX or any other library does, on the arithmetics side.
However, I do believe that with the is*InsideFrustum()
methods, JOML took the fastest possible road (not needing to build a Frustum class or a Plane class or normalizing the plane ‘normals’, or building the planes out of NDC-unprojected points, etc.), while still being generic (coping with arbitrary matrices) and not making use of temporal coherency (that would be the next step in optimization, also proposed by the paper I implemented the algorithm from).
But that optimization falls more in the realm of a real game engine.
So, make sure to use the latest HEAD when benchmarking JOML on these functions.