src/m4.js
function lookAt(eye, target, up, dst) {
  dst = dst || new MatType(16);

  const xAxis = tempV3a;
  const yAxis = tempV3b;
  const zAxis = tempV3c;

  v3.normalize(
      v3.subtract(eye, target, zAxis), zAxis);
  v3.normalize(v3.cross(up, zAxis, xAxis), xAxis);
  v3.normalize(v3.cross(zAxis, xAxis, yAxis), yAxis);

  dst[ 0] = xAxis[0];
  dst[ 1] = xAxis[1];
  dst[ 2] = xAxis[2];
  dst[ 3] = 0;
  dst[ 4] = yAxis[0];
  dst[ 5] = yAxis[1];
  dst[ 6] = yAxis[2];
  dst[ 7] = 0;
  dst[ 8] = zAxis[0];
  dst[ 9] = zAxis[1];
  dst[10] = zAxis[2];
  dst[11] = 0;
  dst[12] = eye[0];
  dst[13] = eye[1];
  dst[14] = eye[2];
  dst[15] = 1;

  return dst;
}
function lookAt(eye, target, up, dst) {
  dst = dst || new MatType(16);

  const xAxis = tempV3a;
  const yAxis = tempV3b;
  const zAxis = tempV3c;

  v3.normalize(
      v3.subtract(eye, target, zAxis), zAxis);
  v3.normalize(v3.cross(up, zAxis, xAxis), xAxis);
  v3.normalize(v3.cross(zAxis, xAxis, yAxis), yAxis);

  dst[ 0] = xAxis[0];
  dst[ 1] = xAxis[1];
  dst[ 2] = xAxis[2];
  dst[ 3] = 0;
  dst[ 4] = yAxis[0];
  dst[ 5] = yAxis[1];
  dst[ 6] = yAxis[2];
  dst[ 7] = 0;
  dst[ 8] = zAxis[0];
  dst[ 9] = zAxis[1];
  dst[10] = zAxis[2];
  dst[11] = 0;
  dst[12] = eye[0];
  dst[13] = eye[1];
  dst[14] = eye[2];
  dst[15] = 1;

  return dst;
}
function lookAt ( eye , target , up , dst ) { dst = dst || new MatType ( 16 ) ; const xAxis = tempV3a ; const yAxis = tempV3b ; const zAxis = tempV3c ; v3 . normalize ( v3 . subtract ( eye , target , zAxis ) , zAxis ) ; v3 . normalize ( v3 . cross ( up , zAxis , xAxis ) , xAxis ) ; v3 . normalize ( v3 . cross ( zAxis , xAxis , yAxis ) , yAxis ) ; dst [ 0 ] = xAxis [ 0 ] ; dst [ 1 ] = xAxis [ 1 ] ; dst [ 2 ] = xAxis [ 2 ] ; dst [ 3 ] = 0 ; dst [ 4 ] = yAxis [ 0 ] ; dst [ 5 ] = yAxis [ 1 ] ; dst [ 6 ] = yAxis [ 2 ] ; dst [ 7 ] = 0 ; dst [ 8 ] = zAxis [ 0 ] ; dst [ 9 ] = zAxis [ 1 ] ; dst [ 10 ] = zAxis [ 2 ] ; dst [ 11 ] = 0 ; dst [ 12 ] = eye [ 0 ] ; dst [ 13 ] = eye [ 1 ] ; dst [ 14 ] = eye [ 2 ] ; dst [ 15 ] = 1 ; return dst ; }
Computes a 4-by-4 look-at transformation.

This is a matrix which positions the camera itself. If you want
a view matrix (a matrix which moves things in front of the camera)
take the inverse of this.

@param {module:twgl/v3.Vec3} eye The position of the eye.
@param {module:twgl/v3.Vec3} target The position meant to be viewed.
@param {module:twgl/v3.Vec3} up A vector pointing up.
@param {module:twgl/m4.Mat4} [dst] matrix to hold result. If none new one is created..
@return {module:twgl/m4.Mat4} The look-at matrix.
@memberOf module:twgl/m4
Computes a 4 - by - 4 look - at transformation .