Vixen
02b45cc4
csharp
public static class TextureLadder

What a texture will ship as, worked out from its source size and its settings.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Arithmetic, not an import. Every number a mip inspector shows — how many levels, how big each one is, what the whole chain costs — follows from the source's extent, the size limit and the compressed format. Running the importer to find out would make opening a texture cost a block-compression pass, and would answer a question about the artefact rather than about the settings the author is editing.

⚠ The size limit halves rather than resamples, which is the behaviour MaxSize documents and which is worth seeing: a 2048 under a limit of 1000 ships at 512, and the ladder here says 512 rather than 1000.

Methods (6)

  • public static long BytesFor(TextureCompression compression, int width, int height)

    How many bytes a block-compressed or uncompressed level of a given size costs.

  • public static TextureCompression Resolve(TextureImportEdits settings)

    The format the importer will actually use, resolving Automatic.

  • public static (int Width, int Height) Fit(int width, int height, int maxSize)

    The extent a texture ships at, after the size limit has halved it into range.

  • public static IReadOnlyList<TextureMipLevel> Build(int width, int height, TextureImportEdits settings)

    The whole chain a texture will ship as.

  • public static long TotalBytes(IReadOnlyList<TextureMipLevel> levels)

    What the whole chain costs.

  • public static TextureData? TryDecode(string path, out string? reason)

    Decodes a texture's source file, or answers why it could not.

Used by (3)

  • SpriteSheetViewVixen.Editor.AssetEditors
  • TextureImportViewVixen.Editor.AssetEditors
  • TextureLadderTestsVixen.Editor.AssetEditors.Tests