JOML-CI / JOML

A Java math library for OpenGL rendering calculations
MIT License
728 stars 104 forks source link

Can't use same view, dest, for Matrix4f.mulPerspectiveAffine() #266

Closed reverse-solidus closed 4 years ago

reverse-solidus commented 4 years ago

Matrix4f.mulPerspectiveAffine(Matrix4fc view, Matrix4f dest) does not work with the same matrix for both view and dest.

Compare to mul0():

Matrix4f t = new Matrix4f();
Matrix4f p = new Matrix4f().perspective(60.0f * (float)Math.PI / 180.0f, 4.0f/3.0f, 0.1f, 1000.0f);

Matrix4f result1 = new Matrix4f();
Matrix4f result2 = new Matrix4f();

t.invertAffine(result1);
p.mul(result1, result1);

t.invertAffine(result2);
p.mul0(result2, result2);

System.out.println(result1.equals(result2, 1.0e-4f));
System.out.println(result1);
System.out.println(result2);
httpdigest commented 4 years ago

Thanks for the report! Fixed with https://github.com/JOML-CI/JOML/commit/3275f4f2d15979bdfc1bb7ee17fce304356281ff . 1.9.26-SNAPSHOT build is in progress.