Vixen
dd8b0a81
csharp
public sealed class StbImageDecoder

Reads the authoring formats artists actually save.

Read the guide page for this →

Remarks

This is not the ImageSharp doc 01 specified, and the reason is in Directory.Packages.props: ImageSharp 4.0.0 fails the build without a purchased licence key, which an Apache-2.0 engine cannot ask of a contributor who wants to compile the editor. Doc 01 already named StbImageSharp as the fallback and this is it — public domain, and covering more of doc 08's importer table than ImageSharp did, because it reads Radiance HDR.

HDR goes to float and everything else to eight-bit RGBA. A Radiance file holds radiance, which has no upper bound, and narrowing it to a byte at the front door would discard exactly the range an environment map exists for — the sun being ten thousand times the sky is the whole content of the image.

TGA's origin bit is honoured, and that is not a detail. Bit 5 of a TGA's image descriptor says whether row zero is the top or the bottom, both are legal, and a decoder that ignores it reads half the world's TGAs upside down — where a flipped albedo and a flipped normal map both render plausibly. StbImageSharp gets it right; nothing asserted that until TgaOrientationTests, which builds the same picture both ways up from the format and requires the same pixels back.

Not read here: .exr, .tif and .webp, which doc 08's table asks for and which have no licence-clean managed reader worth adding on spec. .dds is read, by DdsDecoder — doc 01 named Pfim for it, and it turned out to need a header parser rather than a codec.

Fields and properties (2)

  • public const string HighDynamicRangeExtension

    Radiance HDR, the one format here that carries more range than a byte.

  • public IReadOnlyList<string> Extensions

    Which extensions it reads, lowercase and with their leading dots.

Methods (1)

  • public TextureData Decode(Stream stream, string extension)

    Decodes an image.

Used by (3)

  • HdrImportTestsVixen.Editor.Assets.Tests
  • ImageDecodersVixen.Editor.Assets
  • TgaOrientationTestsVixen.Editor.Assets.Tests