Geometry constructor

Geometry(
  1. Float32List vertices,
  2. Uint16List indices, {
  3. Float32List? normals,
  4. Float32List? uvs,
  5. PrimitiveType primitiveType = PrimitiveType.TRIANGLES,
})

Implementation

Geometry(
  this.vertices,
  this.indices, {
  Float32List? normals,
  Float32List? uvs,
  this.primitiveType = PrimitiveType.TRIANGLES,
}) {
  this.uvs = uvs ?? Float32List(0);
  this.normals = normals ?? Float32List(0);
  if (this.uvs.length != 0 && this.uvs.length != (vertices.length ~/ 3 * 2)) {
    throw Exception(
        "Expected either ${indices.length * 2} UVs, got ${this.uvs!.length}");
  }
}