Merge pull request #683 from jmiskovic/fix/mat4_mul_vec3_w

Restore w normalization in mat4:mul(vec3)
This commit is contained in:
Bjorn 2023-07-15 12:33:37 -07:00 committed by GitHub
commit 01ac8ef8a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -684,7 +684,8 @@ MAF vec4 mat4_mulPoint(mat4 m, vec3 v) {
float x = v[0] * m[0] + v[1] * m[4] + v[2] * m[8] + m[12];
float y = v[0] * m[1] + v[1] * m[5] + v[2] * m[9] + m[13];
float z = v[0] * m[2] + v[1] * m[6] + v[2] * m[10] + m[14];
return vec3_set(v, x, y, z);
float w = v[0] * m[3] + v[1] * m[7] + v[2] * m[11] + m[15];
return vec3_set(v, x / w, y / w, z / w);
}
MAF vec4 mat4_mulDirection(mat4 m, vec3 v) {