Camera constructor

const Camera({
  1. required int id,
  2. required int width,
  3. required int height,
  4. required Vector3 position,
  5. required Matrix3 rotation,
  6. required double fx,
  7. required double fy,
  8. double znear = 0.2,
  9. double zfar = 200.0,
  10. double ndcYSign = -1.0,
})

Creates a camera with explicit intrinsics and extrinsics.

  • width/height are in pixels and must be > 0.
  • fx/fy are focal lengths in pixels and must be > 0.
  • rotation is camera → world (columns are right, up, forward).
  • znear/zfar define clip planes (OpenGL-style), znear > 0, zfar > znear.

Implementation

const Camera({
  required this.id,
  required this.width,
  required this.height,
  required this.position,
  required this.rotation,
  required this.fx,
  required this.fy,
  this.znear = 0.2,
  this.zfar = 200.0,
  this.ndcYSign = -1.0, // default for Flutter texture targets
})  : assert(width > 0, 'Camera width must be greater than 0, got: $width'),
      assert(
        height > 0,
        'Camera height must be greater than 0, got: $height',
      ),
      assert(fx > 0, 'Focal length fx must be greater than 0, got: $fx'),
      assert(fy > 0, 'Focal length fy must be greater than 0, got: $fy'),
      assert(
        znear > 0,
        'Near clip plane must be greater than 0, got: $znear',
      ),
      assert(
        zfar > znear,
        'Far clip plane ($zfar) must be '
        'greater than near clip plane ($znear)',
      );