plane static method

Geometry plane({
  1. double width = 1.0,
  2. double height = 1.0,
  3. bool normals = true,
  4. bool uvs = true,
})

Implementation

static Geometry plane(
    {double width = 1.0,
    double height = 1.0,
    bool normals = true,
    bool uvs = true}) {
  Float32List vertices = Float32List.fromList([
    -width / 2,
    0,
    -height / 2,
    width / 2,
    0,
    -height / 2,
    width / 2,
    0,
    height / 2,
    -width / 2,
    0,
    height / 2,
  ]);

  Float32List? _normals = normals
      ? Float32List.fromList([
          0,
          1,
          0,
          0,
          1,
          0,
          0,
          1,
          0,
          0,
          1,
          0,
        ])
      : null;

  Float32List? _uvs = uvs
      ? Float32List.fromList([
          0,
          0,
          1,
          0,
          1,
          1,
          0,
          1,
        ])
      : null;

  final indices = Uint16List.fromList([
    0,
    1,
    2,
    0,
    2,
    3,
  ]);

  return Geometry(vertices, indices, normals: _normals, uvs: _uvs);
}