Just to elaborate on ClickerMonkey's perfectly correct answer:

You can't *generally* multiply a vector of 3 components with a 4x4 matrix, but the standard geometric interpretation of a 4x4 matrix is of an affine transform in homogeneous coordinate space. A vector in 3d Cartesian space (x,y,z) is a vector in homogeneous space (x,y,z,w) where w=1. So long story short, you turn your vec3(x,y,z) into a vec4(x,y,z,1) and then do normal matrix multiplication with it.

Agreed! Transforming vectors need a w value of 0 and transforming points need a value of 1!

w is this neat part of a vector, if you set it to the square root of a point, the point is interpreted by OpenGL or a Matrix as a normalized vector.

1
| v.w = (float)Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z); |

Point/Vector is now normalized!

Full transform method with Vec4

1 2 3 4
| out.x = (in.x * e00) + (in.y * e01) + (in.z * e02) + (in.w * e03); out.y = (in.x * e10) + (in.y * e11) + (in.z * e12) + (in.w * e13); out.z = (in.x * e20) + (in.y * e21) + (in.z * e22) + (in.w * e23); out.w = (in.x * e30) + (in.y * e31) + (in.z * e32) + (in.w * e33); |