def CubeFaceProjectionMatrix(near, far):
  """Creates a cube-face 90 degree FOV projection matrix.

  The created matrix is an OpenGL-style projection matrix.

  Args:
    near: Eye-space Z position of the near clipping plane.
    far: Eye-space Z position of the far clipping plane.

  Returns:
    The clip-from-eye matrix as a list in row-major order.

  Raises:
    ValueError: Invalid clip planes. near <= 0.0 or far <= near.
  """
  if near <= 0.0:
    raise ValueError('near must be positive.')

  if far <= near:
    raise ValueError('far must be greater than near.')

  left = -near
  right = near
  bottom = -near
  top = near
  a = (2.0 * near) / (right - left)
  b = (2.0 * near) / (top - bottom)
  c = (right + left) / (right - left)
  d = (top + bottom) / (top - bottom)
  e = (near + far) / (near - far)
  f = (2.0 * near * far) / (near - far)

  # pylint: disable=bad-whitespace
  return [a,   0.0,  c,   0.0,
          0.0, b,    d,   0.0,
          0.0, 0.0,  e,   f,
          0.0, 0.0, -1.0, 0.0]  # pyformat: disable