fromCubeString static method

ColorLut fromCubeString(
  1. String content
)

Parses the text of a .cube file and uploads the table.

Supports 3D tables up to edge length 64. TITLE and domain lines are tolerated; values are clamped to the 0, 1 display range.

Implementation

static ColorLut fromCubeString(String content) {
  final table = parseCubeTable(content);
  final bytes = packCubeStrip(table);
  final texture = gpu.gpuContext.createTexture(
    gpu.StorageMode.hostVisible,
    table.size * table.size,
    table.size,
  );
  texture.overwrite(ByteData.sublistView(bytes));
  return ColorLut._(texture, table.size);
}