flushMesh static method

MeshGeometry? flushMesh({
  1. GeometryBufferArena? bufferArena,
  2. GeometryStorage storage = GeometryStorage.fixed,
})

Builds a MeshGeometry containing all accumulated line segments and clears the buffer.

Implementation

static MeshGeometry? flushMesh({
  GeometryBufferArena? bufferArena,
  GeometryStorage storage = GeometryStorage.fixed,
}) {
  if (_positions.isEmpty) return null;

  final posList = Float32List.fromList(_positions);
  final colList = Float32List.fromList(_colors);
  _positions.clear();
  _colors.clear();
  _hasWarnedLimit = false;

  return MeshGeometry.fromArrays(
    positions: posList,
    colors: colList,
    primitiveType: gpu.PrimitiveType.line,
    bufferArena: bufferArena,
    storage: storage,
  );
}