Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- multiply(mat4) { /* use this and mat4 for obtaining dot products (each new element) */
- let t = this.array;
- let m = mat4.array;
- return new Matrix4([ t[0]*m[0] + t[1]*m[4] + t[2]*m[8] + t[3]*m[12], /**/
- t[0]*m[1] + t[1]*m[5] + t[2]*m[9] + t[3]*m[13], /**/
- t[0]*m[2] + t[1]*m[6] + t[2]*m[10] + t[3]*m[14], /**/
- t[0]*m[3] + t[1]*m[7] + t[2]*m[11] + t[3]*m[15], /**/
- t[4]*m[0] + t[5]*m[4] + t[6]*m[8] + t[7]*m[12], /**/
- t[4]*m[1] + t[5]*m[5] + t[6]*m[9] + t[7]*m[13], /**/
- t[4]*m[2] + t[5]*m[6] + t[6]*m[10] + t[7]*m[14], /**/
- t[4]*m[3] + t[5]*m[7] + t[6]*m[11] + t[7]*m[15], /**/
- t[8]*m[0] + t[9]*m[4] + t[10]*m[8] + t[11]*m[12], /**/
- t[8]*m[1] + t[9]*m[5] + t[10]*m[9] + t[11]*m[13], /**/
- t[8]*m[2] + t[9]*m[6] + t[10]*m[10] + t[11]*m[14], /**/
- t[8]*m[3] + t[9]*m[7] + t[10]*m[11] + t[11]*m[15], /**/
- t[12]*m[0] + t[13]*m[4] + t[14]*m[8] + t[15]*m[12], /**/
- t[12]*m[1] + t[13]*m[5] + t[14]*m[9] + t[15]*m[13],
- t[12]*m[2] + t[13]*m[6] + t[14]*m[10] + t[15]*m[14], /**/
- t[12]*m[3] + t[13]*m[7] + t[14]*m[11] + t[15]*m[15] ]);
- }
Advertisement
Add Comment
Please, Sign In to add comment