setYawPitchDegrees method

void setYawPitchDegrees(
  1. double yawDeg,
  2. double pitchDeg
)

Applies a yaw/pitch rotation (in degrees) to the background.

Positive yaw rotates to the right around the Y axis; positive pitch rotates upward around the X axis. The resulting matrix is stored internally and applied during execute.

Implementation

void setYawPitchDegrees(double yawDeg, double pitchDeg) {
  final y = yawDeg * math.pi / 180.0;
  final p = pitchDeg * math.pi / 180.0;
  final cy = math.cos(y);
  final sy = math.sin(y);
  final cp = math.cos(p);
  final sp = math.sin(p);

  _bgRot = Float32List.fromList(<double>[
    cy,
    sy * sp,
    sy * cp,
    0,
    cp,
    -sp,
    -sy,
    cy * sp,
    cy * cp,
  ]);
}