Vixen
02b45cc4
csharp
public sealed class TextureImporter

Turns an image an artist saved into the KTX2 file a device uploads.

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

As a importer

Extensions
.png .jpg .jpeg .bmp .tga .psd .gif .hdr .ktx2

Remarks

Decode, limit, label, reduce, compress, write. Every step but the first is Vixen.Core.Imaging, and the whole reason this class is short is that the decisions live where they can be tested against something: the mip filter's variants, the block encoders' bounds, the container's layout.

What it decides, and what it refuses to decide. It picks a compressed format from the usage when the settings say Automatic, and it will not pick one that cannot hold what the texture is — a colour texture is not silently squeezed into BC5's two channels. When the target is a phone it produces uncompressed and says why, rather than shipping BC7 that most Android hardware cannot sample.

A compressed source passes straight through. A .ktx2 an artist compressed with a better encoder is copied rather than decoded and re-encoded, because a second round of lossy compression only ever loses.

Fields and properties (1)

  • public override int Version

    Its own version. Bumping it invalidates every artefact it has ever produced, which is the whole mechanism for "I fixed the mip filter, re-import everything".

Methods (3)

  • public TextureImporter()

    Uses the decoders that ship.

  • public TextureImporter(IReadOnlyList<IImageDecoder> decoders)

    Uses a given set of decoders.

  • protected override ValueTask<ImportResult> ImportAsync(ImportContext context, TextureImportSettings settings, CancellationToken cancellationToken)

    Imports one asset.

Used by (2)

  • BuiltInImportersVixen.Editor.Assets
  • TextureImporterTestsVixen.Editor.Assets.Tests