transform4 method Null safety

void transform4(
  1. Float32x4List out,
  2. int outOffset,
  3. Float32x4List matrix,
  4. int matrixOffset,
  5. Float32x4List vector,
  6. 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) {
  final v = vector[vectorOffset];
  final xxxx = v.shuffle(Float32x4.xxxx);
  var z = Float32x4.zero();
  z += xxxx * matrix[0 + matrixOffset];
  final yyyy = v.shuffle(Float32x4.yyyy);
  z += yyyy * matrix[1 + matrixOffset];
  final zzzz = v.shuffle(Float32x4.zzzz);
  z += zzzz * matrix[2 + matrixOffset];
  z += matrix[3 + matrixOffset];
  out[0 + outOffset] = z;
}