Skip to content

VoxelReport

Namespace Nfty.Core.Stats in assembly Nfty.Core.

public static class VoxelReport

Reports whether an archive's artwork can be turned into a voxel model, and where it cannot.

Remarks

Partial alpha is allowed: the editor's opacity lock is a default an author may turn off deliberately, so this is a report and not a Validator problem. A semi-transparent pixel is simply not answerable as a voxel — a converter has to drop it or make it solid, and either way the result is not what was drawn. This says which pixels those are before someone finds out downstream.

Rendered here rather than in a front-end for the reason every report in this namespace is: the CLI and the GUI must show the same text, and two copies is how that stops being true. The format is invariant — these get pasted into issues and diffed across machines.

It costs a full scan of every variant image, which is why nothing runs it implicitly.

Methods

CountPartial(Image<Rgba32>)

public static int CountPartial(Image<Rgba32> img);

Counts pixels that are neither fully opaque nor fully erased.

Parameters

  • img (Image<Rgba32>) - The image to scan.

Returns. How many pixels carry partial alpha.

Render(string, IReadOnlyList<VoxelVariant>)

public static string Render(string title, IReadOnlyList<VoxelVariant> rows);

Renders the report a human reads.

Parameters

  • title (string) - What was scanned, for the heading.
  • rows (IReadOnlyList<VoxelVariant>) - The scanned variants.

Returns. The report text, ending in a newline.

Scan(LoadedCookBook, Parallelism?)

public static IReadOnlyList<VoxelVariant> Scan(LoadedCookBook book, Parallelism? parallelism = null);

Scans every variant in a cookbook.

Parameters

  • book (LoadedCookBook) - The book to scan.
  • parallelism (Parallelism?) - How wide the pixel scans may run; null means Parallelism.Default. The rows never depend on it.

Returns. One row per variant.

Scan(LoadedIngredient, Parallelism?)

public static IReadOnlyList<VoxelVariant> Scan(LoadedIngredient ing, Parallelism? parallelism = null);

Scans one ingredient's variants.

Parameters

  • ing (LoadedIngredient) - The layer to scan.
  • parallelism (Parallelism?) - How wide the pixel scans may run; null means Parallelism.Default. The rows never depend on it.

Returns. One row per variant, in manifest order.

Scan(LoadedRecipe, Parallelism?)

public static IReadOnlyList<VoxelVariant> Scan(LoadedRecipe recipe, Parallelism? parallelism = null);

Scans every variant of every layer in a recipe, in paint order.

Parameters

  • recipe (LoadedRecipe) - The recipe to scan.
  • parallelism (Parallelism?) - How wide the pixel scans may run; null means Parallelism.Default. The rows never depend on it.

Returns. One row per variant.