Open davidjeck opened 1 year ago
fixed
As for normalMatrixFromMat4
, yea, I can see the point. I'd probably name it mat3.fromMat4Transpose
or something like that.
Thanks, that was fast. This now works for computing the normal transformation matrix from the modelview matrix:
wgpuMatrix.mat3.fromMat4(modelview,normalMatrix);
wgpuMatrix.mat3.inverse(normalMatrix,normalMatrix);
wgpuMatrix.mat3.transpose(normalMatrix,normalMatrix);
I will use wgpu-matrix for 3D WebGPU graphics in the next version of my on-line computer graphics textbook.
It seems like mat3.inverse() in version 2.4.0 actually computes the transpose of the inverse. mat4.inverse() is OK. I was trying to use gpu-matrix to compute a normal vector transformation matrix -- a mat3.normalMatrixFromMat4() function would be a good addition.