build method

MeshGeometry build({
  1. GeometryStorage storage = GeometryStorage.fixed,
})

Builds and GPU-uploads the accumulated mesh.

Pass GeometryStorage.updatable for storage to build a mesh that can be mutated in place afterwards.

Implementation

MeshGeometry build({GeometryStorage storage = GeometryStorage.fixed}) {
  return MeshGeometry.fromArrays(
    positions: Float32List.fromList(_positions),
    normals: _resolveNormals(),
    texCoords: Float32List.fromList(_texCoords),
    colors: Float32List.fromList(_colors),
    indices: _indices.isEmpty ? null : List.of(_indices),
    storage: storage,
  );
}