Skip to content

SetModeler

Namespace Nfty.Model in assembly Nfty.Model.

public sealed class SetModeler : IAssetModeler

Rises every asset of a cook into model files: StackDepth.ForAsset() for the depth, Riser.TryBuild() for the solid, ModelWriter for the bytes.

Remarks

Reads only — the book and the asset's picture are never mutated — so concurrent calls for different assets are safe and the bytes depend on the asset alone, at any thread count.

Constructors

SetModeler(LoadedCookBook, RiseOptions)

public SetModeler(LoadedCookBook book, RiseOptions options);

Creates the modeler.

Parameters

  • book (LoadedCookBook) - The book the Set is cooked from.
  • options (RiseOptions) - How to rise and write.

Exceptions

Properties

Options

public SetModels Options { get; }

The options the models are made with, recorded in set.json. Its SetModels.Skipped is ignored here; the writer fills it in.

Methods

FileNames(string)

public IReadOnlyList<string> FileNames(string baseName);

Every file name IAssetModeler.Model() may return for an asset, derivable without building any model. The writer validates these for the whole Set before writing anything, then refuses a model file whose name was not declared here.

Parameters

  • baseName (string) - The asset's zero-padded number.

Returns. The bare file names.

Model(GeneratedAsset, string)

public IReadOnlyList<SetFile>? Model(GeneratedAsset asset, string baseName);

Files for one asset, named from baseName ("0007" becomes "0007.glb"), or null when nothing in it is fully opaque. Called concurrently for different assets, so it must be a pure function of its input.

Parameters

  • asset (GeneratedAsset) - The finished asset.
  • baseName (string) - The asset's zero-padded number.

Returns. The files, or null when the asset cannot be modeled.