transform4 method

void transform4 (Float32x4List out, int outOffset, Float32x4List matrix, int matrixOffset, Float32x4List vector, int vectorOffset)

Transform the 4D vector starting at vectorOffset by the 4x4 matrix starting at matrixOffset. Store result in out starting at outOffset.

Implementation

static void transform4(Float32x4List out, int outOffset, Float32x4List matrix,
    int matrixOffset, Float32x4List vector, int vectorOffset) {
  Float32x4 v = vector[vectorOffset];
  Float32x4 xxxx = v.shuffle(Float32x4.XXXX);
  Float32x4 z = new Float32x4.zero();
  z += xxxx * matrix[0 + matrixOffset];
  Float32x4 yyyy = v.shuffle(Float32x4.YYYY);
  z += yyyy * matrix[1 + matrixOffset];
  Float32x4 zzzz = v.shuffle(Float32x4.ZZZZ);
  z += zzzz * matrix[2 + matrixOffset];
  z += matrix[3 + matrixOffset];
  out[0 + outOffset] = z;
}